I have developed some Java code that will allow for the export of playlists in a Plex database to M3U files in a directory. The utility code will also import M3U files to a local or remote server without requiring direct access to the database file. Thus, it should work for importing to Synology or embedded systems, but I don't have such as system for me to test that.
There is no warranty or guarantee, so please backup your system appropriately before running any of this code.
To install and configure:
- Download and unzip the attachment into the directory of your choice.
- Create a file called credentials.properties and place this in the directory ".hilbert/plex-utilities" under your home directory. The contents should contain your Plex userid and password in the format described later in the post. For Linux users the full file name would be '~/.hilbert/plex-utilities/credentials.properties'. For Windows users the home directory is %HOMEDRIVE%%HOMEPATH%, so the full file name might look something like "C:\Users\glm\.hilbert\plex-utilities\credentials.properties" where glm is my Windows login name.
- In the directory into which you unzipped the attachment, there will be a file "resources/META-INF/solutions.abelian.core.jdbc.ConnectionConfiguration.properties". That file needs to be edited to reference the SQLite database for the Plex database.
The credentials.properties file should contain two lines of the form:
To run the code, change directory into the directory into which you unzipped the downloaded code and run the 'cli' script for the command-line interface. There is a 'help' command. The 'import' and 'export' commands will be the ones of interest, so 'help import' and 'help export' will give more explanation. I have not created a Windows shell or PowerShell script, so someone will have to convert the bash script into equivalent for Windows.
If you don't want to set up the credentials.properties file, you can specify the credentials with the --user=
Typically the code can figure out the section where the playlists belong, but if you set up libraries with non-standard names, you may need to set the 'section' environment variable. The sections can be listed with the 'sections' command and the environment variable is set as in the following example:
set section Music
Note the lack of an '=' sign in the command. Substitute 'Music' for the section containing your music files as indicated in by the output of the 'sections' command.
Let me know if there are any issues with the code, and let me know if it was useful for you.