Package: mythtv-status
Version: 0.10.1-1
Tags: patch

Hello Andrew!

I noticed a bizarre behaviour of mythtv-status: at 9pm, when the next
recording was due at about 6pm the next day, it reported: "Next
Recording In: -3 Hours, -7 Minutes", which is clearly nonsense.  The
attached patch fixes this, and two other bugs:

- if the next recording is in longer than 1 day, it now gives the
  correct time
- if the time is 1 Hour, 1 Minute, it says this correctly (instead of
  saying 1 Hour, 1 Minutes)

Also, it might be good to also handle cases where the next recording
is in longer than a day differently.  That shouldn't be so hard to do,
using the Date::Manip routines, I guess....

All the best,

   Julian
--- /usr/bin/mythtv-status	2012-06-14 11:49:26.000000000 +0100
+++ /tmp/mythtv-status	2012-07-05 11:14:31.277856364 +0100
@@ -436,11 +436,11 @@
           if $next_time eq 'Never' || $next_time eq 'now';
 
         my $err;
-        my $delta   = DateCalc('now', $next_time, \$err, 1);
+        my $delta   = DateCalc('now', $next_time, \$err, 0);
         my $str     = Delta_Format($delta, 0, '%hh Hours, %mv Minutes');
-        my $seconds = Delta_Format($delta, 0, '%sh');
+        my $seconds = Delta_Format($delta, 'approx', 0, '%sh');
 
-        $str =~ s/\b1 (Hour|Minute)s/1 $1/;
+        $str =~ s/\b1 (Hour|Minute)s/1 $1/g;
         $str =~ s/^0 Hours, //;
         $str =~ s/ 0 Minutes//;
 

Reply via email to