Imported iTunes playlists are not showing in UI

Continuing the discussion from Plex Media Server update 1.18.7.2438 hanging:

iTunes Playlists can be seen in the logs being imported from the iTunes Library.xml file, however these playlists are not showing in the user interface on Plex Web or Plex for Mac. The same is also true when viewing through https://app.plex.tv/desktop#.

Server Version#: 1.18.7.2457-77cb9455c
Player Version#: Plex Web Version 4.22.2 + Plex for Mac Version 1.6.3.1009-57cf57c8
OS Version: macOS 10.14.6
iTunes Version: 12.9.5.5
Server Logs: Plex Media Server Logs_2020-02-28_20-48-34.zip (7.2 MB)

Thanks again @sa2000 for fixing the hang caused by the com.plexapp.plugins.itunes plugin.

I managed to get playlists to appear in the sidebar menu after manually creating one but no iTunes playlists were present. Right clicking the three dots and choosing Import from iTunes... produces the following (non-descriptive) error. New logs attached: Plex Media Server Logs_2020-02-28_21-41-35.zip (7.5 MB)

@ChuckPa were you ever able to get playlists to import on macOS prior to Catalina? I’m still on Mojave (10.14.6) for this reason.

I will make this as clear as I can.

  1. Trumpy81 and I set out to see if we could make iTunes data import on Linux
  2. He had a Windows machine
  3. I have no Windows machines. I am strictly Linux.
  4. In order for the One-Time import of the SIMPLE playlists (Smart Playlists have never been supported)
    a. I created a windows directory map emulation (inclusive of the ‘C:’ device name)
    b. At the bottom of that map tree, the final linkage pointed to where the real media began
    c. There is another element I’m forgetting but, if I did the exercise again, I will probably remember it.

I have never tried Mojave. I only recently was able to setup a Mojave VM after moving to VMware.

Ok @ChuckPa, let me re-phrase my question. I understand this has worked on Windows (and on Linux with some hacks). Have you been able to perform an import where the iTunes XML file was modified for a non-Windows OS filesystem (with no emulation)?

Eg.
macOS iTunes XML Location Key

<key>Location</key><string>file:///Users/username/Music/iTunes/iTunes%20Media/Music/Artist/Album/Filename.m4a</string>

Windows iTunes XML Location Key

<key>Location</key><string>file://localhost/C:/Users/username/Music/iTunes/iTunes%20Media/Music/Artist/Album/Filename.m4a</string>

I’m trying to ascertain why Plex is not finding any files belonging in the playlist whatsoever when the XML was created on the same Mac using iTunes. I just want a onetime import of simple playlists as a migration from iTunes.

Thank you for rephrasing. I understand what you’re trying to solve for better.

The path name PMS has for the file must be the same path name as referenced by the playlist

By this, I mean, you would need (which you can easily construct a sandbox for to work it out),

As example:

  1. /top-level-directory/C:/Users/username/Music/Artist/Album/01 - First Track.flac
  2. The iTunes list must know reference the above path
  3. PMS will need to have this same path already indexed before incorporating the playlist.

Off the top of my head:

  1. Media can be found this way:
/Windows/C:/Users/username/Music/iTunes/iTunes Media/Music/Artist/Album/Filename.m4a
  1. Music library section created referencing: /Windows

They now share the same root directory reference and have identical resolution paths.

As I think back on it, /Windows/C: was the emulation we created. It was kludgy but worked because I had mounted the windows partition as /Windows/C:

The next step included modifying the XML of itunes

  1. Replace all \ with / (blind replace was fine)
  2. Replace all C: with /Windows/C:

If I may augment while you’re still composing,

I took a moment to spin up an example and, hopefully, a foundation for you to use to import your simple playlists.

This does presume the media has already been indexed at the final path names

Two sed command perform the editing required.

[chuck@lizum ~.518]$ cat Sample-Windows-File 
C:\Users\chuck\iTunes\stuff here\soemthing.m4a
C:\Users\chuck\My Media\more stuff here\something else.mp4

[chuck@lizum ~.519]$ sed -e 's;\\;/;g' < Sample-Windows-File | sed -e 's;C:;/Windows/C:;'
/Windows/C:/Users/chuck/iTunes/stuff here/soemthing.m4a
/Windows/C:/Users/chuck/My Media/more stuff here/something else.mp4

[chuck@lizum ~.520]$

That’s my understanding as well which only makes it more unusual this is not the case.

I take it didn’t work without this prefix. Does Plex expect this prefix to find the files correctly? I noticed in an old iTunes Library XML (version 11.0.5) made on Windows there’s no forward slashes.

In your example I can see there’s no URL encoding (%20 for spaces) yet both my Windows and macOS version have this. Should I correct this as well?

