Welcome to our forums! Please take a few moments to read through our Community Guidelines (also conveniently linked in the header at the top of each page). There, you'll find guidelines on conduct, tips on getting the help you may be searching for, and more!

[Rel] Import/Export M3U Playlists into/from a Plex Server

hilbertglmhilbertglm Members, Plex Pass Posts: 2 Plex Pass

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:

  1. Download and unzip the attachment into the directory of your choice.
  2. 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.
  3. 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= and --password= options on the 'import' command line.

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.

Sign In or Register to comment.