How do you import an iTunes Playlist?

It’s almost 3 years! No solution yet? By the way, the new Music app that replaces iTunes in Catalina doesn’t have the automatically generated xml file anymore. You have to export it manually every time you change something. It would be great if Plex just could read the Music library.

At some point in time somebody from Plex is going to have to address this issue. What will it take to get somebodies attention???

It’s almost unbelievable this has been not working for so long time without manual text editing. Only PMS on a PC or a MAC with iTunes installed on the same machine works for now. Really rare case I think.

PMS needs a setting option to enter the actual location of the music files to
remap file path of iTunes xml to PMS’s taste. url be a SMB or just plain local file system. People who puts music files on a NAS and connects iTunes through SMB needs this. (and PMS on the same NAS)

Internally PMS should remap the files, replace spaces with %20 while importing the playlist. Doesn’t seems very complicated, better than abandoning iTunes plugin feature for years as now.

So I’ve recently moved my entire music collection from an external hard drive to my NAS so that I can use Plex as an intermediary for my Sonos environment. What I’ve discovered in the process is that the manner in which Apple Music / iTunes manages the entire library (music, playlists, and metadata) is rather proprietary. With that change, all access to any playlists or metadata is damn near inaccessible without some manual jiggering. I would actually put some blame on Apple for locking things down in that particular manner.

iTunes provides a complete playlist and metadata in XML format, if you manually turn on the option. XML is as far open as you can get from any data source format. You probably are misplacing the blame on Apple about the ‘proprietary’ part. Most of times you would be right, though.

Plex-NAS file path mapping conversion is nicely done with KODI addon plexconnector. Similar thing is needed for iTunes playlist-Plex, but PMS is not doing it for some reason over a very long time.

Came here to say thanks this seems to be working on a Synology NAS Docker.