Also if the Plex Library were to be re-located (using this guide https://support.plex.tv/articles/201154537-move-media-content-to-a-new-location/), would the playlists break? I could see a scenario where a Plex Library is created on Windows (with iTunes Playlists imported) then migrated to a Synology NAS for example.

Thanks I might give that a go.

  1. Yes, Plex does expect to find the files just as referenced in the XML imported from iTunes. If it can’t find it in an existing media path, it has no means to attach it to an existing “media item” (the ID number)

  2. On Linux, unless a pathname is quoted, % notation will be processed as hex in the shell & file system. PMS itself should expand it out to a space character anyway.
    /a%20b/ == /a b/ (there are exceptions to the Hex vs Octal notation rule)

  3. Since I don’t have Windows now (not even a VM) I won’t be able to examine what Windows iTunes does. If you can help me understand how to setup and then (most importantly) undo any changes to my Mojave VM, I’m willing to look at the resultant names / path names used there to construct better editing.

So I can confirm the files referenced in the iTunes XML are indeed in the same location. They were downloaded in iTunes, can be played in iTunes + Plex and their location can be shown from iTunes + Plex (no error).

Looking at the logs, Plex appears to be doing this.

Feb 28, 2020 21:41:04.691 [0x7000073fb000] WARN - Could not find path: /Users/terfex/Music/iTunes/iTunes Media/Music/Pink Floyd/The Division Bell (Remastered)/1-11 High Hopes.m4a

The file however whilst not claimed to be found by the playlist importer (again already seen by Plex as a valid file when playing) can be found in shell command:

ls -lh '/Users/terfex/Music/iTunes/iTunes Media/Music/Pink Floyd/The Division Bell (Remastered)/1-11 High Hopes.m4a'
-rw-r--r--@ 1 terfex    16M  8 Feb 02:33 /Users/terfex/Music/iTunes/iTunes Media/Music/Pink Floyd/The Division Bell (Remastered)/1-11 High Hopes.m4a

in Plex



and iTunes

image

Certainly. It would be probably best we either take a VM snapshot or a Time Machine backup first. Are you using VMware Workstation Pro 12? Player does not have a snapshot feature so you’d need to make a copy of the VM files to restore or duplicate.

To recreate the issue should be as simple as the following:

  1. Open iTunes (to ensure a library is created
  2. Ensure an XML file is created
  3. Add some songs to the library and to a simple playlist.
  4. Close iTunes
  5. Start Plex Media Server and ensure iTunes plugin is enabled. I also specifed the file path for the XML file. If not already enabled, restart Plex Media Server.
  6. Wait about a minute and download logs from Plex Media Server. You’ll note Plex is already trying to import the playlists but none appear in the UI.
  7. Create a playlist manually.
  8. Use the three dot just below search to Import from iTunes.
  9. After the import runs, likely with an error. Download logs again from Plex Media Server.

I’m running VMware Workstation Pro 15.

I did start to create a library. I can’t find where the XML creation is enabled. (I am NOT a MacOS guy – don’t know how I got pulled here)

Assistance?

Sure

  1. First go to iTunes>Preferences
    image
  2. Go Advanced
  3. Select Share iTunes Library XML with other applications then press OK
    image

Thanks for looking into this.

Thanks. I keep forgetting everything is the meatball-centric.

I need to talk to Engineering and understand how this works on MacOS (a lot of them develop on MacOS plus PMS was first written on MacOS)

In existing XML format on Linux.

Track ratingKey="124426" key="/library/metadata/124426" parentRatingKey="124419" grandparentRatingKey="124384" guid="plex://track/5d07ce0e403c640290fd666e" parentGuid="plex://album/5d07c1fe403c6402908943a5" grandparentGuid="plex://artist/5d07bbfc403c6402904a5da0" type="track" title="Two Hot Girls (On a Hot Summer Night)" grandparentKey="/library/metadata/124384" parentKey="/library/metadata/124419" librarySectionTitle="Music" librarySectionID="8" librarySectionKey="/library/sections/8" grandparentTitle="Carly Simon" parentTitle="Coming Around Again" summary="" index="7" parentIndex="1" thumb="/library/metadata/124419/thumb/1578340485" art="/library/metadata/124384/art/1583314235" parentThumb="/library/metadata/124419/thumb/1578340485" grandparentThumb="/library/metadata/124384/thumb/1583314235" grandparentArt="/library/metadata/124384/art/1583314235" duration="299546" addedAt="1571083575" updatedAt="1578340485">
<Media id="129991" duration="299546" bitrate="275" audioChannels="2" audioCodec="mp3" container="mp3">
<Part accessible="1" exists="1" id="130006" key="/library/parts/130006/1571083575/file.mp3" duration="299546" file="/share/music/Carly Simon/Carly Simon - Coming Around Again/07 - Two Hot Girls (On a Hot Summer Night).mp3" size="10295248" container="mp3" hasThumbnail="1">
<Stream id="64020" streamType="2" selected="1" codec="mp3" index="0" channels="2" bitrate="145" audioChannelLayout="stereo" samplingRate="44100" displayTitle="Unknown (MP3 Stereo)"/>
<Stream id="66349" key="/library/streams/66349" streamType="4" codec="txt" format="txt" provider="com.plexapp.agents.lyricfind" displayTitle="Unknown (TXT External)"/>
</Part>
</Media>

versus iTunes

file:///Volumes/music/Carly%20Simon/Carly%20Simon%20-%20Coming%20Around%20Again/07%20-%20Two%20Hot%20Girls%20(On%20a%20Hot%20Summer%20Night).mp

Outstanding questions are:

  1. Does MacOS know what to do with the pathname prefixes when remote mounted or doesn’t it matter?
  2. Does it auto convert %20 to space ?
  3. Does it auto convert URL to pathname?

Sorry
 took a bit to find the album / get the exact song

sed is not available out of the box but can be install via Homebrew:

brew install gnu-sed

Probably doesn’t matter in this case.

Appears to get converted with the same behaviour as Linux.

Yes it get’s converted from what I can see in the logs and UI.

Interesting, I plan to migrate Plex to FreeBSD or FreeNAS at a later stage anyway.

Try here: ‎High Hopes - Song by Pink Floyd - Apple Music