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")
17 optt=opts.replace("E","")
18 optt=optt.replace("D","")
19 optt=optt.replace("R","")
20 str="99"+","+datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")+","+configreader.getenv("iff")+","+chtxt+","+title+","+optt
21 f.write(str.encode('utf-8'))
24 def readRecQue(recquepath):
25 f=open(os.path.join(parentpath,title+".recq"),"r")
26 line = unicode(f.readline(),'utf-8')
36 chtxt=linec[2]+u"_"+linec[3]
38 line = unicode(f.readline(),'utf-8')
42 opts=opts.replace("E","")
44 dbkey=recdblist.REC_ENCODE_QUE
45 opts=opts.replace("D","")
47 dbkey=recdblist.REC_TS_DECODE_QUE
48 opts=opts.replace("E","")
49 bt=datetime.datetime.now()+datetime.timedelta(minutes=5)
50 et=bt+datetime.timedelta(minutes=30)
51 btime=bt.strftime("%Y-%m-%d %H:%M:%S")
52 etime=et.strftime("%Y-%m-%d %H:%M:%S")
54 recdb.rec_reckey(dbkey, title, chtxt, btime, etime, opts)
55 def searchRecQue(folderpath):
56 for file in glob.glob(os.path.join(folderpath,"*.recq")):
57 dtime = time.time()-os.path.getmtime(avipath)
61 readRecQue(os.path.join(folderpath, file))
62 os.remove(os.path.join(folderpath, file))
63 except Exception, inst:
64 recdblist.Commonlogex("Error", "searchRecQue(recque.py)", str(type(inst)), str(inst)+traceback.format_exc(),log_level=200)