3 # Rec10 TS Recording Tools
4 # Copyright (C) 2009-2010 Yukikaze
15 def writeRecQue(parentpath,chtxt,title,opts):
16 f=open(os.path.join(parentpath,title+".recq"),"w")
18 #optt=opts.replace("E","")
19 #optt=optt.replace("D","")
20 #optt=optt.replace("R","")
21 str="99"+","+datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")+","+configreader.getEnvSetting("iff")+","+chtxt+","+title+","+optt
22 f.write(str.encode('utf-8'))
25 def readRecQue(recquepath):
26 f=open(recquepath,"r")
27 line = unicode(f.readline(),'utf-8')
37 chtxt=linec[2]+u"_"+linec[3]
39 line = unicode(f.readline(),'utf-8')
43 opts=opts.replace("E","")
45 dbkey=recdblist.REC_ENCODE_QUE
46 opts=opts.replace("D","")
48 dbkey=recdblist.REC_TS_DECODE_QUE
49 opts=opts.replace("R","")
50 bt=datetime.datetime.now()+datetime.timedelta(minutes=5)
51 et=bt+datetime.timedelta(minutes=30)
52 btime=bt.strftime("%Y-%m-%d %H:%M:%S")
53 etime=et.strftime("%Y-%m-%d %H:%M:%S")
55 recdb.rec_reckey(dbkey, title, chtxt, btime, etime, opts)
56 def searchRecQue(folderpath):
57 for file in glob.glob(os.path.join(folderpath,"*.recq")):
58 dtime = time.time()-os.path.getmtime(file)
62 readRecQue(os.path.join(folderpath, file))
63 os.remove(os.path.join(folderpath, file))
64 except Exception, inst:
65 recdblist.addCommonlogEX("Error", "searchRecQue(recque.py)", str(type(inst)), str(inst)+traceback.format_exc(),log_level=200)