Bug 4971 - Itunes Reload Plugin doesn't work
: Itunes Reload Plugin doesn't work
Status: CLOSED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: iTunes
: 6.5.2
: PC Windows XP
: P2 normal (vote)
: ---
Assigned To: KDF
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-05-07 16:28 UTC by Ross Levine
Modified: 2009-09-08 09:16 UTC (History)
2 users (show)

See Also:
Category: ---


Attachments
d_itunes (18.82 KB, text/plain)
2007-05-08 16:13 UTC, Ross Levine
Details
scan log (2.06 KB, text/plain)
2007-05-10 15:02 UTC, Ross Levine
Details
proposed patch (1.54 KB, patch)
2008-01-02 14:20 UTC, KDF
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ross Levine 2007-05-07 16:28:14 UTC
I've set the iTunes Reload Plugin to 30 seconds and added songs to my iTunes library and after 30 seconds the songs aren't added to the SlimServer library. I also tested with iTunes playlists, they are also not automatically added to the SlimServer library. Rescanning from basic settings works perfectly but shouldn't the iTunes Reload Plugin not require a manual rescan?
Comment 1 KDF 2007-05-07 18:47:03 UTC
--d_itunes, or check itunes in server settings->debugging. logs please.
Comment 2 Ross Levine 2007-05-08 12:36:09 UTC
KDF I enabled d_itunes in server settings -> debugging, and I have the iTunes reload interval set to 30, then I removed almost all the songs from my iTunes library, SlimServer should then remove those tracks right? I waited 10 minutes, theres nothing in the log. Am I doing something wrong?
Comment 3 KDF 2007-05-08 13:06:41 UTC
if the itunes plugin is in operation, you should at least be seeing: 
"iTunes: Setting checker for 30 seconds from now."

roughly every 30 seconds.  the init for iTunes starts that process, and depends on the "use iTunes" preference being checked. Unfortunately I cannot do comparison tests as iTunes totally wrecks my work computer so it's gone for good.

Try the old failthful command prompt version:

c:\program files\slimserver\server\slim.exe --d_itunes and maybe that will show some reason why itunes isn't running right.

Comment 4 Ross Levine 2007-05-08 16:13:42 UTC
Created attachment 1938 [details]
d_itunes
Comment 5 Ross Levine 2007-05-08 16:14:41 UTC
After rebooting the debugging works, and sure enough it's printing exactly what you said, only no helpful error messages. SlimServer is still not reflecting the changes made to the iTunes music library. 
Comment 6 KDF 2007-05-08 16:34:54 UTC
ok, well that's more in the log than before.
Best I can tell from that, is that the server is thinking there are no changes to the itunes file.

what is the current pref for:
'iTunesLastLibraryChange'
'itunes_library_xml_path'

try adding this line at line 227 of Plugins/iTunes/Common.pm:
print Data::Dumper::Dumper(fileMTime,$lastiTunesChange);

you'll need to run slimserver.pl instead of slim.exe (I'm assuming you must have ActivePerl on your test machines in order to do this)

If you can't run slimerver.pl, try doing the command prompt slim.exe again, but erase anything you have for itunes_library_xml_path in the prefs file.  that should at least give more log info.  Check that you don't have stray copies of the xml that the server might be finding instead of the active one.  I also recall something about iTunes delaying writes out to the xml (take a look at the xml and see if the timestamp is changing to confirm that the changes have taken)


Comment 7 Ross Levine 2007-05-08 17:44:34 UTC
itunes_library_xml_path: C:\Documents and Settings\Slim\My Documents\My Music\iTunes\iTunes Music Library.xml

I didn't see any 'iTunesLastLibraryChange'

I cleared the xml path and made the change to Common.pm, but I don't have activestate installed on this image and I'd rather not unless we really need to. After running slim.exe --d_itunes I get this:

2007-05-08 17:41:42.7672 Your data source needs to be configured. Please open your web browser,
2007-05-08 17:41:42.7826 go to the following URL, and click on the "Server Settings" link.

2007-05-08 17:41:42.7851 The URL to access SlimServer is now:

	http://qaxpvm:9000/

