From 63b3bae8b537ae74175398bf8000cc51812fa6c9 Mon Sep 17 00:00:00 2001 From: Britney Fransen Date: Fri, 21 Feb 2025 11:43:13 -0500 Subject: linhes-system: lh_myth_status.py: don't use tzlocal anymore and remove print_alerts that isn't used anymore --- linhes/linhes-system/PKGBUILD | 4 +- linhes/linhes-system/lh_myth_status.py | 72 +--------------------------------- 2 files changed, 4 insertions(+), 72 deletions(-) diff --git a/linhes/linhes-system/PKGBUILD b/linhes/linhes-system/PKGBUILD index 47cb98a..e69e252 100755 --- a/linhes/linhes-system/PKGBUILD +++ b/linhes/linhes-system/PKGBUILD @@ -1,6 +1,6 @@ pkgname=linhes-system pkgver=9.0.0 -pkgrel=90 +pkgrel=91 arch=('x86_64') #install=$pkgname.install pkgdesc="Everything that makes LinHES a system" @@ -36,7 +36,7 @@ sha256sums=('e6eaa2fb4819fa60cb05b4d2e7328d2914af3a73028a735ec4d56e7ece33ecc0' 'fbd1640106b3d9356452625753a6f1974e0be905b9f4732a1287b3905806cba8' '1c36e4fdf41c1063e0a127ce4a90fbdef19879c381a87f622d7399ca931560cc' '87875d9e5f5ce18208f419698ce69b6bcbcd08955a57a4a13940e715af58b787' - '93d664f4a46fda05d0f754d19df40cbda120e325b80c07092345b14763993833' + '192bfff1b8d46e0ebb969618847d9993aba3b1b578053c8d701dad9f9e758f86' 'a523388ffdc6f30f2dd2ef4803b21bded8a35bfded499dc66b786adec71840a3' '6ea7f807a29631e33629da14e7ca6481310f0416c5d6f8fb415a76fa90fb9b76' '91bdec992bb2c933e15625c181f2195c402060b879168ebf35944cb064c904b9' diff --git a/linhes/linhes-system/lh_myth_status.py b/linhes/linhes-system/lh_myth_status.py index c682d1c..2ed3d42 100755 --- a/linhes/linhes-system/lh_myth_status.py +++ b/linhes/linhes-system/lh_myth_status.py @@ -1,12 +1,9 @@ #!/usr/bin/python #This program is called on login to display the status of mythtv tuners & recording status -#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,pytz,re,socket,subprocess,sys,time from dateutil.parser import parse -from tzlocal import get_localzone - import os,glob from socket import gethostname; @@ -41,69 +38,6 @@ def formatTD(td): return_string = '%s%s%s%s' % (day_string, hour_string, minute_string, second_string) return return_string -def print_alerts(): - dir_name = "/home/xymon/var/login_alerts" - out_alert="" - try: - os.chdir(dir_name) - except: - pass - #print " myth_status: Couldn't change dir to %s" %dir_name - - file_list=glob.glob("*") - - if len(file_list) == 0: - #print " myth_status: no alert files found" - pass - else: - for alert_file in file_list: - out_line='' - datahost = '' - dataservice = '' - datacolor = '' - datadown = '' - try: - #print " myth_staus: reading in %s" %alert_file - f=open(alert_file,'r') - lines=f.readlines() - f.close() - except: - #print " myth_status: Couldn't open %s for reading" %alert_file - continue - - for line in lines: - try: - data,value=line.split(":") - except: - continue #exception occured try the next line - - if data == 'HOST': - datahost = value.strip() - elif data == 'SERVICE': - dataservice = value.strip() - elif data == 'COLOR': - datacolor = value.strip() - elif data == 'DOWN': - datadown = value.strip() - sec=int(datadown) - td_sec = datetime.timedelta(seconds=sec) - td_sec_formated = formatTD(td_sec) - - out_line =" %s on %s %s for %s \n" %(dataservice, - datahost,datacolor.upper(), - td_sec_formated) - out_alert += out_line - - print("System Alerts:") - print("--------------") - if len(out_alert) > 0: - print(out_alert) - print(" Go to http://%s and click Health & Maintenance for more information." %gethostname()) - else: - print(" All systems OK") - - return - #------------------------------------------- @@ -112,7 +46,6 @@ class tuner_recording_status: def __init__ (self,num_upcoming): 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 @@ -186,7 +119,7 @@ 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(self.currTZ) + start_time=start_time.astimezone() start_time_out=start_time.strftime("%a %b %d %I:%M%p") self.upcoming_list.append([start_time_out,i.hostname, title_chan]) @@ -234,7 +167,7 @@ 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(self.currTZ) + start_time=start_time.astimezone() 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) @@ -264,7 +197,6 @@ def go(): tuner.print_upcoming_recordings() tuner.print_conflict_list() tuner.print_next_start_time() - #print_alerts() if __name__ == "__main__": -- cgit v0.12