Quick Tip: load an M3U playlist

Tonight on #banshee, a user asked how to load an M3U playlist into the local queue feature of Banshee. This is an automatic source that is created when you start Banshee with files passed on the command line. Files can also be loaded into this source by passing –enqueue to an already running instance. This allows users to open multiple files in Banshee from Nautilus, for instance. We do not import the files into the library since often when a user plays files from their file manager, they just want to preview them or listen to them one time only. (It is easily possible however to import files from the local queue source if it is so desired).

Unfortunately, one thing that is not currently supported is loading static playlists into the local queue. There’s really no excuse for not supporting this — it could be implemented in maybe 20 lines of code (hint, hint) as all the underlying playlist parsing infrastructure is already in place for many formats.

However, as a quick hack for our guest in the channel, I came up with this, but sadly he departed in haste before I had time to share it with him:

grep -Ev ^# album.m3u | sed 's,",\\",g;s,.*,"&",g' | xargs banshee --play --enqueue

It’s not a perfect solution, but it certainly works. Now if only we had a patch…

Update: To clarify, Banshee does support parsing playlists served up by Internet radio stations, and can parse and play a playlist from the open location dialog as well. Banshee can also import and export a source from/to a static playlist file. The only thing that is not supported is loading playlists on the command line (e.g. through your file manager) into the local queue.

2 Replies to “Quick Tip: load an M3U playlist”

  1. I don’t know banshee well enough to really suggest this, but does it understand file urls such that they can be treated as an absolute path to the m3u file? I.e. pass it ‘file:///home/username/mymusicfolder/myplaylist.m3u’

    Mostly it would be prepending the absolute path for the m3u on the local filesystem with ‘file://’ which you could do as a script along the lines of:

    -rwxr-xr-x PlayInBanshee.sh
    banshee –enqueue file\://`type ${1} | awk ‘{ print $3 }’`

    Now I’m not sure if I have the syntax correct, or what parts of it are even necessary, but it was just a thought.

Comments are closed.