From: Jan Schneider Date: Thu, 7 Feb 2013 11:42:39 +0000 (+0100) Subject: Apply ISO date processing to schedule too. X-Git-Tag: 0.10.4~13 X-Git-Url: http://git.etc.gen.nz/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3a8a95015cde3f07f66720d95993d923f6c66f48;p=mythtv-status.git Apply ISO date processing to schedule too. --- diff --git a/bin/mythtv-status b/bin/mythtv-status index 403f090..27c8ec0 100755 --- a/bin/mythtv-status +++ b/bin/mythtv-status @@ -180,10 +180,10 @@ my %defaults = ( || ($date cmp $tomorrow) == 0) } }, 'rewrite' => { - '/startTime/' => { 'T' => ' ' }, - } + '&startTime' => sub { return process_iso_date($_[0]); } } - ); + } +); # The time of the next scheduled recording. my $next_time = 'Never'; @@ -215,20 +215,7 @@ my @blocks = ( my ($value, $vars) = @_; if ($vars->{ISODate} =~ /Z$/) { - # 2012-10-17T23:50:08Z - my $d = new Date::Manip::Date; - $d->parse($vars->{ISODate}); - - # Work out our local timezone. The Date::Manip::Date - # docs say that convert will default to the local timezone, - # this appears to be lies. - my $dmb = $d->base(); - my ($tz) = $dmb->_now('tz',1); - $d->convert($tz); - - # Sample of what MythTV uses: - # Thu 18 Oct 2012, 10:20 - return $d->printf("%a %d %b %Y, %H:%M"); + return process_iso_date($vars->{ISODate}); } else { return $vars->{date} . ", " . $vars->{time}; } @@ -947,6 +934,25 @@ sub process_auto_expire { return join("\n", @lines); } +sub process_iso_date { + my $date = shift; + + # 2012-10-17T23:50:08Z + my $d = new Date::Manip::Date; + $d->parse($date); + + # Work out our local timezone. The Date::Manip::Date + # docs say that convert will default to the local timezone, + # this appears to be lies. + my $dmb = $d->base(); + my ($tz) = $dmb->_now('tz',1); + $d->convert($tz); + + # Sample of what MythTV uses: + # Thu 18 Oct 2012, 10:20 + return $d->printf("%a %d %b %Y, %H:%M"); +} + sub substitute_vars { my $block = shift; my $vars = shift;