Bugzilla – Bug 18119
iTunes playlist import broken
Last modified: 2014-09-06 06:26:26 UTC
System Info: Using iTunes 11.3.1 (2) 64-bit on Mac OSX 10.8 And Logitech Media Server Version: 7.7.3 - 1375965195 on ReadyNAS Ultra 6 Pro Description: iTunes Library.xml does not import Playlists. Music is imported correctly from iTunes Library.xml Cause: Debugged /Slim/Plugin/Importer.pm perl script. In the method handleEndElement: ---- Code Begin ---- if ($inTracks && $currentKey eq 'Playlists') { Slim::Schema->rs('Playlist')->clearExternalPlaylists('itunesplaylist:'); main::DEBUGLOG && $log->debug("Starting playlist parsing, cleared old playlists"); $inTracks = 0; $inPlaylists = 1; # Set the progress to final when we're done with tracks and have moved on to playlists. $progress->final; $progress = Slim::Utils::Progress->new({ 'type' => 'importer', 'name' => 'itunes_playlists', 'total' => $class->getTotalPlaylistCount, 'bar' => 1 }); } ----- Code end ---- In iTunes 11.x, the element "Playlists" appears ahead of the elements "Tracks". So the variable $inTracks is undefined, and the conditional expression fails. Workaround: If I edit the iTunes Libary.xml, and move the <key>Playlists</key> (and all child elements) to be *after* <key>Tracks</key>, then the import works. Suggested fix: Make the scanner code more robust so it is not order dependent. Since using a DOM object maybe too large for embedded computer devices, maybe run the iTunes scan in two phases... first get the tracks. Then get the Playlists.