From de40246251256571d8a0d66439d84dbaf940bbce Mon Sep 17 00:00:00 2001 From: cyber-atomus Date: Thu, 14 Apr 2016 00:59:09 +0200 Subject: [PATCH] Experimental support for "/tmp/rec_info" status file (not a pipe, yet). Status file contains two lines and is intended to be read by lcd4linux. Example lcd4linux.conf below Display debug { driver 'Curses' Size '20x2' } Widget LINEA { class 'Text' width '20' expression file::readline('/tmp/rec_info', 1) align 'A' update '100' } Widget LINEB { class 'Text' width '20' align 'A' expression file::readline('/tmp/rec_info', 2) update 100 } Layout infobox { Row1 { Col1 'LINEA' } Row2 { Col1 'LINEB' } } Display 'debug' Layout 'infobox' --- noaacapture.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/noaacapture.py b/noaacapture.py index 5265a96..970f0bb 100755 --- a/noaacapture.py +++ b/noaacapture.py @@ -153,6 +153,17 @@ def recordMETEOR(freq, fname, duration, xfname): runForDuration(cmdline, duration) +def writeStatus(freq, aosTime, losTime, recordTime, xfName, status): + statFile=open('/tmp/rec_info', 'r+') + if status in ('RECORDING'): + statFile.write('F: '+str(freq)+' | '+str(xfName)+' | '+'AOS.'+str(aosTime)+' | \n'+str(status)+' FOR '+str(recordTime)+' SECS | LOS.'+str(losTime)+'\n') + elif status in ('DECODING'): + statFile.write('FINISHED PASS OF '+str(xfName)+' AT '+str(losTime)+'\n'+'DECODING IMAGE'+'\n') + elif status in ('WAITING'): + statFile.write('WAITING FOR '+str(xfName)+' (AOS.'+str(aosTime)+') \nIDLE\n') + statFile.close + + def transcode(fname): xfNoSpace=xfname.replace(" ","") print 'Transcoding...' @@ -271,7 +282,8 @@ while True: dimTimeUtc=strftime('%Y-%m-%dT%H:%M:%S', time.gmtime(losTime)) if towait>0: print "waiting "+str(towait).split(".")[0]+" seconds (emerging "+aosTimeCnv+") for "+satName - time.sleep(towait) + writeStatus(freq,aosTimeCnv,losTimeCnv,towait,satName,'WAITING') + time.sleep(towait) # If the script broke and sat is passing by - change record time to reflect time change if aosTime