There are no stray itunes.xml files on this system. Should I try reproducing this on another image? 

Comment 8 KDF 2007-05-08 18:06:29 UTC
Actually, since it's a plugin you should still be ok with slim.exe and --d_itunes.

On a fresh install, it should find itunes and set that up as enabled, but I think you still get the not-quite-correct 'no data source' message.  Since you already have a db, you'll probably have to trigger a wipe and rescan in order to see the rest in action.  I'm not sure why there aren't any log messages in that first bit that show the itunes init.  Perhaps add --d_plugins to the command line so there is a clearer indication of the plugin init.  Then trigger the rescan (log will get large but that's ok if you attach it).  After the completed scan, it should set the iTunesLastLibraryChange, after the log message:
iTunes: scan completed in %d seconds.
Comment 9 Ross Levine 2007-05-08 18:17:48 UTC
Cleared and rescan, the iTunes plugin is now missing, I think because of the changes made to Common.pm

I'll start this all over with a fresh image of XP tomorrow. I'll once again establish an iTunes library, install SlimServer and enable use iTunes, then I'll enable d_itunes and d_plugins, set the iTunes reload interval to 30 seconds and make changes to the iTunes library and wait 30 seconds. 

Is there anything else I'm missing or is this a good test?
Comment 10 KDF 2007-05-08 18:28:37 UTC
just to be safe, use d_itunes and d_plugins immediately after you've installed slimserver (don't let the installer start SS for you) so that we can see the server finding itunes from scratch. d_plugins should also be showing any problems if in fact it was the one line you added causing a failure to load.  If I have time, I'll try something at home.
Comment 11 Ross Levine 2007-05-08 18:32:31 UTC
How do you install SlimServer without letting the installer start SS automatically? That option has been removed per Dean... 

I'll give it a try tomorrow and comment with what I find, thanks for working with me on this KDF!
Comment 12 KDF 2007-05-08 19:11:04 UTC
work around it by installing slimserver before iTunes maybe. I suppose it isn't too bad if it starts up once.  The log info should still be there on the second start.  However, don't do much about connecting to itunes on the post-install start.
Comment 13 KDF 2007-05-08 22:20:14 UTC
sadly, best I can tell the itunes plugin is totally broken on windows. the scanner process never starts even though the trigger might be there and that is only after working through all the failed checks that prevent starting the scan when checking for changes.  It is also likely causing bug 4185. I can't at this point see how anyone is able to use iTunes without maybe a forced rescan.

scanner.exe does start, but best I can tell is locked up.  isScanning cannot be set so I suspect it's a db access conflict:

2007-05-08 22:17:11.3426 commit ineffective with AutoCommit enabled at C:\Program Files\SlimServer\server\CPAN/DBIx/Class/Stora
2007-05-08 22:17:11.3556 Commmit ineffective while AutoCommit is on at C:\Program Files\SlimServer\server\CPAN/DBIx/Class/Stora
2007-05-08 22:17:11.3580 ERROR: DBD::mysql::db commit failed: Commmit ineffective while AutoCommit is on at C:\Program Files\Sl
Ix/Class/Storage/DBI.pm line 706.

2007-05-08 22:17:11.3585 ERROR: Backtrace follows:

