Any way to import playlists?

Add me to the list of users that would like playlist import.

6 Likes

All of these issues and many more would be fixed by updating to the latest version of exoplayer or better yet switching it to something even better.

Please vote here so they finally update their antiquated exoplayer in their plex app from several years ago to the latest version or better yet switch to something better eg VLC, MXplayer, nPlayer, BSPlayer, MPV.

Guess what? If they updated their built in exoplayer or better yet switched to something better, you’d get all these functionalities and more!

Please vote here!

1 Like

While it would be great to have this functionality as part of Plex, there is a simple work-around. I’ve created playlists for videos/music using m3u as the playlist file extension. It’s just a plain text file containing the full path of the file.

Using Postman (postman.com) you should be able to leverage the API to import your playlist. Of course, the files in the playlist should already have been scanned and made available to Plex (ie: stored in the database)

The POST command will use the “upload” directive. You will be passing it:

  • sectionID
  • path
  • X-Plex-Token

For example:
http://127.0.0.1:32400/playlists/upload?sectionID=4&path=/media/folder1/folderwhatever/Mozart.m3u&X-Plex-Token=xxxxxx

To get sectionID and X-Plex-Token, go to one of the files on your server using the browser and click on the far right where you see the three dots. Pick “Get Info”, then in the pop-up screen that appears, click on “View XML”. A new browser window will appear and you’ll see “librarySectionID” which is the value for “sectionID” in the URL above. Within that same browser window, go to the address and scroll to the right (the end). The value for X-Plex-Token will appear there.

The flipside to this is getting the playlist content from Plex. Plex stores this natively in sqlite3.

If you are running in Linux you can get the names of the playlists you have like this:

sqlite3
/var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Plug-in\ Support/Databases/com.plexapp.plugins.library.db
“select title from metadata_items where metadata_type = 15”

From there, to get playlist content you can do this:

sqlite3
/var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Plug-in\ Support/Databases/com.plexapp.plugins.library.db
“select file
from media_parts
left outer join media_items on media_items.id = media_parts.media_item_id
left outer join play_queue_generators on play_queue_generators.metadata_item_id = media_items.metadata_item_id
left outer join metadata_items on metadata_items.id = play_queue_generators.playlist_id
where metadata_items.title = ‘[playlist name]’
order by play_queue_generators.id”

Where [playlist name] is the name of your playlist.

Hope this helps!

5 Likes

Thanks - this really solved my problem! And the best part is that having tested it with the Postman API per your excellent instructions I clicked “Code” (under Save) to export the upload command as curl. Now I can script the whole process of uploading my daily autogenerated playlists and never have to do anything manually again.

1 Like

In settings>server>channels there is a box for your itunes XML path. Insert the path location including the .XML. From there, head to the playlists tab, select it. On the right side of the screen you should see a gear icon. Press it and it should say “Import From iTunes”. Depending on the size of you playlists library and if the music/videos/files are in the exact location as your plex library items, it should sync up.

Nice! I’ll give this a shot. Thanks for sharing!

1 Like

Thanks FiveString! Also I didn’t know about saving the code as a curl command! So I guess we’ve learned from each other. Cheers!

Right on. Now all I need is for them to enable playlist access
via DLNA and I’ll be all set :unamused:

1 Like

Here’s another thing to consider (especially if you’re moving from Windows to Linux). Most of my playlists were created in Windows which created a funny problem.

I created the playlists with this DOS command

dir /on /b /s *.mp3 > playlist_name.m3u

This worked fine on Windows but something about that dir command was screwy with case sensitivity and spaces, etc…

This jumped up and bit me when I was trying to import the playlist in an Ubuntu environment as I described above. I couldn’t figure out why, with all the media readily available on Plex, the playlist created in Plex seemed to miss THOUSANDS of entries.

Part of the issue was spaces. Some entries had the file name + one space. Took me FOREVER to discover this (actually not forever… One look with Notepad++ and making it display special characters revealed this right away.)

"/path/to/file/filename.mp3 "

As opposed to

"/path/to/file/filename.mp3"

(illustrating where the space was with quotes - I didn’t really have quotes in my playlist file)

Case sensitivity was another one. For example Paul McCartney’s Pipes Of Peace album was showing up as “Pipes of Peace” instead (lower case ‘o’). That took a while to find and correct. But, once that was corrected it worked like a charm.

Thought I’d add that - though I’m sure many of you are much cleverer than I with this.

Postman did the trick :v:

Great! Glad to hear it.

I’m trying to get this to work. I’m familiar with Postman, but I can’t seem to get things to work correctly. I’ve followed the instructions but keep getting a 500 response. Is there a specific way I need to format the path? I’m using something like this c:\music\_playlists\playlist.m3u. I was able to get the SectionID and token from the view as XML URL as noted. I’ve also tried to wrap the path in quotes, and while that gives me a 200 response, it unfortunately doesn’t add the playlist.

Are you saying this doesn’t work?

I’m no Windows expert, but you may have to use double “\\”.

See if that works.

Lastly, you’re looking for a “1” response (at least in Postman).

Good luck!

You “might” have to URL encode your path…

c%3A%5Cmusic%5C_playlists%5Cplaylist.m3u

…again… I’ve never had to do this in Windows so I may be leading you astray here. There may be others who might know better than myself.

I finally got it working. I knew it had to be something with the path, but I was looking at the wrong path. The path I was specifying as the path URL param was correct. No quotes or double \\ required. The path that was incorrect was the path in my .m3u file. The paths were relative and they needed to be absolute. I discovered this by going into Plex -> settings -> Manage -> console. I sent another POST through Postman and voila, there it was. Logs showed it was finding the correct path to the playlist, but it couldn’t find the .mp3 files. It was treating the ..\..\ as part of the filename. I went back through and changed the playlist to use absolute paths and it worked as expected.

Thanks for sharing the knowledge @onemojofilter! Much appreciated. I’ve been using Google Play Music for a long time and don’t really like the move to YouTube Music especially with regards to my own music. Using Plex with Plex Amp on my devices is exactly what I needed. The last step in the move was my playlists. Done!

1 Like

Arggghhh!! I’m telling ya… I’ve been tripped up with the contents of my playlist before (if you scroll up you’ll see what I mean) but yeah, relative vs absolute … I didn’t think to mention that to ya.

Glad you worked it out! Happy Plexing!

Is it possible to do this with a local NAS running Plex or must it be a local Plex Media Server?

I have been trying to send m3u playlists to my Synology drive through Postman for a few days now, but I can’t seem to figure out what’s going wrong in the process. I get STATUS 200 OK, but no playlist ever populates on the server. I get synced m3u files, but that’s it.

Did you try looking at the console during an upload? When mine was failing I too was getting an OK (200) response. My best guess is that the upload is successful so that’s the response. The failure occurs when Plex tries to process it.

The console showed what my error is and it may point you in the right direction if you haven’t tried looking at that yet.

I don’t really know what I’m looking for, but here’s an example of what it looks like after I get a STATUS 200 OKAY message.

Hey there, just a couple of things you might want to double check:

You should check to make sure your m3u playlist does not contain any trailing spaces in any of your entries.

You should use absolute path (as opposed to relative path) for your m3u playlist.

You should also check to make sure the case of the directory path and the file name match exactly.

Any one of these things will cause the server to not find your files successfully.