Automatic playlist creation (mopidy extension?)


I’m currently looking into an automated way of creating playlists based on the music folders.
What I want is to have a playlist for every sub folder of the music directories (e.g. /music/MusicBox).

By doing this, I want to make my music more accessible (one click per album to add it to the queue) instead of tediously browsing the local libray’s hierarchy where it currently is not even possible to add a folder/album to the queue (only with a future version of the web interface).

So, having albums here:

/music/MusicBox/Artist 1 - Album 1
/music/MusicBox/Artist 2 - Album 1
/music/USB/Artist 3 - Album 1

would result in playlists:
Artist 1 - Album 1.m3u
Artist 2 - Album 1.m3u
Artist 3 - Album 1.m3u

which show up in the playlists node of the web client.

The underlying problem here is that the there is currently no way of easily creating the playlists on a remote machine and copying them along with the mp3 files. M3u files that may reside in the album folders are currently not scanned by mopidy and are therefore not listed in the playlist node. Also, all playlist files have to reside in the folder specified in the settings.ini which makes relative path names really unusable.

Due to these circumstances, I have not found a way to easily create playlists for the folders I copy to MusicBox, especially not from the PC or in some other automated fashion.

My current way of doing this is by SSHing on the box and executing a custom shell script which runs through the MusicBox folder and parses the subfolders’ files and tags (via ffprobe) to create valid playlists for each folder.

This method works, but there are some things that are bugging me:

  1. ffprobe has to be compiled on the pi which takes long
  2. Creating the playlists also takes long due to the tag extraction of each file (causing even hickups to the mopidy process)

So, I’m building something new now that eliminates both issues:
Since mopidy already scans all the files and their metadata, all the information I need is in the SQLIte database
residing in (/var/lib/mopidy/localdata/sqlite). So, based on the content of the database I can create a playlist for every folder or album.

Doing it by album requires meticulously maintained mp3 tags or it will result in one playlist per spelling. This is also an issue in the library browser (or any other media server) where artists and albums appear several times with different spelling (e.g.“artist” and “artist featuring someone”).

That’s why I want to create playlists for the subfolders and thereby eliminating the need for perfect tags.

Since the new way is closely related to the mopidy-local-sqlite extension, I’m wondering whether it would make sense to build the playlist creation as a mopidy extension. I have no clue what this means in terms of effort and so on, but maybe it would allow automatic updates of the playlists when the local library is updated so that the need to manually execute some script is also eliminated.

What do you think?

Sounds like you are describing something similar to I recently updated this bug with more details to try and provide enough guidance / direction that someone not already involved in the core project should be able to jump in an implement this… :slight_smile: