Bugzilla – Bug 5823
Basic iTunes support fails -- 'use itunes' setting does not find music
Last modified: 2009-09-08 09:32:19 UTC
Problem: Support gets frequent calls where SlimServer is not seeing the user's iTunes music and/or playlists. This is with the Basic Settings set to: Music Folder is empty, "Use iTunes" is ON. Solution: have them enter the appropriate values in Server Settings > iTunes for: * iTunes Music Library.XML Location * iTunes Music Folder This fixes the problem 99% of the time. However we should not be needing to do this so frequently, according to Engineering. Something is broken. Support will provide more details as we test further. (may also be related to bug 4185?)
From my testing if your iTunes music folder is anywhere but the 'default' location, you must specify the Music Folder location under Server Settings-->iTunes. After speaking with engineering on this issue, they said that we should not have to do this. All we should have to do is under Server Settings put a check in the Use iTunes box and SlimServer should know where to go to find the music.
Sorry this was on 6.5.4 on windows XP machine. How does SlimServer determine where the music library is located? If it is from the .xml file, how does SlimServer know where the .xml file is located?
I think it guesses based on the defaults, but I've cc'ed Steven in case he knows better (likely).
Is this related to this forum thread? http://forums.slimdevices.com/showpost.php?p=233221&postcount=2
Yes, I have heard before that command-line behavior with iTunes scans are different than web-UI scans. I have not tested this myself though.
SC is getting the iTunes path from the registry (Windows) or the PLIST (Mac). From the linked bug 4185 I assume we're seeing the same issue here as with all the other NAS users: mapped drives can't be seen by SC when run as a service. In the other bug the user was referring to a UNC path, but the XML file was using a mapped drive letter. Once pointed out the user disappeared. Nice. (let's close that bug then) Running the scanner interactively from the shell does run it in the user's context, not the service's context. Thus it sees all the mapped drives, has the permissions needed. We'd therefore need some more data points from the users calling us: are they using a NAS or some other form of network share? Is SC run as a service or in the user's context?
--d_itunes or --debug plugin.itunes. collect data on what paths are being tried by the finder code and find out what the user is entering for the actual values. There is another bug report, that mentioned itunes now uses both 'iTunes Music Library.xml' and 'iTunes Library.xml' for the data file name. Apparently, the choice is rathe artibtrary. I can't be bother to go searching yet again (bugs is really slow these days) but there is a patch there to look for both filenames in all searches. It is awaiting feedback from anyone who actually uses iTunes and has the two different filenames. I do not have iTunes and will not use iTunes as it gets in the way of the stuff I would normally use so I cannot really test it.
Did a fresh install of SLimServer 6.5.4 and a fresh install of iTunes. Within iTunes I added multiple folders from different location on my hard drive. Opened up SlimServer, checked Use iTunes. Then ran a Clear and Rescan Everything. My music library shows 0 albums with 0 songs by 0 artists. I then specified where my .xml file was and did another clear and rescan library and now my music is showing up.
What you say about the command-line operating in userland makes sense, KDF. As does your comment, Michael, about bug 4185 being a mismatch between UNC and SMB paths. I probably should not have referenced bug 4185 cuz it looks unrelated in hindsight. What we're seeing, as I understand it, is the basic 'Use iTunes' plugin failing to find the user's music under certain circumstances. I'm not sure if it's failing to find the XML file, or there's a mismatch between what the XML reports and the actual music files. We're trying to isolate what the circumstances are more closely.
KDF- so I'm testing on 7.0 and Anoop is testing 6.5.4 and we're seeing the same behavior: just setting 'Use iTunes' does NOT allow SlimServer to gather the music data from iTunes. You result in 0 albums, etc. Can you elaborate on the command-line command to gather more information on how or why SlimServer is failing to find what it needs?
Okay, I've tried a series of tests with SqueezeCenter 7.0a on Windows XP: 1) * Installed SqueezeCenter with iTunes plugin OFF and pointed to empty music folder (\Music\Test) * Scanned music and got 0 albums. Correct. 2) * Turned iTunes plugin ON and blanked out the music folder * Did a clear and rescan and got 0 albums. Wrong, there are 3 albums in my iTunes library. 3) * Shut down SqueezeCenter and ran from command-line with -d_itunes * Scanned music and got 3 albums! Correct. 4) * Shut down SqueezeCenter and reran from Slimtray (as service) * Deleted Cache folder and server.prefs files. * Ran SqueezeCenter as a service from Slimtray * Went thru setup wizard and set it to NO iTunes and defined but empty music folder (\Music\Test) * Startup scan shows 0 albums, but also 0 playlists. Wrong, there are 0 albums and 10 playlists. * Did a clear and rescan and got 3 albums and 10 playlists?? Wrong, there are 0 albums and 10 playlists. It's reading the music from iTunes now but I do NOT have the plugin enabled!! That's a weird one! Went digging through the server.pref file and found no mention of iTunes, so looked in the /Prefs/Plugins folder and found an itunes.prefs that had been updated during this process. That's new! 5) * Shut down SqueezeCenter deleted Cache and Prefs folders * Ran SqueezeCenter as service from Slimtray * Went thru setup wizard and set SS to NO iTunes and empty music folder (\Music\Test) * Startup scan shows 0 albums and 0 playlists again. Wrong, there are 10 playlists. * Did a clear and rescan and got 0 albums and 10 playlists. Correct. 6) * Turned iTunes plugin ON and blanked out the music folder * Did a clear and rescan and got 0 albums. Wrong, there are 3 albums in my iTunes library. * Checked the itunes.prefs files and it does not contain the XML path now 7) * Shut down SqueezeCenter and reran it as an application (auto run at login setting) * Opened SqueezeCenter and it was already doing a scan and found 3 albums and 10 playlists. Correct. ..... From all of this I'm led to think our problem lies in running SqueezeCenter as a service vs. an application after all. Thoughts?
Changing the version to reflect Dan's more recent testing. Dean could you share some details on exactly how the iTunes plugin is supposed to work? Chris your thoughts on the severity of this bug?
It's supposed to find your current XML file and import your music using data therein. It finds the XML file on Windows via the registry on windows and via the ~/Library/Preferences/com.apple.iApps.plist on the mac. Is this problem happening on both platforms? Can we get some logs attached to this bug with itunes logging turned on?
I have not personally seen this problem on Mac OS X.
Created attachment 2278 [details] scanner log sc 7 itunes plugin failure
(In reply to comment #11) > 2) > * Turned iTunes plugin ON and blanked out the music folder > * Did a clear and rescan and got 0 albums. Wrong, there are 3 albums in my > iTunes library. The log I just attached reproduces scenario #2 from comment #11, note error: Slim::Plugin::iTunes::Common::findMusicLibraryFile (167) Attempting to locate iTunes Music Library.xml automatically Slim::Plugin::iTunes::Common::findLibraryFromRegistry (134) Found 'My Music' here: for \iTunes\iTunes Music Library.xml Slim::Plugin::iTunes::Common::findLibraryFromRegistry (143) Found 'Personal' here: for \My Music\iTunes\iTunes Music Library.xml Slim::Plugin::iTunes::Common::findMusicLibraryFile (222) Unable to find iTunes Music Library.xml
Were is the file actually stored? These values lack the drive letter.
Per Steven's request via employee intercom system, Itunes xml file location: C:\Documents and Settings\Slim\My Documents\My Music\iTunes\iTunes Music Library.xml
C:\Documents and Settings\Slim looks like a user folder. Is this the same user running slimserver? it could be a mismatch between a userland install of iTunes and a service install of slimserver?? What about trying a global search for 'iTunes Music Library.xml' and 'iTunes Library.xml', make a list of where they are and what users are involved. make a note of whether SC is installed under a given user or runs at login. does it make any difference running the service manually? Look in the registry and see what is there related to itunes and the xml file (maybe there is a new key we're not looking for) Bug 5505 was the one I mentioned previously. The patch doesn't look like it will help what we're seeing here, but I can add a LOT more debug in there for investigation. I'm currently swamped at work, and also having to sort out a wrecked car and getting a replacement, so I can't promise exactly when, but the basic idea is to give output at each stage of the "find" routines. You've only got a few devs who deal with this part of the code and michael is already swamped with web ui stuff, and I have a full time day job (Andy on Radio/SN, you get the idea). The bug report still says "all" for OS. Are you really getting reports involving OSX and Linux? if it's XP only, then we can focus what time there is on the registry entries and code to search the registry. Ross' log is the kind of thing we need, and if it's XP only, those log entries can be made a lot more detailed if that's needed.
User Slim is not running SlimServer in this case, I am logged in as Slim but SqueezeCenter is running as a service (by default). This is the only user on the system. Searching for iTunes Music Library.xml returned: C:\Documents and Settings\Slim\My Documents\My Music\iTunes\iTunes Music Library.xml Searching for iTunes Library.xml returns the same file. Searching the registry for itunes music library.xml only shows the entry HKEY_USERS -> S-1-5-21-515967899-776561741-83952215-1004 -> Software -> Microsoft -> Search Assistant -> ACMru -> 5603 Does this help?
How about the info from the registry at the following keys: HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders specifically, I believe the Shell Folder for "My Music" and "Personal" It also appears that the module we're using to deal with teh registry (Win32::Registry) is obsolete. We should be using Win32::TieRegistry)
Created attachment 2281 [details] use Win32::TieRegistry Win32::Registry is obsolete, use Win32::TieRegistry instead. This finds the xml just fine for me, but then iTunes is user install with manually run slimserver.pl
SqueezeCenter Version: 7.0 - 13848 - Mac OS X 10.4.10 Mac: 10.4 OSX iTunes : 7.2.4(4) I have done a few tests with iTunes and SqueezeCenter on a Mac OS 10.4. Without any changes to the default settings of iTunes and configuring the SqueezeCenter not to point to any folder, the squeezeCenter was able to read the XML file of iTunes and showed the correct entries. We even instructed iTunes not to copy the added files to its local folder and we kept the music files on an external drive, with only “Use iTunes” option being checked, the SqueezeCenter was able to read the XML file and get the correct data. iTunes and SqueezeCenter on Mac Operating System seem to work as anticipated so far.
Kevin - I'm sure our problem clearly is the fact that SC is run as a service (Dan's conclusion in comment #11, too). We'll have to find a solution for this. Your idea about scanning the registry is interesting. Would probably need to be able to only search the user's branch to speed up things a bit. Searching a big registry can be a bit time consuming. Another idea I had was using SqueezeTry, which is run in user space, to help setting the path: when started it could verify the iTunes settings. If enabled, but the path is not set, it could read the _users_'s iTunes path and set it through the CLI or JSON/RPC. Third idea: add a service configuration page to the setup wizard which is asking the user to enter his credentials. This would not only fix this iTunes issue, but the NAS case as well: if we let the service interface with the user's desktop, it can see mapped drives etc. Problem here: users tend to be confused by such setup options (I remember having been myself a few years back :-)). Let's reach a consensus on what version should be chosen, and I'll attack it. Support and Dean want something for 7.0... I'll try to find some information about #1 and #3.
the registry find is already looking in HKEY_CURRENT_USER. I have assumed that should mean the currently logged in user, regardless of the fact that SC is running in service-land. One thing I was thinking is that given Win32::Registry's obsolete status, it may not be properly reading HKCU for all cases.
(In reply to comment #25) > the registry find is already looking in HKEY_CURRENT_USER. I have assumed that > should mean the currently logged in user, regardless of the fact that SC is > running in service-land. Unfortunately that's not the case (I've learned that fact the hard way many years ago, when I failed to access my data from a service). From a service's point of view the current user is "SERVICE" (or similar). > One thing I was thinking is that given > Win32::Registry's obsolete status, it may not be properly reading HKCU for all > cases. I'm pretty much convinced the issue is userland vs. service.
ok. In that case, even if it does nothing to help, we should be moving to use TieRegistry as it is the currently active module for ActivePerl support.
Maybe this is a silly question but why don't we just have SqueezeCenter always run as an application in userland?
> Maybe this is a silly question but why don't we just have SqueezeCenter always > run as an application in userland? The question imho isn't silly at all. There is one major advantage of having it run as a service: it's available without the need for to log in to the machine. But then I have no idea at all whether this is important for the majority, for a few, them all. The downside OTOH is important: services can't see the users settings (iTunes), don't have access to mapped network shares (NAS), can't be started/stopped by non-privileged users etc. These generate a lot of requests to both support and the forums. So the question probably is one for the marketing guys and support and Dean: would it be preferable to run SC as an application by default, and have good documentation for those users who want to have it run as a service? We could even create a simple application which would ask for username/password and would do the registration (imho the code for registering the service with a user account is alredy there!).
From a Support perspective, I think changing the default to "Automatically run at login" would be good thing. I'll wager that the majority of our users login to their account by default when they turn Windows on, and when done they just turn their computer off.
I've mergeed TieRegistry support in at change 14048. It doesn't solve the problem here, but does deal with avoiding future breaking due to the use of an obsolete module.
Ok... what if the Windows setup program was asking for the user's credentials and install the service to be run in the user's context? I'll do some tests tomorrow, but I assume this would enable the service to access the user's branch of the Registry, as well as UNC paths to which the user has access permissions (no mapped drives, though). I've added some code to configure the server earlier today, but it's command line only: squeezecenter.exe --install --username=.\michael --password=guesswhat I could come up with the GUI part for the installer by the thursday's nightly build. Dan - does this make sense? My main concern is marketing not liking one more page in the wizard...
I'd probably agree with Marketing-- running the average user through a username/password wizard may be a mistake. Running as an application has the advantage of fixing our woes, and the disadvantage of excluding those that wish to run Slimserver without logging in. But that caliber of user is likely comfortable changing the startup setting to accomodate their needs. My only concern is if those same users switch to "Automatically run at system start" they will be right back here with this bug. Maybe at that point we need to direct them to a Server setting page with login fields? I guess I'm saying... the situation where someone wants SlimServer running as a service and needs access to userland resources may be the minority. Direct that subset to a page or wizard that will bridge serviceland with userland. But for the majority of users, they are running as an application without a need to set up login parameters. Does that make sense?
(In reply to comment #11) > Okay, I've tried a series of tests with SqueezeCenter 7.0a on Windows XP: > ..... > > From all of this I'm led to think our problem lies in running SqueezeCenter as > a service vs. an application after all. > > Thoughts? Could you please make one more test? Go to (Windows) Settings/Control Panel/Administrative Tools/Services. Open the SqueezeCenter service, stop it, go to the Log On tab. Change "Local System account" to "This Account" and enter your credentials. Restart the server. Does it find iTunes now? What does the log say if you enable plugin.itunes?
Did some more tests per Michael's request. Details: --> SqueezeCenter Version: 7.0 - 14031 - Windows XP - EN - cp1252 1) * Set SqueezeCenter with iTunes plugin OFF and pointed to empty music folder (\Music\Test) * Scanned music and got 0 albums. Correct. 2) * Turned iTunes plugin ON and blanked out the music folder * Did a clear and rescan and got 0 albums. Wrong, there is 1 album in my iTunes library. next, per Michael's request... 3) * Went into Control Panel > Admin Tools > Services * Stopped SqueezeCenter * Went into Log On tab and changed to "This Account" with my username/password * Started SqueezeCenter * SqueezeCenter immediately began a rescan, without me doing anything, and it found my iTunes music. It found 1 album. Correct. 4) * I went into iTunes and added an album * Did a clear and rescan and got 2 albums. Correct. This seems to allow SC access to the XML file successfully, Michael!
I close this bug as it should now be fixed with the new install mode. Please re-open new, platform specific bug if needed.
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.