If the next recording is in $x Hours, 0 Minutes, remove the comma
as well, previously it was outputing "$x Hours,".
+ If the next recording is in more than 1 day, then switch to showing
+ it in days and hours, for example "1 Day, 2 Hours".
+
2012-07-06 Andrew Ruthven
Correctly handle UTF-8 in the output from MythTV.
my $err;
my $delta = DateCalc('now', $next_time, \$err, 0);
- my $str = Delta_Format($delta, 0, '%hh Hours, %mv Minutes');
my $seconds = Delta_Format($delta, 'approx', 0, '%sh');
- $str =~ s/\b1 (Hour|Minute)s/1 $1/g;
- $str =~ s/^0 Hours, //;
- $str =~ s/, 0 Minutes//;
+ # If the next recording is more than 1 day in the future,
+ # print out the days and hours.
+ my $str;
+ if ($seconds > 24 * 3600) {
+ $str = Delta_Format($delta, 0, '%dd Days, %hv Hours');
+ } else {
+ $str = Delta_Format($delta, 0, '%hh Hours, %mv Minutes');
+ }
+
+ $str =~ s/\b1 (Day|Hour|Minute)s/1 $1/g;
+ $str =~ s/(, )?0 Hours(, )?//;
+ $str =~ s/, 0 Minutes$//;
if ($seconds <= $c->{'recording_in_warn'}) {
$warn_present ||= 1;