Load playlists from music directory?

Hi,
the “Playlists” node in the MusicBox web interface remains empty for me even though I’ve created some m3u playlists in the music folders.

In the mopidy log I saw

Loaded 0 local playlists from /var/lib/mopidy/playlists

Is that a configuration issue?
From my understanding the playlists found in music directories should be indexed just like the music files and possibly stored in the sqlite as well. Having the playlists in the default directory makes them rather painful to create and maintain.

Thanks
jochen

Do you have some documentation that says they can go in the music folder?
I’ve never seen or tried that. Could you just point your playlist folder to
the same directory as your music folder in the config?

https://github.com/mopidy/mopidy/issues/582 is the only reference I’m aware of, and that is just the bug for the idea of adding this support.

No, I did not find anything about playlists in the musicbox config. Just the config of mopidy. That’s why I asked. I would definitely +1 the feature request of loading those playlists in the folders that are scanned anyway.

Nevertheless, I’ve been trying to get m3u playlists to work, but so far without success.

So far,

  • I’ve pointed the mopidy config to the MusicBox directory where the local files reside in:

    [local]
    enabled = true
    media_dir = /music
    playlists_dir = /music/MusicBox

  • created playlist with relative path names with AIMP (Windows).
    One point here is that the backslashes have to be converted to forward slashes. Is it possible to have this ironed out during runtime?

  • after manual correction of the backslashes the m3u playlists now contain entries like this

    EXTINF:174,some title
    some folder name/(102) some title.mp3

  • when trying to play a song from the playlist it does not work. mopidy.log says:

    No such file "/music/some folder name/(102) some title.mp3"
    2015-01-22 10:05:46,152 - WARNING Track is not playable: file:///music/some%20folder%20name/%28102%29%20some%20title.mp3
    2015-01-22 10:05:46,255 - WARNING Setting GStreamer state to GST_STATE_PLAYING failed
    2015-01-22 10:05:46,272 - ERROR Resource not found. Debug message: gstfilesrc.c(1042): gst_file_src_start ():

    • Notice the wrong folder name where it looks. It should be prefixed /music/MusicBox just like the playlist directory, right?
  • apart from that also exceptions appear in the log, but the could be just follow-up errors:

    2015-01-22 10:05:27,339 - ERROR Unhandled exception in MpdSession (urn:uuid:f78d75be-2451-4507-b3db-4c34708c03cc):
    Traceback (most recent call last):
    File “/usr/lib/python2.7/dist-packages/pykka/actor.py”, line 200, in _actor_loop
    response = self._handle_receive(message)
    File “/usr/lib/python2.7/dist-packages/pykka/actor.py”, line 303, in _handle_receive
    return self.on_receive(message)
    File “/usr/local/lib/python2.7/dist-packages/mopidy/utils/network.py”, line 366, in on_receive
    self.on_line_received(line)
    File “/usr/local/lib/python2.7/dist-packages/mopidy/mpd/session.py”, line 33, in on_line_received
    response = self.dispatcher.handle_request(line)
    File “/usr/local/lib/python2.7/dist-packages/mopidy/mpd/dispatcher.py”, line 46, in handle_request
    return self._call_next_filter(request, response, filter_chain)
    File “/usr/local/lib/python2.7/dist-packages/mopidy/mpd/dispatcher.py”, line 67, in _call_next_filter
    return next_filter(request, response, filter_chain)
    File “/usr/local/lib/python2.7/dist-packages/mopidy/mpd/dispatcher.py”, line 75, in _catch_mpd_ack_errors_filter
    return self._call_next_filter(request, response, filter_chain)
    File “/usr/local/lib/python2.7/dist-packages/mopidy/mpd/dispatcher.py”, line 67, in _call_next_filter
    return next_filter(request, response, filter_chain)
    File “/usr/local/lib/python2.7/dist-packages/mopidy/mpd/dispatcher.py”, line 85, in _authenticate_filter
    return self._call_next_filter(request, response, filter_chain)
    File “/usr/local/lib/python2.7/dist-packages/mopidy/mpd/dispatcher.py”, line 67, in _call_next_filter
    return next_filter(request, response, filter_chain)
    File “/usr/local/lib/python2.7/dist-packages/mopidy/mpd/dispatcher.py”, line 104, in _command_list_filter
    response = self._call_next_filter(request, response, filter_chain)
    File “/usr/local/lib/python2.7/dist-packages/mopidy/mpd/dispatcher.py”, line 67, in _call_next_filter
    return next_filter(request, response, filter_chain)
    File “/usr/local/lib/python2.7/dist-packages/mopidy/mpd/dispatcher.py”, line 133, in _idle_filter
    response = self._call_next_filter(request, response, filter_chain)
    File “/usr/local/lib/python2.7/dist-packages/mopidy/mpd/dispatcher.py”, line 67, in _call_next_filter
    return next_filter(request, response, filter_chain)
    File “/usr/local/lib/python2.7/dist-packages/mopidy/mpd/dispatcher.py”, line 146, in _add_ok_filter
    response = self._call_next_filter(request, response, filter_chain)
    File “/usr/local/lib/python2.7/dist-packages/mopidy/mpd/dispatcher.py”, line 67, in _call_next_filter
    return next_filter(request, response, filter_chain)
    File “/usr/local/lib/python2.7/dist-packages/mopidy/mpd/dispatcher.py”, line 158, in _call_handler_filter
    response = self._format_response(self._call_handler(request))
    File “/usr/local/lib/python2.7/dist-packages/mopidy/mpd/dispatcher.py”, line 167, in _call_handler
    return protocol.commands.call(tokens, context=self.context)
    File “/usr/local/lib/python2.7/dist-packages/mopidy/mpd/protocol/init.py”, line 178, in call
    return self.handlers[tokens[0]](context, *tokens[1:])
    File “/usr/local/lib/python2.7/dist-packages/mopidy/mpd/protocol/init.py”, line 156, in validate
    return func(**callargs)
    File “/usr/local/lib/python2.7/dist-packages/mopidy/mpd/protocol/current_playlist.py”, line 240, in playlistinfo
    return translator.tracks_to_mpd_format(tl_tracks, start, end)
    File “/usr/local/lib/python2.7/dist-packages/mopidy/mpd/translator.py”, line 124, in tracks_to_mpd_format
    result.append(track_to_mpd_format(track, position))
    File “/usr/local/lib/python2.7/dist-packages/mopidy/mpd/translator.py”, line 41, in track_to_mpd_format
    (‘Album’, track.album and track.album.name or ‘’),

