Itunes Import + Errors?

I believe I’ve found what’s broken: my skill to be patient, persist and combine all the facts and results I’ve found the past few days. Apparently it’s not a “set here and be done with it” configuration. There are a lot of steps involved to get things right.

  1. get your music on the right location on your NAS, verify the path from the view of the docker container. (/opt in my case)
  2. enable the iTunes Plugin in Settings → Settings → Plugins
  3. enter the correct path of the iTunes library.xml you exported from Catalina’s Music app. Remember that this path must be correct from the view of the docker container. (/opt/library.xml in my case)
  4. restart PMS (the docker container in this case).
  5. create a new library in PMS of the type “Music” and name it as you like, select the folder in which it is stored and tick the check box “Import from iTunes”. Let PMS do the import, might take a while.
  6. While PMS is importing your music, you need to “search and replace” a path in the library.xml file, so that from the point of view of the docker container, the full path to the tracks are correct. Take your favorite editor to do that. It depends on what your full path currently is from the point of view of iTunes or Catalina’s Music app. When you’re already using your iTunes library on the NAS, than you probably have something like this: file:///Volumes/iTunes/iTunes%20Music/. This Music Folder is in the top of the library.xml file:
<key>Music Folder</key><string>file:///Volumes/iTunes/iTunes%20Music/</string>

An example of a fresh export of iTunes/Catalina’s Music app:

<key>Location</key><string>file:///Volumes/iTunes/iTunes%20Music/Music/Dj%20Sputnik/Club%20Play%20Dance%2003/1-11%20Africa.mp3</string>

As in my “/opt” example: what you need to do, is search and replace ALL occurrences of

Volumes/iTunes/iTunes%20Music/Music

with

opt

So in my case the example from my library.xml will look like this:

<key>Location</key><string>file:///opt/Dj%20Sputnik/Club%20Play%20Dance%2003/1-11%20Africa.mp3</string>

Now I’ve seen people using a Synology or QNAP NAS that had to use localhost as a prefix, like so

file://localhost/opt

That didn’t work in my case, I got messages of saying tracks couldn’t be found, wrong path. I guess that could be related to how Synology or QNAP run their PMS or dockerized version of PMS.

  1. Once you’ve replaced all occurrences of the file path from the iTunes-point-of-view, to the docker-point-of-view in the library.xml file, save it, or transfer it the location you specified in step 3. PMS should pick that change up automatically. You might see error messages about this new version of com.plexapp.plugins.itunes-new.db-shm that couldn’t be found, but apparently that’s not a showstopper after all :grin:
  2. Now comes a part that’s hard to describe exactly. The ONLY way to make this iTunes import actually work seems to be from the Playlist “menu” under the Home screen of Plex. Now if you don’t see that Playlist menu pinned to the sidebar, you probably don’t have any playlist at all. You need to create a music playlist first. It doesn’t matter what’s in it, as long as you have at least one playlist with one track in it, only then this Playlist menu will appear on the side bar. And it might not appear instantly, It can take a few minutes to show up. And it might only show up, when you click on the “More” section on the side bar. When the Playlist menu option shows up, pin it to the side bar (and rearrange it if you like). When it’s visible, you can select “Import from iTunes” when you click on the three dots (Actions). A dialog box pops up and you can select your options. If you’ve set your paths correctly, PMS will first import all your playlists and then it will update metadata on your tracks.
  3. In my case I got an error after a while on that dialog box saying: “Something went wrong. Make sure the server is available and try again”. But in the PMS log I could see it was still updating metadata and after a few minutes:
Jan 31, 2021 22:54:36.328 [0x7f786d7fa700] DEBUG - Updating metadata item (save) (2 Brothers on the 4th Floor) with ID 36271
Jan 31, 2021 22:54:36.331 [0x7f786d7fa700] DEBUG - Updating metadata item (save) (W&W) with ID 36281
Jan 31, 2021 22:54:36.335 [0x7f786d7fa700] DEBUG - Updating metadata item (save) (Thirty Seconds to Mars) with ID 36284
Jan 31, 2021 22:54:36.339 [0x7f786d7fa700] DEBUG - Updating metadata item (save) (The 1975) with ID 36292
Jan 31, 2021 22:54:36.344 [0x7f786d7fa700] DEBUG - iTunes importer imported data for 2269 of 2339 tracks.
Jan 31, 2021 22:54:36.351 [0x7f78ebfff700] DEBUG - Completed: [192.168.1.11:53846] 200 PUT /playlists/import/itunes?sectionID=14&force=1 (8 live) TLS GZIP 153810ms 274 bytes (pipelined: 2)

Presto! :star_struck: All my playlists are created and my ratings are imported too! :partying_face: