Tuesday, November 1, 2022

Plex for music workarounds: How to import or export playlists

Plex is a great personal streaming service when you use plexamp. Especially if you are using lossless flacs, it can easily replace spotify. However, you soon realize that plex has been created with movies and not music in the minds. I played around with plex in recent months and like to share my experiences with plex and some third party tools and workarounds which can be a great help to improve listening experience even further. 
 
 A word concerning my setup: I use plex on a Synology Nas with an ARM-Processor, so no Docker Installation, no Supersonic functionality on plexamp. At home, I use a Windows Machine to access the plex installation via web. Same applies when using an ipad, either I listen to music, then I use plexamp or I fiddle around, then I access via web. The Ios app of plex just works fine for playing movies (which I don't use much). 

 Playlists 


 If you are wondering how to create a playlist in plex, don`t go to playlists on the dashboard. You would only find existing playlists there. To create a new playlist, go to the music panel, use the drop-down menu starting with "all", go to the very end and you'll find "Custom Filters". With them, you can create your playlist and don't forget to save the playlist. The whole process is described very well on https://www.ryananddebi.com/2019/08/26/plex-how-to-create-smart-auto-updating-music-playlists/. 

Say you'd like to import an existing playlist on your computer to plex, you can't do that out of the box but have to use a third party tool. Be advised: This is not a simple process but requires some effort and the willingness to use the power shell of windows and get aquainted with software hosted on github. There are several projects around to import playlists. For me, the playlist-importer on https://github.com/gregchak/plex-playlist-import is fine, because, once the setup is done, it has an interface.

The setup can be a bit tricky. Make sure that the paths conform to your setup. For a linux server, the path to the m3u file must use slashes (/). Also make sure that plex can find the file, i.e. it must be in a folder, the plex library path points to. 
What regards the paths to the tracks in the m3u-file: Have a look at the track info within plex to see how the path should be written, for a linux server, the path must have slashes. 
Lastly delete any extra lines in the files like  "#EXTM3U" or "#EXTINF: ..."  which are sometimes written by programs like mp3tag when creating a playlist. 


Exporting plex playlists to your machine should also be possible. One alternative is the semi-official plugin WebTools NG to export lists of your media with all metadata.
Go to https://github.com/WebTools-NG/WebTools-NG/wiki/Export. You'll get a database which shows inter alia the artist name, the track name and the full path seen by plex. Once you have that, you can create a .m3u playlist (be sure to alter the filepaths accordingly!) which can be played by any player software. 

There is an alternative way to export a single playlist by using commands in your webbrowser. You a need to know the ip-adress of your server, its port and your personal plex-token. If you don't know about the latter, go to the official plex support web pages

One more thing is required: the id of the playlist. You can find that out by using the following command structure in your browser: http://(yourserver_ip:port)/playlists?X-Plex-Token=(yourpersonaltoken)
Example: http://123.456.789.99:32400)/playlists?X-Plex-Token=12345abc678de

The result is an xml list containing the information on your playlists. 

If you have the playlist id, use the following command structure:  http://(yourserver_ip:port)/playlists/(playlistid)/items?X-Plex-Token=(yourpersonaltoken)

Save the contents into a newly created .xml file, open it in Excel and search for the path of your library items. Then copy this column into a newly created .m3u file. 

Last step: Change the paths. In my case, the paths in plex do not match with those on my windows pc. You can use an editor to change the paths by using the search and replace commands. As my plex server runs on a NAS, I have to substitute slashes for backslashes and change the folder structure.

Synchronise ratings 

If you use plex to listen to your music but use a software like mediamonkey on your pc, you would probably like to synchronize ratings. You can do that by creating playlists for example with *****-star tracks and exchange the playlists by using the aformentioned process.

Edit: Alternatively, use a python script to export your ratings directly to the files. This can be done even if you have no deep knowledge of python. See my post on that. 


No comments:

Post a Comment