Index: HTML/EN/settings/player/basic.html =================================================================== --- HTML/EN/settings/player/basic.html (revision 14941) +++ HTML/EN/settings/player/basic.html (working copy) @@ -23,29 +23,16 @@ [% END %] - [% WRAPPER setting title="SETUP_TITLEFORMAT" desc="SETUP_GROUP_TITLEFORMATS_DESC" %] - <table width="100%"> - <tr> - <th>[% 'SETUP_CURRENT' | string %]</th> - <th>[% 'DISPLAY_SETTINGS' | string %]</th> - </tr> - [% FOREACH format = prefs.titleFormat %] - <tr> - <td> - <input type=radio [% IF prefs.titleFormatCurr == loop.index %]checked [% END %]value="[% loop.index %]" name="titleFormatCurr"> - </td> - - <td> - <select class="stdedit" name="titleFormat[% loop.index %]" id="titleFormat[% loop.index %]"> - [% num = loop.index %][% last = loop.max %] - [% FOREACH option = titleFormatOptions.keys.sort %] - <option [% IF prefs.titleFormat.$num == option %]selected [% ELSIF num == last && option == '-1' %]selected [% END %]value="[% option %]">[% titleFormatOptions.$option %]</option> - [%- END -%] - </select> - </td> - </tr> - [% END %] - </table> + [% WRAPPER setting title="SETUP_TITLEFORMAT" desc="SETUP_TITLEFORMAT_DESC" %] + <select class="stdedit" name="titleFormatPlayer" id="titleFormatPlayer"> + + [% FOREACH option = titleformats %] + + <option [% IF prefs.titleFormatWeb == loop.index %]selected [% END %]value="[% loop.index %]">[% option %]</option> + + [%- END -%] + + </select> [% END %] [% IF prefs.exists('playingDisplayModes') %] Index: HTML/EN/settings/server/interface.html =================================================================== --- HTML/EN/settings/server/interface.html (revision 14941) +++ HTML/EN/settings/server/interface.html (working copy) @@ -33,10 +33,15 @@ [% END %] [% WRAPPER setting title="SETUP_TITLEFORMAT" desc="SETUP_GROUP_TITLEFORMATS_DESC" %] - [% FOREACH format = prefs.titleFormat %] - <input type=radio [% IF prefs.titleFormatWeb == loop.index %]checked [% END %]value="[% loop.index %]" name="titleFormatWeb"> - <input type="text" class="stdedit" name="titleFormat[% loop.index %]" id="titleFormat[% loop.index %]" value="[% format %]" size="40"><br> - [% END %] + <select class="stdedit" name="titleFormatWeb" id="titleFormatWeb"> + + [% FOREACH option = titleformats %] + + <option [% IF prefs.titleFormatWeb == loop.index %]selected [% END %]value="[% loop.index %]">[% option %]</option> + + [%- END -%] + + </select> [% END %] [% WRAPPER setting title="SETUP_ITEMSPERPAGE" desc="SETUP_ITEMSPERPAGE_DESC" %] Index: Slim/Buttons/Common.pm =================================================================== --- Slim/Buttons/Common.pm (revision 14941) +++ Slim/Buttons/Common.pm (working copy) @@ -1080,21 +1080,9 @@ } }, - 'titleFormat' => sub { + 'datetime' => sub { my $client = shift; - # rotate the titleFormat - $prefs->client($client)->set('titleFormatCurr' , - ($prefs->client($client)->get('titleFormatCurr') + 1) % - (scalar @{ $prefs->client($client)->get('titleFormat') }) - ); - - $client->update(); - }, - - 'datetime' => sub { - my $client = shift; - # briefly display the time/date $client->showBriefly(dateTime(), { 'duration' => 3 Index: Slim/Buttons/Settings.pm =================================================================== --- Slim/Buttons/Settings.pm (revision 14941) +++ Slim/Buttons/Settings.pm (working copy) @@ -220,18 +220,18 @@ 'onPlay' => \&setPref, 'onAdd' => \&setPref, 'onRight' => \&setPref, - 'pref' => 'titleFormatCurr', - 'initialValue' => sub { $prefs->client(shift)->get('titleFormatCurr') }, + 'pref' => 'titleFormatPlayer', + 'initialValue' => sub { $prefs->client(shift)->get('titleFormatPlayer') }, 'init' => sub { my $client = shift; my @externTF = (); my $i = 0; - for my $format (@{ $prefs->client($client)->get('titleFormat') }) { + for my $format (Slim::Utils::Prefs::titleFormats) { push @externTF, { - 'name' => $prefs->get('titleFormat')->[ $format ], + 'name' => $format, 'value' => $i++ }; } Index: Slim/Music/Info.pm =================================================================== --- Slim/Music/Info.pm (revision 14941) +++ Slim/Music/Info.pm (working copy) @@ -532,13 +532,10 @@ # $titleFormat[$clientTitleFormat[$clientTitleFormatCurr]] get # the title format - return $prefs->get('titleFormat')->[ - # at the array index of the client titleformat array - $prefs->client($client)->get('titleFormat')->[ + return ${Slim::Utils::Prefs::titleFormats[ # which is currently selected - $prefs->client($client)->get('titleFormatCurr') - ] - ]; + $prefs->client($client)->get('titleFormatPlayer') + ]}; } else { Index: Slim/Player/Client.pm =================================================================== --- Slim/Player/Client.pm (revision 14941) +++ Slim/Player/Client.pm (working copy) @@ -30,18 +30,17 @@ my $prefs = preferences('server'); our $defaultPrefs = { - 'maxBitrate' => undef, # will be set by the client device OR default to server pref when accessed. - 'alarmvolume' => [50,50,50,50,50,50,50,50], - 'alarmfadeseconds' => 0, # fade in alarm, 0 means disabled - 'alarm' => [0,0,0,0,0,0,0,0], - 'alarmtime' => [0,0,0,0,0,0,0,0], - 'alarmplaylist' => ['','','','','','','',''], - 'lameQuality' => 9, - 'playername' => undef, - 'repeat' => 2, - 'shuffle' => 0, - 'titleFormat' => [5, 1, 3, 6], - 'titleFormatCurr' => 1, + 'maxBitrate' => undef, # will be set by the client device OR default to server pref when accessed. + 'alarmvolume' => [50,50,50,50,50,50,50,50], + 'alarmfadeseconds' => 0, # fade in alarm, 0 means disabled + 'alarm' => [0,0,0,0,0,0,0,0], + 'alarmtime' => [0,0,0,0,0,0,0,0], + 'alarmplaylist' => ['','','','','','','',''], + 'lameQuality' => 9, + 'playername' => undef, + 'repeat' => 2, + 'shuffle' => 0, + 'titleFormatPlayer' => 0, }; # depricated, use $client->maxVolume Index: Slim/Utils/Prefs.pm =================================================================== --- Slim/Utils/Prefs.pm (revision 14941) +++ Slim/Utils/Prefs.pm (working copy) @@ -213,18 +213,6 @@ '/ARTIST/ALBUM/TRACKNUM TITLE', '/ARTIST/ALBUM/TRACKNUM. TITLE' ], - 'titleFormat' => [ - 'TITLE', - 'DISC-TRACKNUM. TITLE', - 'TRACKNUM. TITLE', - 'TRACKNUM. ARTIST - TITLE', - 'TRACKNUM. TITLE (ARTIST)', - 'TRACKNUM. TITLE - ARTIST - ALBUM', - 'FILE.EXT', - 'TRACKNUM. TITLE from ALBUM by ARTIST', - 'TITLE (ARTIST)', - 'ARTIST - TITLE' - ], 'titleFormatWeb' => 1, # Server Settings - UserInterface 'skin' => 'Default', @@ -447,6 +435,22 @@ return $secret; } +sub titleFormats { + return [ + q(TITLE), + q(DISC-TRACKNUM. TITLE), + q(TRACKNUM. TITLE), + q(TRACKNUM. ARTIST - TITLE), + q(TRACKNUM. TITLE (ARTIST)), + q(TRACKNUM. TITLE - ARTIST - ALBUM), + q(FILE.EXT), + q(TRACKNUM. TITLE from ALBUM by ARTIST), + q(TITLE (ARTIST)), + q(ARTIST - TITLE), + ]; +} + + sub defaultAudioDir { my $path = Slim::Utils::OSDetect::dirsFor('music'); Index: Slim/Web/Settings/Player/Basic.pm =================================================================== --- Slim/Web/Settings/Player/Basic.pm (revision 14941) +++ Slim/Web/Settings/Player/Basic.pm (working copy) @@ -35,7 +35,7 @@ if ($client->isPlayer && !$client->display->isa('Slim::Display::NoDisplay')) { - push @prefs, qw(titleFormatCurr playingDisplayMode playtrackalbum); + push @prefs, qw(titleFormatPlayer playingDisplayMode playtrackalbum); if (scalar(keys %{ Slim::Buttons::Common::hash_of_savers() }) > 0) { @@ -55,7 +55,7 @@ my ($class, $client, $paramRef) = @_; # array prefs handled by this handler not handler::SUPER - my @prefs = qw(titleFormat); + my @prefs = (); if (defined $client && $client->isPlayer()) { @@ -88,7 +88,7 @@ $paramRef->{'prefs'}->{$pref} = [ @{ $prefs->client($client)->get($pref) }, "-1" ]; } - $paramRef->{'titleFormatOptions'} = hashOfPrefs('titleFormat'); + $paramRef->{'titleformats'} = Slim::Utils::Prefs::titleFormats(); if ($client && !$client->display->isa('Slim::Display::NoDisplay')) { $paramRef->{'playingDisplayOptions'} = getPlayingDisplayModes($client); Index: Slim/Web/Settings/Server/UserInterface.pm =================================================================== --- Slim/Web/Settings/Server/UserInterface.pm (revision 14941) +++ Slim/Web/Settings/Server/UserInterface.pm (working copy) @@ -31,23 +31,8 @@ sub handler { my ($class, $client, $paramRef, $pageSetup) = @_; - # handle array prefs in this handler, scalar prefs in SUPER::handler - my @prefs = qw(titleFormat); - if ($paramRef->{'saveSettings'}) { - for my $pref (@prefs) { - - my @array; - - for (my $i = 0; defined $paramRef->{$pref.$i}; $i++) { - - push @array, $paramRef->{$pref.$i} if $paramRef->{$pref.$i}; - } - - $prefs->set($pref, \@array); - } - if ($paramRef->{'titleformatWeb'} ne $prefs->get('titleFormatWeb')) { for my $client (Slim::Player::Client::clients()) { @@ -75,13 +60,10 @@ } } - for my $pref (@prefs) { - $paramRef->{'prefs'}->{ $pref } = [ @{ $prefs->get($pref) || [] }, '' ]; - } - $paramRef->{'longdateoptions'} = Slim::Utils::DateTime::longDateFormats(); $paramRef->{'shortdateoptions'} = Slim::Utils::DateTime::shortDateFormats(); $paramRef->{'timeoptions'} = Slim::Utils::DateTime::timeFormats(); + $paramRef->{'titleformats'} = Slim::Utils::Prefs::titleFormats(); $paramRef->{'skinoptions'} = { Slim::Web::HTTP::skins(1) };