A relative path to a music file will be relative in respect to your configured music_dir. You need to either change the media_dir setting to ‘/music/Musicbox’ or somehow prefix all the relative paths in your playlists with ‘MusicBox’.

EDIT: I’m assuming your file is at ‘/music/Musicbox/some folder name/(102) some title.mp3’

Thanks for your feedback, guys.

Ok, I set the playlists_dir to the same as media_dir now. If those are not the same using relative paths is quite confusing, especially if also USB drives come into play. Then you’d have to think about where you want to store it on the musicbox prior to creating the playlist.

So, I Changed smb.config so that the /music folder is exposed as opposed to /music/MusicBox so that I can see them via network share. If i now save the playlist with relative path names and replace the backslashes with slashes, the playlists indeed work.

Creating playlists with absolute path names did not work for me.
When creating playlists with AIMP and saving them directly on the network share, the playlists have entries like

\\MUSICBOX.LOCAL\Music\MusicBox\something.mp3

Even with converted slashes it did not work for me.

I’ve now experimented with a bash script to create playlists automatically from here:
https://takla.wordpress.com/2012/05/22/automatically-create-extm3u-extended-m3u-playlist-in-gnulinux/

This worked quite nicely. I think this might be another useful option as long as playlists cannot be maintained in the musicbox web ui.

Question at the bottom!

But first, my answer:

I’m creating my playlists at the root of my music folder. Thus with
mount_address = //192.168.1.22/ActiveMusic
I can then set
playlists_dir = /music/Network
and whatever playlists are in ActiveMusic are displayed under Playlists.

Now, the relative path within the playlist becomes /music/Network/album folder/track name.mp3

To simplify creation of playlists I’ve created a windows powershell script that randomly selects 150 tracks:

get-childitem -Path ‘\\readyshare\ActiveMusic’ -Filter *.mp3 -Recurse |
Get-Random -Count 150 |
Foreach-Object {$_.FullName -replace ‘\\\\readyshare\ActiveMusic’,’/music/Network’ -replace ‘\\’, ‘/’ } |
Out-File -Encoding UTF8 ‘\\readyshare\ActiveMusic\RandomList.m3u’

(I had to do a lot of extra escaping to get that to display correctly; oh, and readyshare is 192.168.1.22 on my windows network)

This playlist then becomes available the next time I reboot PMB.

So, now my Question: is there a way to point to a playlist in my autoplay? I’ve tried several variations including:
autoplay = local:track:MusicBox/music/Network/RandomList.m3u
autoplay = local:track:/music/Network/RandomList.m3u
autoplay = local:playlist:RandomList
and all points in between. Is there a facility for doing this, and what’s the correct format?

Cheers!