Closed gamescom15 closed 6 years ago
Hmmm:
$ mpc -q clear; mpc load bugs/200/foo.m3u
loading: bugs/200/foo.m3u
$ mpc playlist -f '%file%'
bugs/200/bar.mp3
$ echo listplaylistinfo bugs/200/foo.m3u |nc localhost 6601
OK MPD 0.20.0
file: bugs/200/bar.mp3
Last-Modified: 2018-01-18T20:48:33Z
Artist: Deftones
Title: Feiticeira
Album: White Pony
Track: 1
Time: 190
duration: 189.944
OK
^C
$ cat ~/mpd/music/bugs/200/foo.m3u
bar.mp3
This very much looks like MPD already does what you want it to do, doesn't it?
@MaxKellermann I meant if the file is not in the same folder as the playlist, sorry i wasn't specific enough. Folder structure:
Music
├── playlists
│ ├── to_musicdir.m3u
│ └── to_playlist.m3u
└── songs
└── bar.mp3
sudo egrep '^music_directory|^playlist_directory' /etc/mpd.conf
music_directory "~/Music"
playlist_directory "~/Music/playlists"
$ mpc -q clear; mpc load to_musicdir
loading: to_musicdir
l$ mpc playlist -f '%file%'
songs/bar.mp3
$ mpc -q clear; mpc load to_playlist
loading: to_playlist
$ mpc playlist -f '%file%'
$ tail playlists/*
==> playlists/to_musicdir.m3u <==
songs/bar.mp3
==> playlists/to_playlist.m3u <==
../songs/bar.mp3
The playlist that contains the path relative to the music_directory
loads fine, the one that contains the path relative to the playlist itself does not.
The format of playlist files in the playlist_directory
should be opaque to you. You should not read or write them directly, only through the MPD protocol. So what you want is change MPD internals, but for reasons that violate the design.
You can have playlist files anywhere within the music_directory
and use the load
command to use them. These files have the semantics you requested.
@MaxKellermann After putting the mpd playlist folder back to the default (restarted mpd after, updated the database just in case) and trying to load them from file, neither option worked. Is there a different syntax? man mpc
shows that it should be right, am i missing something?
$ sudo egrep '^music_directory|^playlist_directory' /etc/mpd.conf
music_directory "~/Music"
playlist_directory "~/.mpd/playlists"
~/Music$ mpc -q clear; mpc load playlists/to_playlist.m3u
loading: playlists/to_playlist.m3u
~/Music$ mpc playlist -f '%file%'
~/Music$ mpc -q clear; mpc load playlists/to_musicdir.m3u
loading: playlists/to_musicdir.m3u
~/Music$ mpc playlist -f '%file%'
~/Music$
Read my post again.
@MaxKellermann Edited my post for clarity. The playlists i am trying to load are in the music_directory (/home/username/Music) in the subfolder playlists, not in the playlist_directory (/home/username/.mpd/playlists)
Then check the log.
@MaxKellermann trying to load it with mpc only gave
Jan 19 11:52 : client: process command "load "playlists/to_musicdir.m3u""
Jan 19 11:52 : client: command returned 0
so i tried opening the playlist with ncmpcpp, and there it finally said something useful
Jan 19 12:01 : db: No such song: playlists/../songs/bar.mp3
My guess is that it seems to have a problem converting a relative path to an absulute path, cause
~/Music$ readlink playlists/../songs/bar.mp3 --canonicalize
/home/username/DiffentFolder/Music/songs/bar.mp3
works. /home/username/Music
is a symlink to DifferentFolder/Music
, so it might also be related to that
For posterity. I have been looking for a solution that store actively its playlist files as relative files, so that my whole music library is portable and can be synced via any cloud provider (I use dropbox).
If you want mpd to create valid mp3 files, just configure the library and the playlist folders to be the same ! For example:
music_directory "C:/Users/Marty/Dropbox/Music/"
playlist_directory "C:/Users/Marty/Dropbox/Music/"
Thanks for using a portable format as internal representation, I hope it won't change anytime soon =)
I have a similar issue with similar requirements, with xspf playlists with relative paths in a subfolder in the directory specified as music_directory and music in subfolders at the same level as the playlists folder.
I have a daemon acting as a master for a remote daemon with smb and the proxy db. The error for trying to play back a track from a playlist loaded from a file in M.A.L.P. for both differ. mpc won't load any tracks into the playlist (via mpc load playlists/xxxx.xspf
) on either daemon.
The log for local playback with M.A.L.P.:
xxx xx xx:xx : client: [15] opened from xxxx.xxx.x.xx:xxxxx xxx xx xx:xx : exception: No such directory xxx xx xx:xx : exception: No such directory xxx xx xx:xx : exception: No such directory xxx xx xx:xx : exception: No such directory xxx xx xx:xx : client: [15] closed
The log for remote playback with M.A.L.P.:
xxx xx xx:xx : client: [11] opened from xxxx.xxx.x.xx:xxxxx xxx xx xx:xx : exception: Bad URI xxx xx xx:xx : exception: Bad URI xxx xx xx:xx : exception: Bad URI xxx xx xx:xx : client: [11] closed
The log for both with mpc:
xxx xx xx:xx : client: [63] opened from local xxx xx xx:xx : client: [63] closed
The playlists have been verified to otherwise work.
You can have playlist files anywhere within the music_directory and use the load command to use them. These files have the semantics you requested.
Since this issue (still) applies to xspf as well, it should be retitled and reopened.
Further, I get a "Bad song index" error when trying to play back the entire xspf playlist file from M.A.L.P.. This error occurs on both daemons.
Given that you have a structure like this:
or like this:
with "Music" as the
music_directory
. Even though there is no official standard, most music players, for example VLC, implement it so that the relative filepaths in the m3u-playlist should be relative to the playlist. This is the correct way, according to Wikipedia (source). However, in MPD the filenames have to be relative to themusic_directory
. This means that you can't use a folder structure like this across multiple different music players and operating systems with MPD.