summaryrefslogtreecommitdiffstats
path: root/abs/core/LinHES-system/myth_status.py
diff options
context:
space:
mode:
Diffstat (limited to 'abs/core/LinHES-system/myth_status.py')
-rw-r--r--abs/core/LinHES-system/myth_status.py21
1 files changed, 10 insertions, 11 deletions
diff --git a/abs/core/LinHES-system/myth_status.py b/abs/core/LinHES-system/myth_status.py
index 0662f79..cd541ca 100644
--- a/abs/core/LinHES-system/myth_status.py
+++ b/abs/core/LinHES-system/myth_status.py
@@ -3,9 +3,10 @@
#Also will display alerts generated by xymon. If the location of xymon changes, this script needs to be updated.
from MythTV import MythBE,MythDB,MythLog
-import datetime,time,sys,subprocess,re
+import datetime,pytz,re,socket,subprocess,sys,time
from dateutil.parser import parse
-from dateutil import tz
+from tzlocal import get_localzone
+
import os,glob
from socket import gethostname;
@@ -110,7 +111,8 @@ def print_alerts():
class tuner_recording_status:
def __init__ (self,num_upcoming):
- self.now = datetime.datetime.now()
+ self.now = datetime.datetime.now(pytz.utc)
+ self.currTZ = get_localzone()
self.farout=99999999
self.next_start_diff=datetime.timedelta(self.farout)
self.num_upcoming=num_upcoming
@@ -176,7 +178,6 @@ class tuner_recording_status:
a=self.be.getUpcomingRecordings()
r=0
- currTZ = tz.tzlocal()
for i in a:
r += 1
if r > self.num_upcoming:
@@ -184,14 +185,11 @@ class tuner_recording_status:
title_chan="%s (%s)" %(i.title, i.channame)
# convert timezone to local timezone
start_time=parse(str(i.starttime))
- start_time=start_time.astimezone(currTZ)
+ start_time=start_time.astimezone(self.currTZ)
start_time_out=start_time.strftime("%a %b %d %I:%M%p")
self.upcoming_list.append([start_time_out,i.hostname, title_chan])
- #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")
- diff = start_time_struct - self.now
+ diff = start_time - self.now
if diff < self.next_start_diff :
self.next_start_diff = diff
@@ -230,13 +228,12 @@ class tuner_recording_status:
def conflicts(self):
a=self.be.getConflictedRecordings()
- currTZ = tz.tzlocal()
for i in a:
out_line=''
title_chan="%s (%s)" %(i.title, i.channame)
# convert timezone to local timezone
start_time=parse(str(i.starttime))
- start_time=start_time.astimezone(currTZ)
+ start_time=start_time.astimezone(self.currTZ)
start_time_out=start_time.strftime("%a %b %d %I:%M%p")
out_line=(start_time_out,i.hostname,title_chan)
self.conflict_list.append(out_line)
@@ -258,6 +255,8 @@ class tuner_recording_status:
def go():
+ welcomeFile=open("/etc/LinHES-release", "r")
+ print "Welcome to %s on %s\n" %(welcomeFile.readline().rstrip(), socket.gethostname())
tuner = tuner_recording_status(12)
if tuner.get_db_check_status() == 0:
tuner.print_tuner_status()