File path (file://localhost/data/music/iTunes/iTunes Media) etc seems to be working without any errors.

Crazy that such a simple procedure as parsing an xml isn’t supported by Plex as folks have been saying. Either remove the feature or fix it. I’m permanently shutting down iTunes anyhow, so this is a one time procedure.

I’m ready to cry here folks. It all started because i read that I could use PLEX to enable Alexa to play my iTunes playlist. So far, over the last couple of months (I have a job, you see), I’ve:

  • purchased an NAS (TerraMaster) with 2x4 TB drives in a RAID setup, installed the drives, configured the server
  • moved my media (photos, videos, music) to the NAS
  • added the NAS to my online backup solution
  • moved iTunes from my desktop machine to the NAS (>that< was fun)
  • installed Plex
  • enabled the Plex skill on Alexa
  • over the course of a couple of weeks, finally figured out how to get my libraries to find the media on the server
  • added the iTunes folder to my music library
  • over the course of several days, found out how to stop and restart the Plex server on the NAS

The excitement was building; I was nearly at the end of my quest!

Except, no playlists. I can’t even see, neither on the web app nor on my iPad, where to find my playlists (assuming I have any), or even how to create one.

And now I’m finding that this has been a problem for over three >years<? I have dozens of playlists, some with hundreds of songs, I have no desire, nor the time to recreate them on the Plex (assuming I ever find where/how to do this).

Let the tears commence. Help?

Came back here to say, I feel your pain. There’s some steps above - where you have to go through editing the iTunes library xml file - doing a search and replace. They may work for you, they didn’t in the end for me, but I’ve got HUGE playlists with 70,000 or so songs on them and the system just hung. I could play the playlists, but they weren’t showing any songs on them weirdly.

My rough procedure was:

  1. In Plex go to settings, plugins - turn iTunes on
  2. Add the full path (including the filename) of the iTunes library.xml file. In my case (in the Docker) it was: /data/music/iTunes/iTunes Library.xml. Yours might be different if it’s hosted directly on your NAS rather than in Docker. You will need the FULL path - e.g. volume1/music/itunes etc
  3. Go to Manage, Libraries - Add library - music.
    1. Add folder
    2. Go to advanced and switch on the iTunes import setting.
    3. Prefer local metadata
    4. Genre = Embedded Tags (not Plex Music)
  4. Open iTunes xml file in a text editor (make a backup first)
  5. Remove all "%20” instances and replace with a space. (This is the Mac version of the space, but Linux doesn’t play well with it
  6. Change the file path base to "file://localhost/data/music/iTunes/iTunes Media”… (or your file path to the iTunes xml file).
  7. Save the file in the NAS drive
  8. Restart the image.
  9. Go to Playlists (if you can’t see it, create a playlist and refresh).
  10. Click the … icon and select import from iTunes,
  11. Choose library and check “overwrite existing playlists” if necessary.
  12. Import
  13. You can check progress in settings, manage, console. If you see a bunch of red error messages there, then you may have one of the file path settings wrong, you should be able to tell from the messages.
2 Likes

thanx for the information i was searching for this and get this which helped me

Still not working. Tried editing the xml file multiple times. Itunes folder is on synology nas. Music is imported well, playlists… forget about it. I am frustrated because i am not that knowledgable. Please Plex Team. Get it done.

2 Likes

I thought I’d have it easy, because I’m using a mac and my server is a mac mini, so no file name changes, but it still doesn’t work for me. I get the add playlist option (after some fiddling around), but when I try to actually add the iTunes library file it hangs. I have a large library, but it’s been 6 hours now and no dice. I can see in my activity monitor that Plex is doing -something-, but no playlists yet. I’ll let it run overnight and see. It only took 2 or 3 hours to scan my whole library, so I can’t imagine that this will work. Fingers crossed.

I’ve sadly given up on this ever working. I have hundreds of smart playlists and hand crafted playlists in Apple Music and can’t get any of them into Plex.

The idea of rebuilding all my playlists is so overwhelming I don’t really use Plex any more for music on my Sonos system.

Like others I have a Mac mini running Apple Music and OS X Catalina, and my music files on a nas.

It would be bliss to see an import playlists option.

It’s not even just smart playlists that don’t work, it’s everything else as well. I tried deleting all of my playlists and importing that library, just to see if it would at least import my ratings. It still hung, and I quit after two days. I would definitely buy a Plex Pass if Plex had this functionality (which it claims it has), but no luck. I have a huge library and not being able to sort by ratings or by some of the other tags that Plex doesn’t use (Grouping, for instance) makes Plex practically unusable for me.

OK, tired of no solutions I just went ahead and coded one on top of the Python plex API. It isn’t perfect, but it works well enough: I can import my playlists from Apple and play them in various Plex clients including on Alexa using the Plex skill.

https://github.com/jasmith79/apple_playlist_plex_importer

Most of the following is in the README, so if you are technically inclined just read that. I would really appreciate someone from the Plex team looking at this to help diagnose the few remaining annoyances detailed at the bottom.

It should work on older iTunes XML files, but I haven’t tested it (only on Catalina). It should work on XML files created by the Windows version of iTunes, but again, haven’t tested it. It should work on just about any host OS for PMS, but I’ve only tested on a Synology NAS (i.e. Linux).

To work at all a few things are required:

  1. An Apple music library XML file (File -> Library -> Export library in the Music app or iTunes).
  2. Credentials for your Plex Account (your plex.tv account, NOT your account on the server).
  3. The name of your Plex Server.

Additionally, some steps while not strictly required will make it work much more reliably:

  1. In your Plex Server settings under Agents move “Local Media Assets” to the top of the list for both Artists and Albums. This will reduce the amount of renaming of your media files that Plex does, making it easier to match to the Apple playlist tracks. Be sure to refresh the metadata after doing this.
  2. Double-check the output in the terminal when running the importer. If it can’t match a track, then the problem is almost certainly that the plex name is different than the Apple name, and you should rename the track(s)/album(s)/artist(s). This is more true the more non-English non-ASCII your collection is. I have a lot of Japanese, Scandanavian, and Latin character-having artists/tracks in my collection but ended up only having to manually rename one artist after doing step 1.

You can clone this repository, install the plexapi package dependency, and run app.py in the importer package but I recommend installing through pip:

python3 -m pip install --user git+https://github.com/jasmith79/apple_playlist_plex_importer.git

Open up a terminal and (assuming you installed via pip) run the command:

pleximport path/to/library.xml --user myplexuser --password myplexpassword --server myplexserver

For those of you worried about having passwords in your shell history, you can omit anything except the file path and it will interactively prompt you for them. See --help as well.

Some known issues:

  1. It can take a significant amount of time for PMS to optimize all of those playlists. Don’t be too concerned if you try to access them right away and get some sort of “failed to load” error message.
  2. If you don’t have any existing music playlists you will have to reload the page/restart the client app to get the playlists menu option to show in the Plex client.
  3. As I said the name matching is not perfect and was shockingly difficult to implement with even decent reliability. Probably the reason the Plex team didn’t do it.
  4. Playlist items will always fail to load if you try to view the playlist in either the web or desktop clients (although they play just fine). I would really love some help fixing this.
  5. It doesn’t delete or update existing playlists in PMS, if you run it more than once you will get multiple copies of playlists. If you need to update a list from your Apple data then you’ll need to delete them and re-run it.

Can anyone from the Plex team take a look at this and help iron out the remaining annoyances?

3 Likes

Ugh. Glad I found this. I’ve been fighting with importing Itunes playlists, and got no response to my post (Itunes Playlist Import Revisited) I guess most folks just gave up. I’m on Windows and my files are all on the same computer, but it still doesn’t work. The really weird thing is that it will sometimes work, but then not. Makes no sense. I guess I’ll give up on this.

On windows you may have better luck with the official plugin method, I was able to use that successfully on windows for a couple of years before I moved PMS on to a NAS. Part of the issue is that Plex will rename artists, albums, and tracks. I’ve got a bit of a thing for Japanese pianists and have a lot of imported stuff. I generally rename everything to the English transliteration but if I let plex grab metadata from online it changes them back to kanji. If you’re using my importer (and maybe even if you aren’t) make sure that you go into the agents setting on your server and move “Local Media Assets” to the top of the list to minimize the amount of renaming plex does. In any case, good luck and feel free to leave me a message here or on github with any usage questions.

Thanks, jasmith79. I already have it set that way. If you take a quick look at my post, you will see a Server log snippet that shows the issue. No matter what I do (tried editing Itunes Music Library.xml), this is basically what happens. Strange thing is the files it says have an illegal path look fine to me. I think it parses OK, but then falls down trying to process the tracks. Don’t know what I can do about that.

Unfortunately I don’t know enough about Windows to help much. One thing that does look odd to me is that I’m used to seeing paths in the XML with the URL prefix file://

Plex parses that out OK. Here’s a strange one. I recently updated Plex Media Server to 1.20.2.3343, one of their endless updates, and retried the import. No go. I was doing something else on my computer that caused me to restart. So, I thought “What the Hell”, and I tried the import again. This time, it imported everyone of the Itunes playlists! It made one minor error that I fixed, but they are all there. I don’t get it. Like some others have reported, I DID have verbose debugging turned on. This seems kind of hit or miss. I’m afraid to retry anything. You can TRY getting to this version (if you can), turning on verbose logging, restart and then try the import again; no guarantees.

same here, i tried all the sugestions in this post and nothing yet

1 Like