Index: Slim/Buttons/AlarmClock.pm =================================================================== --- Slim/Buttons/AlarmClock.pm (revision 4013) +++ Slim/Buttons/AlarmClock.pm (working copy) @@ -19,6 +19,7 @@ our @browseMenuChoices; our %menuSelection; our %searchCursor; +our $weekday; # some initialization code, adding modes for this module sub init { @@ -32,6 +33,8 @@ my $client = shift; + $weekday = ${$client->param('day')} || 0; + @browseMenuChoices = ( $client->string('ALARM_SET'), $client->string('ALARM_SELECT_PLAYLIST'), @@ -39,36 +42,40 @@ $client->string('ALARM_OFF'), ); - unless (defined $menuSelection{$client}) { - $menuSelection{$client} = 0; + unless ($weekday) { + push @browseMenuChoices, $client->string('ALARM_WEEKDAYS'); } + unless (defined $menuSelection{$weekday}{$client}) { + $menuSelection{$weekday}{$client} = 0; + } + $client->lines(\&lines); # get previous alarm time or set a default - my $time = Slim::Utils::Prefs::clientGet($client, "alarmtime"); + my $time = Slim::Utils::Prefs::clientGet($client, "alarmtime", $weekday); unless (defined $time) { - Slim::Utils::Prefs::clientSet($client, "alarmtime", 9 * 60 * 60 ); + Slim::Utils::Prefs::clientSet($client, "alarmtime", 9 * 60 * 60, $weekday); } } our %functions = ( 'up' => sub { my $client = shift; - my $newposition = Slim::Buttons::Common::scroll($client, -1, ($#browseMenuChoices + 1), $menuSelection{$client}); + my $newposition = Slim::Buttons::Common::scroll($client, -1, ($#browseMenuChoices + 1), $menuSelection{$weekday}{$client}); - if ($newposition != $menuSelection{$client}) { - $menuSelection{$client} = $newposition; + if ($newposition != $menuSelection{$weekday}{$client}) { + $menuSelection{$weekday}{$client} = $newposition; $client->pushUp(); } }, 'down' => sub { my $client = shift; - my $newposition = Slim::Buttons::Common::scroll($client, +1, ($#browseMenuChoices + 1), $menuSelection{$client}); + my $newposition = Slim::Buttons::Common::scroll($client, +1, ($#browseMenuChoices + 1), $menuSelection{$weekday}{$client}); - if ($newposition != $menuSelection{$client}) { - $menuSelection{$client} = $newposition; + if ($newposition != $menuSelection{$weekday}{$client}) { + $menuSelection{$weekday}{$client} = $newposition; $client->pushDown(); } }, @@ -81,18 +88,18 @@ my $client = shift; my @oldlines = Slim::Display::Display::curLines($client); - if ($browseMenuChoices[$menuSelection{$client}] eq $client->string('ALARM_SET')) { + if ($browseMenuChoices[$menuSelection{$weekday}{$client}] eq $client->string('ALARM_SET')) { my %params = ( 'header' => $client->string('ALARM_SET') - ,'valueRef' => Slim::Utils::Prefs::clientGet($client,"alarmtime") + ,'valueRef' => Slim::Utils::Prefs::clientGet($client,"alarmtime", $weekday) ,'cursorPos' => 1 ,'callback' => \&exitSetHandler - ,'onChange' => sub { Slim::Utils::Prefs::clientSet($_[0],"alarmtime",Slim::Buttons::Common::param($_[0],'valueRef')); } + ,'onChange' => sub { Slim::Utils::Prefs::clientSet($_[0],"alarmtime",Slim::Buttons::Common::param($_[0],'valueRef'), $weekday); } ,'onChangeArgs' => 'C' ); Slim::Buttons::Common::pushModeLeft($client, 'INPUT.Time',\%params); } - if ($browseMenuChoices[$menuSelection{$client}] eq $client->string('ALARM_SELECT_PLAYLIST')) { + if ($browseMenuChoices[$menuSelection{$weekday}{$client}] eq $client->string('ALARM_SELECT_PLAYLIST')) { # Make a copy of the playlists, to make sure they # aren't removed by the LRU cache. This may fix bug: 1853 @@ -100,40 +107,79 @@ my $ds = Slim::Music::Info::getCurrentDataStore(); my %params = ( -# 'listRef' => [ @{Slim::Music::Info::playlists()} ] 'listRef' => [ $ds->getPlaylists() ] ,'externRef' => sub {Slim::Music::Info::standardTitle($_[0],$_[1]);} ,'externRefArgs' => 'CV' ,'header' => 'ALARM_SELECT_PLAYLIST' ,'headerAddCount' => 1 ,'stringHeader' => 1 - ,'onChange' => sub { Slim::Utils::Prefs::clientSet($_[0], "alarmplaylist", $_[1]); } + ,'onChange' => sub { Slim::Utils::Prefs::clientSet($_[0], "alarmplaylist", $_[1], $weekday); } ,'onChangeArgs' => 'CV' - ,'valueRef' => \&Slim::Utils::Prefs::clientGet($client,"alarmplaylist") + ,'valueRef' => \&Slim::Utils::Prefs::clientGet($client,"alarmplaylist", $weekday) ); Slim::Buttons::Common::pushModeLeft($client, 'INPUT.List',\%params); } - elsif ($browseMenuChoices[$menuSelection{$client}] eq $client->string('ALARM_OFF')) { - Slim::Utils::Prefs::clientSet($client, "alarm", 1); - $browseMenuChoices[$menuSelection{$client}] = $client->string('ALARM_ON'); + elsif ($browseMenuChoices[$menuSelection{$weekday}{$client}] eq $client->string('ALARM_OFF')) { + Slim::Utils::Prefs::clientSet($client, "alarm", 1, $weekday); + $browseMenuChoices[$menuSelection{$weekday}{$client}] = $client->string('ALARM_ON'); $client->showBriefly($client->string('ALARM_TURNING_ON'),''); setTimer($client); } - elsif ($browseMenuChoices[$menuSelection{$client}] eq $client->string('ALARM_ON')) { - Slim::Utils::Prefs::clientSet($client, "alarm", 0); - $browseMenuChoices[$menuSelection{$client}] = $client->string('ALARM_OFF'); + elsif ($browseMenuChoices[$menuSelection{$weekday}{$client}] eq $client->string('ALARM_ON')) { + Slim::Utils::Prefs::clientSet($client, "alarm", 0, $weekday); + $browseMenuChoices[$menuSelection{$weekday}{$client}] = $client->string('ALARM_OFF'); $client->showBriefly($client->string('ALARM_TURNING_OFF'),''); setTimer($client); } - elsif ($browseMenuChoices[$menuSelection{$client}] eq $client->string('ALARM_SET_VOLUME')) { + elsif ($browseMenuChoices[$menuSelection{$weekday}{$client}] eq $client->string('ALARM_SET_VOLUME')) { Slim::Buttons::Common::pushModeLeft($client, 'alarmvolume'); } + elsif ($browseMenuChoices[$menuSelection{$weekday}{$client}] eq $client->string('ALARM_WEEKDAYS')) { + # Make a copy of the playlists, to make sure they + # aren't removed by the LRU cache. This may fix bug: 1853 + + my $ds = Slim::Music::Info::getCurrentDataStore(); + my $day; + + my %params = ( + 'listRef' => [1..7] + ,'externRef' => sub {$_[0]->string(ALARM_DAY.$_[1]);} + ,'externRefArgs' => 'CV' + ,'header' => 'ALARM_WEEKDAYS' + ,'headerAddCount' => 1 + ,'stringHeader' => 1 + ,'valueRef' => \$day + ,'callback' => \&weekdayExitHandler + ); + Slim::Buttons::Common::pushModeLeft($client, 'INPUT.List',\%params); + } }, 'play' => sub { my $client = shift; }, ); +sub weekdayExitHandler { + my ($client, $exittype) = @_; + + $exittype = uc($exittype); + + if ($exittype eq 'LEFT') { + + Slim::Buttons::Common::popModeRight($client); + + } elsif ($exittype eq 'RIGHT') { + + my %params = ( + 'day' => $client->param('valueRef'), + ); + Slim::Buttons::Common::pushModeLeft($client,'alarm',\%params); + + } else { + return; + } +} + sub exitSetHandler { my ($client, $exittype) = @_; @@ -141,7 +187,7 @@ if ($exittype eq 'LEFT' || $exittype eq 'PLAY') { - Slim::Utils::Prefs::clientSet($client,"alarmtime",$client->param('valueRef')); + Slim::Utils::Prefs::clientSet($client,"alarmtime",$client->param('valueRef'), $weekday); Slim::Buttons::Common::popModeRight($client); } elsif ($exittype eq 'RIGHT') { @@ -173,24 +219,24 @@ } foreach my $client (Slim::Player::Client::clients()) { - if (Slim::Utils::Prefs::clientGet($client, "alarm")) { - my $alarmtime = Slim::Utils::Prefs::clientGet($client, "alarmtime"); + if (Slim::Utils::Prefs::clientGet($client, "alarm", 0)) { + my $alarmtime = Slim::Utils::Prefs::clientGet($client, "alarmtime", 0); if ($alarmtime) { if ($time == $alarmtime +60 ) {$interval=1;}; #alarm is done, so reset to find the beginning of a minute if ($time == $alarmtime) { $client->execute(['stop']); - my $volume = Slim::Utils::Prefs::clientGet($client, "alarmvolume"); + my $volume = Slim::Utils::Prefs::clientGet($client, "alarmvolume", 0); if (defined ($volume)) { $client->execute(["mixer", "volume", $volume]); } # fade volume over time - $client->fade_volume(Slim::Utils::Prefs::clientGet($client, "alarmfadeseconds")); + $client->fade_volume(Slim::Utils::Prefs::clientGet($client, "alarmfadeseconds", 0)); - if (defined Slim::Utils::Prefs::clientGet($client, "alarmplaylist")) { + if (defined Slim::Utils::Prefs::clientGet($client, "alarmplaylist", 0)) { $client->execute(["power", 1]); Slim::Buttons::Block::block($client,alarmLines($client)); - $client->execute(["playlist", "load", Slim::Utils::Prefs::clientGet($client, "alarmplaylist")], \&playDone, [$client]); + $client->execute(["playlist", "load", Slim::Utils::Prefs::clientGet($client, "alarmplaylist", 0)], \&playDone, [$client]); } else { $client->execute(['play']); Slim::Utils::Timers::setTimer($client, Time::HiRes::time() + 2, \&visibleAlarm, $client); @@ -198,6 +244,31 @@ } } } + if (Slim::Utils::Prefs::clientGet($client, "alarm", $wday)) { + my $alarmtime = Slim::Utils::Prefs::clientGet($client, "alarmtime", $wday); + if ($alarmtime) { + if ($time == $alarmtime +60 ) {$interval=1;}; #alarm is done, so reset to find the beginning of a minute + if ($time == $alarmtime) { + $client->execute(['stop']); + my $volume = Slim::Utils::Prefs::clientGet($client, "alarmvolume", $wday); + if (defined ($volume)) { + $client->execute(["mixer", "volume", $volume]); + } + + # fade volume over time + $client->fade_volume(Slim::Utils::Prefs::clientGet($client, "alarmfadeseconds", $wday)); + + if (defined Slim::Utils::Prefs::clientGet($client, "alarmplaylist", $wday)) { + $client->execute(["power", 1]); + Slim::Buttons::Block::block($client,alarmLines($client)); + $client->execute(["playlist", "load", Slim::Utils::Prefs::clientGet($client, "alarmplaylist", $wday)], \&playDone, [$client]); + } else { + $client->execute(['play']); + Slim::Utils::Timers::setTimer($client, Time::HiRes::time() + 2, \&visibleAlarm, $client); + } + } + } + } } setTimer(); } @@ -212,7 +283,7 @@ sub alarmLines { my $client = shift; my $line1 = $client->string('ALARM_NOW_PLAYING'); - my $line2 = Slim::Utils::Prefs::clientGet($client, "alarmplaylist") ? Slim::Music::Info::standardTitle($client,Slim::Utils::Prefs::clientGet($client, "alarmplaylist")) : ""; + my $line2 = Slim::Utils::Prefs::clientGet($client, "alarmplaylist", $weekday) ? Slim::Music::Info::standardTitle($client,Slim::Utils::Prefs::clientGet($client, "alarmplaylist", $weekday)) : ""; return ($line1, $line2); } @@ -228,14 +299,16 @@ my ($line1, $line2, $overlay); $overlay = overlay($client); - $line1 = $client->string('ALARM'); + $line1 = $weekday ? + $client->string('ALARM_WEEKDAYS')." - ".$client->string('ALARM_DAY'.$weekday) : + $client->string('ALARM'); - if (Slim::Utils::Prefs::clientGet($client, "alarm") && $browseMenuChoices[$menuSelection{$client}] eq $client->string('ALARM_OFF')) { - $browseMenuChoices[$menuSelection{$client}] = $client->string('ALARM_ON'); + if (Slim::Utils::Prefs::clientGet($client, "alarm", $weekday) && $browseMenuChoices[$menuSelection{$weekday}{$client}] eq $client->string('ALARM_OFF')) { + $browseMenuChoices[$menuSelection{$weekday}{$client}] = $client->string('ALARM_ON'); } $line2 = ""; - $line2 = $browseMenuChoices[$menuSelection{$client}]; + $line2 = $browseMenuChoices[$menuSelection{$weekday}{$client}]; return ($line1, $line2, undef, $overlay); } @@ -257,7 +330,7 @@ 'left' => sub { Slim::Buttons::Common::popModeRight(shift); }, 'up' => sub { my $client = shift; - my $volume = Slim::Utils::Prefs::clientGet($client, "alarmvolume"); + my $volume = Slim::Utils::Prefs::clientGet($client, "alarmvolume", $weekday); my $inc = 1; my $rate = 50; #Hz maximum my $accel = 15; #Hz/s @@ -271,13 +344,13 @@ if (!defined($volume)) { $volume = $client->volume(); } $volume += $inc; if ($volume > $client->maxVolume()) { $volume = $client->maxVolume(); }; - Slim::Utils::Prefs::clientSet($client, "alarmvolume", $volume); + Slim::Utils::Prefs::clientSet($client, "alarmvolume", $volume, $weekday); $client->update(); }, 'down' => sub { my $client = shift; - my $volume = Slim::Utils::Prefs::clientGet($client, "alarmvolume"); + my $volume = Slim::Utils::Prefs::clientGet($client, "alarmvolume", $weekday); my $inc = 1; my $rate = 50; #Hz maximum my $accel = 15; #Hz/s @@ -291,7 +364,7 @@ if (!defined($volume)) { $volume = $client->volume(); } $volume -= $inc; if ($volume < 0) { $volume = 0; }; - Slim::Utils::Prefs::clientSet($client, "alarmvolume", $volume); + Slim::Utils::Prefs::clientSet($client, "alarmvolume", $volume, $weekday); $client->update(); }, @@ -312,7 +385,7 @@ sub alarmVolumeLines { my $client = shift; - my $volume = Slim::Utils::Prefs::clientGet($client, "alarmvolume"); + my $volume = Slim::Utils::Prefs::clientGet($client, "alarmvolume", $weekday); if (!defined($volume)) { $volume = $client->volume(); } Index: Slim/Player/Player.pm =================================================================== --- Slim/Player/Player.pm (revision 4013) +++ Slim/Player/Player.pm (working copy) @@ -63,6 +63,7 @@ ,'upgrade-5.4b1-script' => 1 ,'upgrade-5.4b2-script' => 1 ,'upgrade-6.1b1-script' => 1 + ,'upgrade-6.2-script' => 1 ,'volume' => 50 ,'syncBufferThreshold' => 128 ,'bufferThreshold' => 255 @@ -138,6 +139,22 @@ Slim::Utils::Prefs::clientPush($client, 'menuItem', 'SQUEEZENETWORK_CONNECT'); } }, + '6.2' => sub { + my $client = shift; + #kill all alarm settings + my $alarm = Slim::Utils::Prefs::clientGet($client,'alarm'); + my $alarmTime = Slim::Utils::Prefs::clientGet($client,'alarmtime'); + my $alarmplaylist = Slim::Utils::Prefs::clientGet($client,'alarmplaylist'); + my $alarmvolume = Slim::Utils::Prefs::clientGet($client,'alarmvolume'); + Slim::Utils::Prefs::clientDelete($client,'alarm'); + Slim::Utils::Prefs::clientDelete($client,'alarmtime'); + Slim::Utils::Prefs::clientDelete($client,'alarmplaylist'); + Slim::Utils::Prefs::clientDelete($client,'alarmvolume'); + Slim::Utils::Prefs::clientSet($client,'alarm',$alarm,0); + Slim::Utils::Prefs::clientSet($client,'alarmtime',$alarmTime,0); + Slim::Utils::Prefs::clientSet($client,'alarmplaylist',$alarmplaylist,0); + Slim::Utils::Prefs::clientSet($client,'alarmvolume',$alarmvolume,0); + } ); sub new { Index: strings.txt =================================================================== --- strings.txt (revision 4013) +++ strings.txt (working copy) @@ -915,6 +915,44 @@ PT A Tocar o Alarme SE Väckarklockan spelar nu +ALARM_WEEKDAYS + EN Weekday Alarms + +ALARM_DAY1 + DE Montag + EN Monday + FR Lundi + +ALARM_DAY2 + DE Dienstag + EN Tuesday + FR Mardi + +ALARM_DAY3 + DE Mittwoch + EN Wednesday + FR Mercredi + +ALARM_DAY4 + DE Donnerstag + EN Thursday + FR Jeudi + +ALARM_DAY5 + DE Freitag + EN Friday + FR Vendredi + +ALARM_DAY6 + DE Samstag + EN Saturday + FR Samedi + +ALARM_DAY7 + DE Sonntag + EN Sunday + FR Dimanche + SLIMP3 EN SLIMP3 @@ -9173,6 +9211,16 @@ NO Versjon SE Version +INFORMATION_DIAGSTRING + EN Version Info + +INFORMATION_HOSTNAME + EN Hostname + +INFORMATION_HOSTIP + EN Host IP Address + + INFORMATION_INSTALLED CZ Instalováno DE Installiert