2007-05-08 22:17:11.3594 Backtrace:

   frame 0: Slim::Schema::throw_exception (C:\Program Files\SlimServer\server\CPAN/DBIx/Class/Schema.pm line 606)
   frame 1: DBIx::Class::Schema::txn_do (C:\Program Files\SlimServer\server/Slim/Music/Import.pm line 241)
   frame 2: (eval) (C:\Program Files\SlimServer\server/Slim/Music/Import.pm line 233)
   frame 3: Slim::Music::Import::setIsScanning (C:\Program Files\SlimServer\server/Slim/Music/Import.pm line 152)
   frame 4: Slim::Music::Import::launchScan (C:\Program Files\SlimServer\server/Slim/Control/Commands.pm line 1725)
   frame 5: Slim::Control::Commands::rescanCommand (C:\Program Files\SlimServer\server/Slim/Control/Request.pm line 1483)
   frame 6: (eval) (C:\Program Files\SlimServer\server/Slim/Control/Request.pm line 1483)
   frame 7: Slim::Control::Request::execute (C:\Program Files\SlimServer\server/Slim/Control/Request.pm line 772)
   frame 8: Slim::Control::Request::executeRequest (C:\Program Files\SlimServer\server/Plugins/iTunes/Plugin.pm line 135)
   frame 9: Plugins::iTunes::Plugin::checker (C:\Program Files\SlimServer\server/Slim/Utils/Timers.pm line 182)
   frame 10: (eval) (C:\Program Files\SlimServer\server/Slim/Utils/Timers.pm line 182)
   frame 11: Slim::Utils::Timers::checkTimers (C:\Program Files\SlimServer\server\slimserver.pl line 523)
   frame 12: main::idleStreams (C:\Program Files\SlimServer\server/Slim/Web/Template/Context.pm line 32)
   frame 13: Slim::Web::Template::Context::process (C:\Program Files\SlimServer\server\CPAN/Template/Service.pm line 88)
   frame 14: (eval) (C:\Program Files\SlimServer\server\CPAN/Template/Service.pm line 85)
   frame 15: Template::Service::process (C:\Program Files\SlimServer\server\CPAN/Template.pm line 71)
   frame 16: Template::process (C:\Program Files\SlimServer\server/Slim/Web/HTTP.pm line 2022)
   frame 17: Slim::Web::HTTP::_generateContentFromFile (C:\Program Files\SlimServer\server/Slim/Web/HTTP.pm line 1972)
   frame 18: Slim::Web::HTTP::filltemplatefile (C:\Program Files\SlimServer\server/Slim/Web/HTTP.pm line 797)
   frame 19: Slim::Web::HTTP::generateHTTPResponse (C:\Program Files\SlimServer\server/Slim/Web/HTTP.pm line 694)
   frame 20: Slim::Web::HTTP::processURL (C:\Program Files\SlimServer\server/Slim/Web/HTTP.pm line 540)
   frame 21: Slim::Web::HTTP::processHTTP (C:\Program Files\SlimServer\server/Slim/Networking/Select.pm line 238)
   frame 22: (eval) (C:\Program Files\SlimServer\server/Slim/Networking/Select.pm line 238)
   frame 23: Slim::Networking::Select::select (C:\Program Files\SlimServer\server\slimserver.pl line 493)
   frame 24: main::idle (C:\Program Files\SlimServer\server\slimserver.pl line 446)
   frame 25: main::main (C:\Program Files\SlimServer\server\slimserver.pl line 1072)

2007-05-08 22:17:11.3612 Request: Command [rescan] (Done)
2007-05-08 22:17:11.3617 iTunes: Setting checker for 30 seconds from now.

Hope you have a full-time person to take a look at this, cause I've lost a whole evening already and I cannot stand iTunes.



Comment 14 Spies Steven 2007-05-09 11:06:36 UTC
While investigating this bug I suggest specifying a different music folder then the one that contains the iTunes library. That way iTunes tracks and playlists are only in SlimServer via the iTunes plugin.
Comment 15 Ross Levine 2007-05-09 11:08:56 UTC
Dean what are your thoughts?
Comment 16 KDF 2007-05-09 11:26:41 UTC
it's also very much NOT fun since the scanner process seems to no longer obey the debug settings, so for me it seems that the scan starts (since I cleared everything in order to tackle this) and is unable to complete.  Therefore, I cannot get any idea of whether or not it rescans from the checker. Without at least one full rescan, checker will always fail.  Without a log, I cannot even guess at why the scan doesn't complete. I used to run this kind of stuff at work as it can just run on auto most of the time, but latest iTunes causes the Explorer shell to crash every time I open a folder. 
Comment 17 Spies Steven 2007-05-10 12:27:34 UTC
I seem to have found a workaround with this bug. When I initially change the iTunes Reload Interval from the default of 3600 to 30 after a fresh install, 30 is shown but no reload happens after 30 seconds. However if I stop and restart SlimServer the reload will then happen after 30 seconds. It also seems to take further changes to the interval without restarting after the initial change. The other odd thing I have noticed is that if I enter 0 for the interval the log will actually show 3600. According to the documentation this should disable reloading.
Comment 18 Spies Steven 2007-05-10 12:42:51 UTC
Duh, I get it now. If 3600 is the initial interval and I change it to 30, it will still take 3600 to see the change. Stopping and starting SlimServer will then use 30 the first time since it is already entered. Perhaps the act of changing the iTunes reload interval would then force an iTunes reload is a good solution.

I still don't see 0 disabling the reload however.
Comment 19 KDF 2007-05-10 13:29:08 UTC
The interval setting of 0 failes due ot this:
my $interval = Slim::Utils::Prefs::get('itunesscaninterval') || 3600;
which will force the timer to 3600 for checking.  However, the detection of change forces a 0 if the itunesscaninterval setting is 0.


Changing the time to 30 seconds should work, but if it was previously 3600, it will only reset after the current timer expires.  What might be better (rather than forcing a reload) is to kill and reset the checker on the setting change.
Comment 20 Ross Levine 2007-05-10 15:02:52 UTC
Created attachment 1943 [details]
scan log
Comment 21 Ross Levine 2007-05-10 15:06:03 UTC
Sorry, ignore that last attachment. Was meant for bug 3727
Comment 22 Chris Owens 2007-05-15 15:15:40 UTC
not going to get fixed for 6.5.2.
Comment 23 Ross Levine 2007-05-18 15:04:43 UTC
Just tested this with 6.5.2 - 12024 and it's still not working at all. I changed the setting from 3600 to 60, made changes to my iTunes library and waited over an hour, SlimServer still isn't picking up on the changes. 
Comment 24 Chris Owens 2007-05-21 09:11:28 UTC
But did you test it with 7.0 :)
Comment 25 Ross Levine 2007-05-21 14:46:49 UTC
Yes, exactly the same with 7.0a1 - 12063 - Windows XP - EN - cp1252 (just finished verifying). 
Comment 26 Ross Levine 2007-11-26 18:46:38 UTC
This looks like a duplicate of bug 4939, which I also filed :-| 
Comment 27 Blackketter Dean 2007-12-17 12:12:20 UTC
KDF: can we just kill the timer when the interval is changed to fix this?
Comment 28 KDF 2007-12-17 12:46:23 UTC
That was my recommendation.  in the settings handler, we can kill the timer and call checker.
Comment 29 Blackketter Dean 2007-12-17 12:49:40 UTC
Do you have a patch? 
Comment 30 KDF 2007-12-17 13:17:32 UTC
not at the moment.  I don't really have a setup to test this here :)

Something like this, but I've not tested (remember, I'm on vacation, little more than a bit jetlagged and of course drinking)
Comment 31 Blackketter Dean 2007-12-28 08:15:12 UTC
KDF: Would you be willing to look at this when you get a chance?
Comment 32 KDF 2007-12-28 09:11:07 UTC
will do.  I'm back in Canada Jan 1
Comment 33 KDF 2008-01-02 14:16:58 UTC
I have working patch, but I have a question about it.  It seems that killTimers can't work if the $objRef is 0.  Is this intentional, or a feature of using setTimers(0,...) ?  In order to kill the checker timer, I need to change the objRef to 1 (or something else).  

Triode, does that make sense?
Comment 34 KDF 2008-01-02 14:20:17 UTC
Created attachment 2603 [details]
proposed patch

Here is the patch I'm planning to use, showing the change to the $objRef so that killTimers works properly in the prefChange handler.
Comment 35 Adrian Smith 2008-01-02 14:38:03 UTC
I would suggest using undef for $obj if you don't have an object.  This will mean killTimers matches on subroutine only.
Comment 36 KDF 2008-01-02 14:49:39 UTC
So, is the 0 something we should use when we don't want to kill a timer ever?  We use killTimers on 0 in at least one other case (MusicIP), so I'll fix that if we need to.
Comment 37 KDF 2008-01-02 15:38:44 UTC
fixed in trunk at change 15791.  MusicMagic plugin has a similar fix at change 15792.  please reopen if there are issues.
Comment 38 Chris Owens 2008-03-07 09:05:08 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.