MPD icon indicating copy to clipboard operation
MPD copied to clipboard

Add support for playing archives outside music database using local socket

Open naglis opened this issue 5 years ago • 0 comments

From MPD forum thread.

I am trying to play local zip archives that are outside the music directory when connecting to MPD using local socket. If the archive is inside the music directory there is no problem, I can add the full archive, e.g.:

$ mpc add '/tmp/mpd_zip_test/library/a.zip'

or single file from the archive:

$ mpc add '/tmp/mpd_zip_test/library/a.zip/a.mp3'

However, if the archive is outside the music directory, adding the full archive results in error:

$ mpc add 'file:///tmp/mpd_zip_test/a.zip'
error adding file:///tmp/mpd_zip_test/a.zip: No such song

and trying to add a file from the archive:

$ mpc add 'file:///tmp/mpd_zip_test/a.zip/a.mp3'
error adding file:///tmp/mpd_zip_test/a.zip/a.mp3: Failed to access /tmp/mpd_zip_test/a.zip/a.mp3: Not a directory

Same when not using the file:// scheme.

Thanks!

Config
database {
    plugin "simple"
    path "/tmp/mpd_zip_test/database"
}
bind_to_address "/tmp/mpd_zip_test/socket"
state_file "/tmp/mpd_zip_test/state"
log_file "/tmp/mpd_zip_test/log"
log_level "verbose"
music_directory  "/tmp/mpd_zip_test/library"
metadata_to_use ""
Logs
Feb 16 20:10 : avahi: Initializing interface
Feb 16 20:10 : exception: RTIOThread could not get realtime scheduling, continuing anyway: sched_setscheduler failed: Operation not permitted
Feb 16 20:10 : avahi: Client changed to state 101
Feb 16 20:10 : avahi: Client is CONNECTING
Feb 16 20:10 : update: spawned thread for update job id 1
Feb 16 20:10 : update: starting
Feb 16 20:10 : state_file: Loading state file /tmp/mpd_zip_test/state
Feb 16 20:10 : exception: Failed to open '/tmp/mpd_zip_test/state': No such file or directory
Feb 16 20:10 : update: archive /tmp/mpd_zip_test/library/a.zip opened
Feb 16 20:10 : update: adding archive file: a.mp3
Feb 16 20:10 : mad: detected LAME version 3.99 ("LAME3.99r")
Feb 16 20:10 : mad: LAME peak found: 0.000000
Feb 16 20:10 : mad: LAME track gain found: -6.800000
Feb 16 20:10 : mad: encoder delay is 576, encoder padding is 641
Feb 16 20:10 : update: added a.zip/a.mp3
Feb 16 20:10 : simple_db: removing empty directories from DB
Feb 16 20:10 : simple_db: sorting DB
Feb 16 20:10 : simple_db: writing DB
Feb 16 20:10 : update: finished
Feb 16 20:11 : client: [0] opened from local
Feb 16 20:11 : client: [0] process command list
Feb 16 20:11 : client: process command "update """
Feb 16 20:11 : update: spawned thread for update job id 2
Feb 16 20:11 : client: command returned 0
Feb 16 20:11 : client: [0] process command list returned 0
Feb 16 20:11 : update: starting
Feb 16 20:11 : client: [0] process command list
Feb 16 20:11 : client: process command "status"
Feb 16 20:11 : update: finished
Feb 16 20:11 : exception: Failed to read mixer for 'default detected output': no such mixer control: PCM
Feb 16 20:11 : client: command returned 0
Feb 16 20:11 : client: process command "currentsong"
Feb 16 20:11 : client: command returned 0
Feb 16 20:11 : client: [0] process command list returned 0
Feb 16 20:11 : client: [0] closed
Feb 16 20:11 : client: [1] opened from local
Feb 16 20:11 : client: [1] process command "listall """
Feb 16 20:11 : client: [1] command returned 0
Feb 16 20:11 : client: [1] closed
Feb 16 20:11 : client: [2] opened from local
Feb 16 20:11 : client: [2] process command "config"
Feb 16 20:11 : client: [2] command returned 0
Feb 16 20:11 : client: [2] process command list
Feb 16 20:11 : client: process command "add "a.zip""
Feb 16 20:11 : client: command returned 0
Feb 16 20:11 : client: [2] process command list returned 0
Feb 16 20:11 : client: [2] closed
Feb 16 20:11 : client: [3] opened from local
Feb 16 20:11 : client: [3] process command "config"
Feb 16 20:11 : client: [3] command returned 0
Feb 16 20:11 : client: [3] process command list
Feb 16 20:11 : client: process command "add "a.zip/a.mp3""
Feb 16 20:11 : client: command returned 0
Feb 16 20:11 : client: [3] process command list returned 0
Feb 16 20:11 : client: [3] closed
Feb 16 20:11 : client: [4] opened from local
Feb 16 20:11 : client: [4] process command list
Feb 16 20:11 : client: process command "tagtypes "clear""
Feb 16 20:11 : client: command returned 0
Feb 16 20:11 : client: process command "tagtypes enable Artist AlbumArtist Title Name Composer Performer"
Feb 16 20:11 : client: command returned 0
Feb 16 20:11 : client: process command "playlistinfo"
Feb 16 20:11 : client: command returned 0
Feb 16 20:11 : client: [4] process command list returned 0
Feb 16 20:11 : client: [4] closed
Feb 16 20:11 : client: [5] opened from local
Feb 16 20:11 : client: [5] process command "clear"
Feb 16 20:11 : client: [5] command returned 0
Feb 16 20:11 : client: [5] process command list
Feb 16 20:11 : client: process command "status"
Feb 16 20:11 : client: command returned 0
Feb 16 20:11 : client: process command "currentsong"
Feb 16 20:11 : client: command returned 0
Feb 16 20:11 : client: [5] process command list returned 0
Feb 16 20:11 : client: [5] closed
Feb 16 20:12 : client: [6] opened from local
Feb 16 20:12 : client: [6] process command "config"
Feb 16 20:12 : client: [6] command returned 0
Feb 16 20:12 : client: [6] process command list
Feb 16 20:12 : client: process command "add "/tmp/mpd_zip_test/a.zip""
Feb 16 20:12 : exception: No such song
Feb 16 20:12 : client: command returned 3
Feb 16 20:12 : client: [6] process command list returned 3
Feb 16 20:12 : client: [6] closed
Feb 16 20:12 : client: [7] opened from local
Feb 16 20:12 : client: [7] process command "config"
Feb 16 20:12 : client: [7] command returned 0
Feb 16 20:12 : client: [7] process command list
Feb 16 20:12 : client: process command "add "/tmp/mpd_zip_test/a.zip/a.mp3""
Feb 16 20:12 : exception: Failed to access /tmp/mpd_zip_test/a.zip/a.mp3: Not a directory
Feb 16 20:12 : client: command returned 3
Feb 16 20:12 : client: [7] process command list returned 3
Feb 16 20:12 : client: [7] closed
Feb 16 20:12 : client: [8] opened from local
Feb 16 20:12 : client: [8] process command list
Feb 16 20:12 : client: process command "add "file:///tmp/mpd_zip_test/a.zip""
Feb 16 20:12 : exception: No such song
Feb 16 20:12 : client: command returned 3
Feb 16 20:12 : client: [8] process command list returned 3
Feb 16 20:12 : client: [8] closed
Feb 16 20:12 : client: [9] opened from local
Feb 16 20:12 : client: [9] process command list
Feb 16 20:12 : client: process command "add "file:///tmp/mpd_zip_test/a.zip/a.mp3""
Feb 16 20:12 : exception: Failed to access /tmp/mpd_zip_test/a.zip/a.mp3: Not a directory
Feb 16 20:12 : client: command returned 3
Feb 16 20:12 : client: [9] process command list returned 3
Feb 16 20:12 : client: [9] closed
MPC commands
$ ls /tmp/mpd_zip_test/
a.zip  database  library  log  mpd.conf  socket
$ ls /tmp/mpd_zip_test/library/
a.zip
$ unzip -l /tmp/mpd_zip_test/a.zip
Archive:  /tmp/mpd_zip_test/a.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
  2101931  2018-12-07 00:47   a.mp3
