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 Posts: 2Members, Plex Pass 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:

userid=yourPlexUsername
password=yourPlexPassword

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.

Comments

  • akreaxunakreaxun Posts: 12Members, Plex Pass Plex Pass

    "Download and unzip the attachment into the directory of your choice." --> I guess on the computer on which you are running PLEX.

    Handing out credentials to a program of which I don't exactly know what it is doing - seems a bit risky...

    sorry there's got to be another way.

  • martin@zeichner.usmartin@zeichner.us Posts: 5Members, Plex Pass Plex Pass

    Hi there hilbertglm,

    I came across your post because I am interested in importing and exporting m3u playlists to and from plex.

    I am not a programmer and I only have a very limited understanding of Java so please forgive me for being dense. I am stuck on number 3 of "Install and configure"

    I have the file but I am uncertain about how to edit it as per your statement "That file needs to be edited to reference the SQLite database for the Plex database."

    1. connection.plex.name=plex
    2. connection.plex.url=jdbc:sqlite:/home/glm/develop/java/hilbert/applications/plex-utilities/com.plexapp.plugins.library.db
    3. connection.plex.driver=org.sqlite.JDBC
    4. connection.plex.database=/home/glm/develop/java/hilbert/applications/plex-utilities/com.plexapp.plugins.library.db
    5. connection.plex.host=jobim.hilbertinc.com

      I assume that I must edit lines 2, 4, and 5 but I am uncertain about how to proceed. Any help that you might give would be appreciated. Thanks in advance.

  • dane22dane22 Posts: 10,182Members, Plex Pass, Plex Ninja Plex Ninja

    Next, and not yet released version of WebTools will be able to do this
    Expect a public Beta within the next 3-4 weeks, so stay tuned to the WebTools support thread

    /T

    I hate bugs - Tommy Lee Jones, MIB
    Join me in developing: epg-dk, str2utf-8, remidx, ExportTools, WebTools
    Support the Samsung Client:Donate
    Guides I use: Media Naming Guide, Local subtitles, Log-Files, QNAP FAQ, The Plex Dance

    NO Support via PM, unless called by me

Sign In or Register to comment.