summaryrefslogtreecommitdiffstats
path: root/abs/core/LinHES-system/myth_status.py
diff options
context:
space:
mode:
authorBritney Fransen <brfransen@gmail.com>2013-11-13 22:00:18 (GMT)
committerBritney Fransen <brfransen@gmail.com>2013-11-13 22:00:18 (GMT)
commit806fc99ed3a2c281846aa82120244e0ce593c48f (patch)
tree743f1bd452a109097ccb5033b17691c06daced53 /abs/core/LinHES-system/myth_status.py
parent65d116fd70f48623c761c9375c31ab6ee6fcc179 (diff)
downloadlinhes_pkgbuild-806fc99ed3a2c281846aa82120244e0ce593c48f.zip
linhes_pkgbuild-806fc99ed3a2c281846aa82120244e0ce593c48f.tar.gz
linhes_pkgbuild-806fc99ed3a2c281846aa82120244e0ce593c48f.tar.bz2
LinHES-system: myth_status.py: fix for Myth .27. closes #937
Diffstat (limited to 'abs/core/LinHES-system/myth_status.py')
-rw-r--r--abs/core/LinHES-system/myth_status.py46
1 files changed, 26 insertions, 20 deletions
diff --git a/abs/core/LinHES-system/myth_status.py b/abs/core/LinHES-system/myth_status.py
index 2e48024..5515d1e 100644
--- a/abs/core/LinHES-system/myth_status.py
+++ b/abs/core/LinHES-system/myth_status.py
@@ -1,8 +1,8 @@
#!/usr/bin/python2
from MythTV import MythBE,MythDB,MythLog
-import datetime,time,sys,subprocess
+import datetime,time,sys,subprocess,re
try:
- be=MythBE()
+ be = MythBE()
db = MythDB()
except:
print "\nCouldn't connect to MythTV service for status"
@@ -21,27 +21,29 @@ def formatTD(td):
minutes = (td.seconds % 3600) // 60
seconds = td.seconds % 60
- if days > 1:
- day_string = "%s days" %days
+ if days == 0:
+ day_string = ""
+ elif days > 1:
+ day_string = "%s days, " %days
else:
- day_string = "%s day" %days
+ day_string = "%s day, " %days
if hours > 1:
- hour_string = "%s hours" %hours
+ hour_string = "%s hours, " %hours
else:
- hour_string = "%s hour" %hours
+ hour_string = "%s hour, " %hours
if minutes > 1:
- minute_string = "%s minutes" %minutes
+ minute_string = "%s minutes, " %minutes
else:
- minute_string = "%s minute" %minutes
+ minute_string = "%s minute, " %minutes
if seconds > 1:
second_string = "%s seconds" %seconds
else:
second_string = "%s second" %seconds
- return_string = '%s, %s, %s, %s' % (day_string, hour_string, minute_string, second_string)
+ return_string = '%s%s%s%s' % (day_string, hour_string, minute_string, second_string)
return return_string
@@ -50,8 +52,8 @@ a=be.getRecorderList()
header="#"*60
print header
print ""
-print "Tuner Status: "
-print "--------------"
+print "Tuner Status:"
+print "-------------"
for i in a:
cmd="select cardtype,hostname from capturecard where cardid=%s;" %i
@@ -72,7 +74,7 @@ for i in a:
print ""
print "Upcoming Recordings (Next %s scheduled):" %(num_upcoming)
-print "--------------------"
+print "----------------------------------------"
a=be.getUpcomingRecordings()
r=0
for i in a:
@@ -81,9 +83,12 @@ for i in a:
break
title_chan="%s (%s)" %(i.title, i.channame)
- print " %s - %s - %-50s " %(i.starttime,i.hostname, title_chan)
- #start_time=time.strptime(str(i.starttime), "%Y-%m-%d %H:%M:%S")
- diff = i.starttime - now
+ #remove timezone
+ start_time=re.split("[-+]\d\d:\d\d",str(i.starttime))[0]
+ start_time_struct=datetime.datetime.strptime(start_time, "%Y-%m-%d %H:%M:%S")
+ start_time_out=start_time_struct.strftime("%a %b %d %I:%M%p")
+ print " %s - %s - %-50s " %(start_time_out,i.hostname, title_chan)
+ diff = start_time_struct - now
if diff < next_start_diff :
next_start_diff = diff
@@ -99,17 +104,18 @@ for i in a:
c=c+1
if c == 0:
- print " No conflicts"
+ print " No Conflicts"
print ""
-print ""
-
if next_start_diff == datetime.timedelta(farout):
ur="No recordings are scheduled"
else:
ur=formatTD(next_start_diff)
-print "The next recording starts in:\n %s" %(ur)
+print "The next recording starts in:"
+print "-----------------------------"
+print " %s" %(ur)
print ""
subprocess.call("/usr/LH/bin/diskspace.sh",shell=True)
print ""
+print header