|| ($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';
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};
}
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;