Index: Slim/Plugin/DateTime/Plugin.pm =================================================================== --- Slim/Plugin/DateTime/Plugin.pm (revision 23170) +++ Slim/Plugin/DateTime/Plugin.pm (working copy) @@ -64,10 +64,16 @@ # snooze if alarm is currently playing if (defined $currentAlarm) { $currentAlarm->snooze; - } + # show time if brightness is zero + } elsif ($client->display->currBrightness() == 0) { + $client->showBriefly( dateTimeLines($client), { + 'brightness' => 'powerOn', + 'duration' => 3 + }); + # display next alarm time if alarm is within the next 24h - elsif (defined $nextAlarm && ($nextAlarm->nextDue - time < 86400)) { + } elsif (defined $nextAlarm && ($nextAlarm->nextDue - time < 86400)) { my $line = $client->symbols('bell'); @@ -134,8 +140,8 @@ time_zone => $timezone ); - # We use the same method as alarm clock, to align updates at each minute change - # so we only have to run once a minute instead of every few seconds + # Align updates at each minute change so we only have to run once a minute instead + # of every few seconds my $sec = (localtime(time))[0]; my $snInterval = 60 - $sec; @@ -143,7 +149,31 @@ Slim::Buttons::Common::startPeriodicUpdates( $client, time() + $snInterval ); } + if (Slim::Utils::Alarm->getCurrentAlarm($client) && !$flash) { + # schedule another update to remove the alarm symbol during alarm + Slim::Utils::Timers::setTimer($client, Time::HiRes::time + 0.5, \&_flashAlarm); + } + +# BUG 3964: comment out until Dean has a final word on the UI for this. +# if ($client->display->hasScreen2) { +# if ($client->display->linesPerScreen == 1) { +# $display->{'screen2'}->{'center'} = [undef,Slim::Utils::DateTime::longDateF(undef,$prefs->get('dateformat'))]; +# } else { +# $display->{'screen2'} = {}; +# } +# } + + return dateTimeLines($client, $flash); +} + +# Return the lines to display the date and time on a display, along with alarm information +sub dateTimeLines { + my $client = shift; + # Boolean. If false, the whole display is rendered. Otherwise, the bits which flash aren't included. + my $flash = shift; + my $currentAlarm = Slim::Utils::Alarm->getCurrentAlarm($client); + my $nextAlarm = Slim::Utils::Alarm->getNextAlarm($client); # show alarm symbol if active or set for next 24 hours @@ -187,20 +217,6 @@ }; } - if ($currentAlarm && !$flash) { - # schedule another update to remove the alarm symbol during alarm - Slim::Utils::Timers::setTimer($client, Time::HiRes::time + 0.5, \&_flashAlarm); - } - -# BUG 3964: comment out until Dean has a final word on the UI for this. -# if ($client->display->hasScreen2) { -# if ($client->display->linesPerScreen == 1) { -# $display->{'screen2'}->{'center'} = [undef,Slim::Utils::DateTime::longDateF(undef,$prefs->get('dateformat'))]; -# } else { -# $display->{'screen2'} = {}; -# } -# } - return $display; } Index: Slim/Buttons/Common.pm =================================================================== --- Slim/Buttons/Common.pm (revision 23170) +++ Slim/Buttons/Common.pm (working copy) @@ -2268,19 +2268,25 @@ my $client = shift; my $line; - - if ( main::SLIM_SERVICE ) { - # client-specific date/time on SN - $line = { - 'center' => [ $client->longDateF(), $client->timeF() ], - }; + + # Use the DateTime plugin to get the lines if its available + if (exists $INC{'Slim/Plugin/DateTime/Plugin.pm'}) { + $line = Slim::Plugin::DateTime::Plugin::dateTimeLines($client); + } else { + # Fall back to a more basic date/time display + if ( main::SLIM_SERVICE ) { + # client-specific date/time on SN + $line = { + 'center' => [ $client->longDateF(), $client->timeF() ], + }; + } + else { + $line = { + 'center' => [ Slim::Utils::DateTime::longDateF(undef, preferences('plugin.datetime')->client($client)->get('dateformat')), + Slim::Utils::DateTime::timeF(undef, preferences('plugin.datetime')->client($client)->get('timeformat')) ] + }; + } } - else { - $line = { - 'center' => [ Slim::Utils::DateTime::longDateF(undef, preferences('plugin.datetime')->client($client)->get('dateformat')), - Slim::Utils::DateTime::timeF(undef, preferences('plugin.datetime')->client($client)->get('timeformat')) ] - }; - } return $line; }