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