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'
This commit is contained in:
cyber-atomus 2016-04-14 00:59:09 +02:00
parent 586dbdc2c5
commit de40246251
1 changed files with 15 additions and 1 deletions

View File

@ -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<now:
recordTime=losTime-now
@ -281,10 +293,12 @@ while True:
fname=str(aosTime)
xfname=satName
print "Beginning pass of "+satName+". Predicted start "+aosTimeCnv+" and end "+losTimeCnv+". Will record for "+str(recordTime).split(".")[0]+" seconds."
writeStatus(freq,aosTimeCnv,losTimeCnv,str(recordTime).split(".")[0],satName,'RECORDING')
recordWAV(freq,fname,recordTime,xfname)
#recordDOP(freq,fname,recordTime,xfname)
print "Decoding data"
if xfname in ('NOAA 15', 'NOAA 19', 'NOAA 18'):
writeStatus(freq,aosTimeCnv,losTimeCnv,str(recordTime).split(".")[0],satName,'DECODING')
decode(fname,aosTime,satName) # make picture
print "Finished pass of "+satName+" at "+losTimeCnv+". Sleeping for 10 seconds"
# Is this really needed?