Use folders as playlists in Navidrome

I recently started using Navidrome, a self-hosted, open source music server and streamer.
It works well, but it is 100% metadata-oriented, good for albums and “releases”, but not that good for single tracks organized in folders.

I found a solution to that, making playlists of folders. And I found a way to create or update these playlist in one click using batch files.

Folder structure

This is my folder structure, and I am using this method to make playlists of the folders below “individual_tracks”

music
├───releases_ripped
│   ├───*arist folders*
├───individual_tracks
│   ├───hardstyle
│   ├───hardcore_edm
│   ├───rap
│   ├───rap_scandinavian
│   ├───miscellaneous
│   ├───rock

Script

Inside each of these “genre” folders I have created a batch file called _refresh_playlist.bat, and inside each of this files I have this code:

pushd "%~dp0"
chcp 65001
set playlist=dnb_dubstep.m3u
DIR /B /ON *.mp3 > %playlist%
DIR /B /ON *.flac >> %playlist%
DIR /B /ON *.wav >> %playlist%
  • pushd "%~dp0" is setting the current directory as working directory, this even works for network paths.
  • chcp 65001 is setting UTF-8 character encoding.
    Whiteout this special characters in filenames like Æ, Ø, Å and others will not print correctly and the playlist will not match the filename.
  • set playlist=dnb_dubstep.m3u sets the playlist name, changes this for each playlist.
  • DIR /B /ON *.mp3 > %playlist% output all MP3-files filenames in the same directory to the M3U playlist. One > overwrites all content in a existing file, or creating a new file if it is not existing.
  • DIR /B /ON *.flac >> %playlist% and DIR /B /ON *.wav >> %playlist% output all .FLAC and .WAV files to the playlist, two >> means it is adding lines to the file instead of overwriting content.

This will create a .m3u playlist with all the music-files listed, this is all Navidrome needs to understand the file’s content

Inside the root folder “music” I have a batch file called refress_all_playlists.bat that is calling all of the playlist generating scripts in one run.


pushd "%~dp0"
call Individual_tracks\dnb_dubstep\_refresh_playlist.bat
cd ../..
call Individual_tracks\hardcore_edm\_refresh_playlist.bat
cd ../..
call Individual_tracks\hardstyle\_refresh_playlist.bat
cd ../..
call Individual_tracks\miscellaneous\_refresh_playlist.bat
cd ../..
call Individual_tracks\rap\_refresh_playlist.bat
cd ../..
call Individual_tracks\rap_scandinavian\_refresh_playlist.bat
cd ../..
call Individual_tracks\rock\_refresh_playlist.bat
cd ../..
  • pushd "%~dp0" is setting the current directory as working directory, this even works for network paths.
  • call Individual_tracks\dnb_dubstep\_refresh_playlist.bat is running the code in the file referred to
  • cd ../.. is changing directory two steps up.

Navidrome

In Navidrome all he the playlists will be imported automatically, but hey will by default just be visible for administrators, to make them available for everyone check “Public” in the Playlist settings.

In EDIT for a playlist you can change name or comment if desired, Auto-Import is checked by default, this should not be changed. When the M3U is changed updates will be imported automatically.

This is how a playlist appear

End Word

This is a working and a good enough solution for me, all it needs is running the batch file when I have updated something or added/removed/renamed tracks.
Of course these scripts just work if you manage the files trough Windows.

Sources

Share