In the following post I would like to describe a way to import music playlists to Jellyfin media server, for example in case you want to migrate them from a former Plex or Emby installation.

Usually, Jellyfin is already able to detect playlist files within the media library. Unfortunately my old m3u8 playlist files from a previous Plex installation got detected in the music directory but in Jellyfin they were empty. Further I wanted to disable playlist detection in library scans completely because my music collection contains various playlist files which belong to the album releases but I don’t want to them to be indexed in Jellyfin.

To disable playlist file detection in library scans completley, you can patch following Jellyfin source file and remove all known extensions from the “SupportedExtensions” array:

        public static string[] SupportedExtensions =
            {
                ".blank"
            };

After changing the source file you’ll have to recompile and reinstall Jellyfin on your media server.

Regarding the exporting of playlist files from Plex, I recommend using the Webtools plugin.

Using the playlist import script

In order to use the playlist import script, following requirements must be met:

  • The playlist file should be in m3u8 format which is effectively a list of full file paths to the audio files on the server side
  • Remove the previous library and recreate it. Disable real time monitoring and metadata fetching. This is in so far important, because the script uses the api to find the correct tracks by using the filename. This won’t work anymore when metadata (like album image, artist and song name) for the track is aggregated, since the api doesn’t yet support searching by file path. After successfull import, you can enable real time monitoring and metadata downloaders.

The script requires an api key which has to be created in Jellyfin and further you’ll need the user id which will then own the imported playlist.

  • Creating API key
    • Go to server settings (icon upper right corner)
    • Navigate to: Expert → Advanced (left menu)
    • Navigate to: Security (menu upper middle part)
    • Beside title “api keys”, click on the plus symbol
    • App name: playlist importer
    • Copy/write down api key hash, something like a5dc4ea2f58d490db39c9e0ad204aa83
  • Get userid hash
    • Click on the profile icon, upper right corner
    • Click on profile
    • Copy/write down userid hash from the url which looks like: myserver.com/web/index.html#!/myprofile.html?userId=eb8c2ec5352843d3a16ca11c26d3551c

Now it’s time to clone the script via git and start the import process. Parameters for the Python 3 script are the hostname or the ip address of the Jellyfin server, the userid and apikey from above and at least the m3u8-playlist file and the name of the playlist to create on Jellyfin:

git clone https://git.project-insanity.org/onny/py-jellyfin-playlist-import.git
cd py-jellyfin-playlist-import
python main.py --host "example.com" --userid "eb8c2ec5352843d3a16ca11c26d3551c" --apikey "a5dc4ea2f58d490db39c9e0ad204aa83" /tmp/rock.m3u8 rock

The script might lack some error and exception handling but I hope in most cases it should work quite fine :)

💬 Are you interested in our work or have some questions? Join us in our public Signal chat pi crew 👋
🪙 If you like our work or want to supprot us, you can donate MobileCoins to our address.