Skip to content

[Bug]: Args parsing and quoting broken in jukebox configuration #3619

@tcurdt

Description

@tcurdt

I confirm that:

  • I have searched the existing open AND closed issues to see if an issue already exists for the bug I've encountered
  • I'm using the latest version (your issue may have been fixed already)

Version

0.54.3

Current Behavior

Splitting args just by space is not how a shell splits args. Which leads to quoting problems for a slightly more complicated setup (when for example setting up snapcast support).

split := strings.Split(fixCmd(conf.Server.MPVCmdTemplate), " ")

Expected Behavior

Either the args splitting should be done a little smarter https://github.com/mattn/go-shellwords

...or jukebox mpv template setup should be reconsidered (which is probably a good idea, too).

Steps To Reproduce

Just try to wrap the mpv with a wrapper script and find yourself in quoting hell.

Environment

NA

How Navidrome is installed?

Docker

Configuration

services:
  navidrome:
    container_name: navidrome
    image: deluan/navidrome:0.54.3
    restart: unless-stopped
    user: 65534:65534
    environment:
      ND_LOGLEVEL: error
      ND_CONFIGFILE: "/data/navidrome.toml"
      ND_SCANSCHEDULE: "@every 24h"
      ND_SESSIONTIMEOUT: 168h
      ND_PROMETHEUS_ENABLED: true
      ND_PROMETHEUS_METRICSPATH: "/metrics"
      ND_JUKEBOX_ENABLED: true
      ND_MPVCMDTEMPLATE: "/usr/bin/mpv --no-audio-display --pause %f --input-ipc-server=%s --audio-channels=stereo --audio-samplerate=48000 --audio-format=s16 --ao=pcm --ao-pcm-file=/audio/snapcast_fifo"
      # ND_MPVCMDTEMPLATE: "/tmp/mpv.sh --no-audio-display --pause %f --input-ipc-server=%s --audio-channels=stereo --audio-samplerate=48000 --audio-format=s16 --ao=pcm --ao-pcm-file=/audio/snapcast_fifo"
    ports:
      - 127.0.0.1:4533:4533
    volumes:
      - /srv/snapcast/audio:/audio
      - /srv/navidrome/data:/data
      - /srv/media/audio:/music:ro

Relevant log output

time="2025-01-05T14:32:57Z" level=debug msg="Executing mpv command" cmd="[/bin/sh -c \"/tmp/mpv.sh --no-audio-display --pause '/music/albums/311/1994 Grassroots/02 Lucky.m4a' --input-ipc-server=/tmp/mpv-ctrl-ef53dc91-db05-4d86-9548-1ba6e14f7bf6.socket --audio-channels=stereo --audio-samplerate=48000 --audio-format=s16 --ao=pcm --ao-pcm-file=/audio/snapcast_fifo\"\n]"

Anything else?

No response

Code of Conduct

  • I agree to follow Navidrome's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugtriageNew bug reports that need to be evaluated

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions