Bug 5972 - Music Folder defaults to "1"
: Music Folder defaults to "1"
Status: RESOLVED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: Web Interface
: 7.0
: PC RedHat Linux
: P2 normal (vote)
: ---
Assigned To: Unassigned bug - please assign me!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-10-30 09:44 UTC by Mark Miksis
Modified: 2007-10-30 11:43 UTC (History)
2 users (show)

See Also:
Category: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Miksis 2007-10-30 09:44:27 UTC
This started in the nightlys a few days ago and is still present as of 2007-10-30.

On a fresh install, when the wizard gets to the "Music Folder" page, there is a "1" in the form box at the bottom.  (At this point, a peek at the prefs file reveals "audiodir: ''")  If I select something from the folder tree or overwrite the "1" with a valid folder, everything works fine.  But if I just click NEXT, it tries to save "1" as the audiodir.

Not sure if this is platform dependent...
Comment 1 KDF 2007-10-30 10:29:29 UTC
check your logs.  I believe some cases of missing strings return a 1.
Comment 2 Mark Miksis 2007-10-30 10:38:45 UTC
No errors in the logs.
Comment 3 KDF 2007-10-30 11:10:15 UTC
There is an odd bit of code in Wizard.pm:

if (!$serverPrefs->get('wizardDone')) {
   $paramRef->{prefs}->{iTunes} = $paramRef->{prefs}->{iTunes} || Slim::Plugin::iTunes::Common->canUseiTunesLibrary();
   $paramRef->{prefs}->{audiodir} = $paramRef->{prefs}->{audiodir} || !$paramRef->{prefs}->{iTunes};
}


This appears to be setting the audiodir to 1 if iTunes isn't found/used. According to the comments, I think the code needs to be more like:

if (!$serverPrefs->get('wizardDone')) {
   $paramRef->{prefs}->{iTunes} = $paramRef->{prefs}->{iTunes} if Slim::Plugin::iTunes::Common->canUseiTunesLibrary();
   $paramRef->{prefs}->{audiodir} = $paramRef->{prefs}->{audiodir} if !$paramRef->{prefs}->{iTunes};
}

 will merge shortly after a quick test.


Comment 4 KDF 2007-10-30 11:13:33 UTC
merged in at change 14222. This fixes the problem as I reproduced it.  Please verify and reopen if there are any problems.
Comment 5 Michael Herger 2007-10-30 11:16:44 UTC
Oops... that logic is wrong indeed. It shouldn't set audiodir, but the checkbox used to activate audiodir.

$paramRef->{prefs}->{iTunes} = $paramRef->{prefs}->{iTunes} if
Slim::Plugin::iTunes::Common->canUseiTunesLibrary();

isn't ok neither, as we don't want to activate iTunes if it had been disabled before.
Comment 6 Michael Herger 2007-10-30 11:19:13 UTC
This should rather be 

$paramRef->{prefs}->{useAudioDir} = $paramRef->{prefs}->{audiodir} ||
!$paramRef->{prefs}->{iTunes};
Comment 7 KDF 2007-10-30 11:37:21 UTC
the || for iTunes is wrong then too.  I can use iTunes as I'm on windows with iTunes installed, but I previously set it to off.  This || logic would turn the checkbox on in my case.  Wouldn't && make more sense then? 

who was this now assigned to, btw? 
Comment 8 Michael Herger 2007-10-30 11:43:48 UTC
Change 14223 - fix the useAudiodir logic
Change 14224 - fix the iTunes logic

I thought it was assigned to me. Guess I was wrong. Let's close this case. It's confusing.