diff options
author | Britney Fransen <brfransen@gmail.com> | 2013-11-13 22:00:18 (GMT) |
---|---|---|
committer | Britney Fransen <brfransen@gmail.com> | 2013-11-13 22:00:18 (GMT) |
commit | 806fc99ed3a2c281846aa82120244e0ce593c48f (patch) | |
tree | 743f1bd452a109097ccb5033b17691c06daced53 | |
parent | 65d116fd70f48623c761c9375c31ab6ee6fcc179 (diff) | |
download | linhes_pkgbuild-806fc99ed3a2c281846aa82120244e0ce593c48f.zip linhes_pkgbuild-806fc99ed3a2c281846aa82120244e0ce593c48f.tar.gz linhes_pkgbuild-806fc99ed3a2c281846aa82120244e0ce593c48f.tar.bz2 |
LinHES-system: myth_status.py: fix for Myth .27. closes #937
-rwxr-xr-x | abs/core/LinHES-system/PKGBUILD | 4 | ||||
-rw-r--r-- | abs/core/LinHES-system/myth_status.py | 46 |
2 files changed, 28 insertions, 22 deletions
diff --git a/abs/core/LinHES-system/PKGBUILD b/abs/core/LinHES-system/PKGBUILD index ab3f438..6d298a8 100755 --- a/abs/core/LinHES-system/PKGBUILD +++ b/abs/core/LinHES-system/PKGBUILD @@ -1,6 +1,6 @@ pkgname=LinHES-system pkgver=8.0 -pkgrel=37 +pkgrel=38 arch=('i686' 'x86_64') install=system.install pkgdesc="Everything that makes LinHES an automated system" @@ -84,7 +84,7 @@ md5sums=('5ee78704cab0e88ec58d1aab821fc1aa' '542e670e78d117657f93141e9689f54d' '41951459ea9d2b0567be521b67e6285a' 'bb72ab230c7a71706285bd0f31a4fb1f' - '692563448cca1d49f45e7d1c8abcaa0c' + 'a5960b188c020edb4fba945875927758' '962a3e9eaba2d1466251b7ab0956705d' '1758aed160de64abfafb28a3a8f3390e' '33fbebbd546672cedd3c5e7350ab414e' 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 |