. ($c->{'encoder_details'} ? ", Enc: __encoderId__, Chan: __chanNum__" : '')
. ") Ends: __endTime__",
'rewrite' => {
- '/endTime/' => { '.*T' => '' },
+ '&endTime' => sub {
+ my ($value, $vars) = @_;
+
+ if ($value =~ /Z$/) {
+ return process_iso_date($value, { date => 0 });
+ } else {
+ return $value =~ s/.*T//;
+ }
},
+ },
'subs' => {
'find_next' => sub { $warn_present ||= 1; $next_time = 'now' }
}
return join("\n", @lines);
}
+# If either date or time are set to 0, then we don't display that bit of
+# info. For example:
+# process_iso_date($date, { date => 0 })
+# Will only show the time.
sub process_iso_date {
my $date = shift;
+ my $options = shift;
+ $options->{'date'} //= 1;
+ $options->{'time'} //= 1;
# 2012-10-17T23:50:08Z
my $d = new Date::Manip::Date;
# Sample of what MythTV uses:
# Thu 18 Oct 2012, 10:20
- return $d->printf("%Y-%m-%d %X");
+ my $format = '';
+ $format .= '%Y-%m-%d' if $options->{'date'};
+ $format .= ' ' if $options->{'date'} && $options->{'time'};
+ $format .= '%X' if $options->{'time'};
+
+ return $d->printf($format);
}
sub substitute_vars {