Bug 5217 - First file in iTunes library is not scanned into SlimServer
: First file in iTunes library is not scanned into SlimServer
Status: CLOSED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: iTunes
: 7.0
: All All
: P2 major (vote)
: ---
Assigned To: Andy Grundman
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-08-04 06:44 UTC by James Craig
Modified: 2008-12-18 11:12 UTC (History)
3 users (show)

See Also:
Category: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description James Craig 2007-08-04 06:44:52 UTC
Wierd bug that the file that is the first in my iTunes library file cannot be found by SlimServer. 

The same file/library works file in 6.5
I do not know if it's because it's the first file but seems possible?

Scanner log:
[13:34:01.8133] Slim::Music::Import::runImporter (443) Starting Slim::Plugin::iTunes::Importer scan
[13:34:01.8147] Slim::Plugin::iTunes::Common::useiTunesLibrary (71) Using iTunes library: 1
[13:34:01.8171] Slim::Plugin::iTunes::Importer::startScan (148) Parsing file: C:\Documents and Settings\James\My Documents\My Music\iTunes\iTunes Music Library.xml
[13:34:03.1501] Slim::Plugin::iTunes::Importer::handleCharElement (497) Found the music folder: file://localhost/E:/iTunes
[13:34:03.1511] Slim::Plugin::iTunes::Importer::handleEndElement (559) Starting track parsing.
[13:34:03.1608] Slim::Plugin::iTunes::Common::normalize_location (312) Normalized file://localhost/E:/The%20All%20Seeing%20I/Walk%20Like%20a%20Panther/01%20Walk%20Like%20a%20Panther%20%5B7%20inch%20Versi.mp3 to file:///E:/The%20All%20Seeing%20I/Walk%20Like%20a%20Panther/01%20Walk%20Like%20a%20Panther%20%5B7%20inch%20Versi.mp3
[13:34:03.3203] Slim::Plugin::iTunes::Importer::handleTrack (314) File not found: E:\The All Seeing I\Walk Like a Panther\01 Walk Like a Panther [7 inch Versi.mp3

That's the correct path, and the file does exist! 
And this is the start of the library XML:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Major Version</key><integer>1</integer>
	<key>Minor Version</key><integer>1</integer>
	<key>Application Version</key><string>7.2</string>
	<key>Features</key><integer>1</integer>
	<key>Show Content Ratings</key><true/>
	<key>Music Folder</key><string>file://localhost/E:/iTunes/</string>
	<key>Library Persistent ID</key><string>45E0F32E977E546B</string>
	<key>Tracks</key>
	<dict>
		<key>2131</key>
		<dict>
			<key>Track ID</key><integer>2131</integer>
			<key>Name</key><string>Walk Like a Panther [7 inch Version]</string>
			<key>Artist</key><string>The All Seeing I</string>
			<key>Album</key><string>Walk Like a Panther</string>
			<key>Genre</key><string>Pop</string>
			<key>Kind</key><string>MPEG audio file</string>
			<key>Size</key><integer>5749908</integer>
			<key>Total Time</key><integer>261485</integer>
			<key>Track Number</key><integer>1</integer>
			<key>Track Count</key><integer>2</integer>
			<key>Year</key><integer>1999</integer>
			<key>Date Modified</key><date>2007-01-07T09:32:52Z</date>
			<key>Date Added</key><date>2003-10-17T19:33:29Z</date>
			<key>Bit Rate</key><integer>175</integer>
			<key>Sample Rate</key><integer>44100</integer>
			<key>Play Count</key><integer>3</integer>
			<key>Play Date</key><integer>3205343872</integer>
			<key>Play Date UTC</key><date>2005-07-27T20:17:52Z</date>
			<key>Rating</key><integer>80</integer>
			<key>Sort Artist</key><string>All Seeing I</string>
			<key>Persistent ID</key><string>60F011B6395ACBBF</string>
			<key>Track Type</key><string>File</string>
			<key>Location</key><string>file://localhost/E:/The%20All%20Seeing%20I/Walk%20Like%20a%20Panther/01%20Walk%20Like%20a%20Panther%20%5B7%20inch%20Versi.mp3</string>
			<key>File Folder Count</key><integer>3</integer>
			<key>Library Folder Count</key><integer>1</integer>
		</dict>
Comment 1 KDF 2007-08-04 16:04:28 UTC
not sure that this is an slimserver parsing issue.  The test is if a file is readable and exists for that error.  check the permissions as well to be sure.  Might also be the [ character?
Comment 2 James Craig 2007-08-06 01:21:31 UTC
The same file scanned from the same library causes no issues in SlimServer 6.5.3, so it seems to me it must be a 7.0 issue? And the file is of course readable.

(I'm going to try changing the first file in the library XML and see what happens)
Comment 3 James Craig 2007-08-06 13:28:33 UTC
I created a test iTunes library file with 4 music files - this gives the same error.
Then I switched the order of the files - and the error still occurs on the 1st file in the library, and the one which had the error before is now fine:

[21:25:14.7310] Slim::Plugin::iTunes::Importer::startScan (148) Parsing file: C:\Documents and Settings\James\My Documents\My Music\iTunes\Test.xml
[21:25:14.7553] Slim::Plugin::iTunes::Importer::handleCharElement (497) Found the music folder: file://localhost/E:/iTunes
[21:25:14.7563] Slim::Plugin::iTunes::Importer::handleEndElement (559) Starting track parsing.
[21:25:14.7645] Slim::Plugin::iTunes::Common::normalize_location (312) Normalized file://localhost/E:/American%20Music%20Club/Keep%20Me%20Around/01%20Keep%20Me%20Around.mp3 to file:///E:/American%20Music%20Club/Keep%20Me%20Around/01%20Keep%20Me%20Around.mp3
[21:25:14.8520] Slim::Plugin::iTunes::Importer::handleTrack (314) File not found: E:\American Music Club\Keep Me Around\01 Keep Me Around.mp3
[21:25:14.8617] Slim::Plugin::iTunes::Common::normalize_location (312) Normalized file://localhost/E:/The%20All%20Seeing%20I/Walk%20Like%20a%20Panther/02%20Snake%20I%20%5BEdit%5D.mp3 to file:///E:/The%20All%20Seeing%20I/Walk%20Like%20a%20Panther/02%20Snake%20I%20%5BEdit%5D.mp3
[21:25:14.8649] Slim::Plugin::iTunes::Importer::handleTrack (331) Got a track named Snake I [Edit] location: file:///E:/The%20All%20Seeing%20I/Walk%20Like%20a%20Panther/02%20Snake%20I%20[Edit].mp3
[21:25:15.6416] Slim::Plugin::iTunes::Common::normalize_location (312) Normalized file://localhost/E:/iTunes/The%20All%20Seeing%20I/Walk%20Like%20a%20Panther/01%20Walk%20Like%20a%20Panther%20%5B7%20inch%20Versi.mp3 to file:///E:/iTunes/The%20All%20Seeing%20I/Walk%20Like%20a%20Panther/01%20Walk%20Like%20a%20Panther%20%5B7%20inch%20Versi.mp3
[21:25:15.6449] Slim::Plugin::iTunes::Importer::handleTrack (331) Got a track named Walk Like a Panther [7 inch Version] location: file:///E:/iTunes/The%20All%20Seeing%20I/Walk%20Like%20a%20Panther/01%20Walk%20Like%20a%20Panther%20[7%20inch%20Versi.mp3
[21:25:15.7848] Slim::Plugin::iTunes::Common::normalize_location (312) Normalized file://localhost/E:/American%20Music%20Club/Keep%20Me%20Around/02%20In%20My%20Role%20As%20The%20Most%20Hated%20Sing.mp3 to file:///E:/American%20Music%20Club/Keep%20Me%20Around/02%20In%20My%20Role%20As%20The%20Most%20Hated%20Sing.mp3
Comment 4 James Craig 2007-08-06 14:34:17 UTC
I found what appears to be the problem. 
At line 290:
	
my $mtime = (stat($file))[9];
my $ctime = str2time($curTrack->{'Date Added'});

On the first iteration of the loop only, the str2time() call in the 2nd line appears to clear the '_' filehandle populated by stat() and used a little further down:

# Reuse the stat from above.
if (!$file || !-r _) { 

That test then fails because -r _ returns undef. Immediately after the stat() call it returns 1.
If you swap the order of the 1st two lines, it works fine! 
(Or replace '!-r _' with '!-r $file')

But I have no idea why str2time() would do this, in particular why is it happening only on the first track!?

James

Comment 5 Chris Owens 2007-08-06 15:55:46 UTC
Thanks for looking in to this, James.
Comment 6 Spies Steven 2007-10-26 09:50:04 UTC
*** Bug 5855 has been marked as a duplicate of this bug. ***
Comment 7 Spies Steven 2007-10-26 09:56:23 UTC
Another log file attached to duplicate Bug 5855.  Increasing severity and changing hardware, os, assignee and target milestone since the behavior happens on both Macs and PCs.
Comment 8 Andy Grundman 2007-11-07 06:38:25 UTC
Fixed in change 14450.
Comment 9 Chris Owens 2008-03-07 09:03:14 UTC
This bug is being closed since it was resolved for a version which is now released!  Please download the new version of SqueezeCenter (formerly SlimServer) at http://www.slimdevices.com/su_downloads.html

If you are still seeing this bug, please re-open it and we will consider it for a future release.