---------                     -------
  2101931                     1 file
$ unzip -l /tmp/mpd_zip_test/library/a.zip
Archive:  /tmp/mpd_zip_test/library/a.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
  2101931  2018-12-07 00:47   a.mp3
---------                     -------
  2101931                     1 file
$ mpc update
Updating DB (#2) ...
volume: n/a   repeat: off   random: off   single: off   consume: off
$ mpc listall
a.zip/a.mp3
$ mpc add '/tmp/mpd_zip_test/library/a.zip'
$ mpc add '/tmp/mpd_zip_test/library/a.zip/a.mp3'
$ mpc playlist
a.zip/a.mp3
a.zip/a.mp3
$ mpc clear
volume: n/a   repeat: off   random: off   single: off   consume: off
$ mpc add '/tmp/mpd_zip_test/a.zip'
error adding /tmp/mpd_zip_test/a.zip: No such song
$ mpc add '/tmp/mpd_zip_test/a.zip/a.mp3'
error adding /tmp/mpd_zip_test/a.zip/a.mp3: Failed to access /tmp/mpd_zip_test/a.zip/a.mp3: Not a directory
$ mpc add 'file:///tmp/mpd_zip_test/a.zip'
error adding file:///tmp/mpd_zip_test/a.zip: No such song
$ mpc add 'file:///tmp/mpd_zip_test/a.zip/a.mp3'
error adding file:///tmp/mpd_zip_test/a.zip/a.mp3: Failed to access /tmp/mpd_zip_test/a.zip/a.mp3: Not a directory

naglis avatar Feb 17 '21 17:02 naglis