From: gn64_jp Date: Sat, 30 Oct 2010 06:14:06 +0000 (+0000) Subject: implement recque system. X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=b4781bf61a35bd66083e0972dad66cbc82159d43;p=rec10%2Frec10-git.git implement recque system. git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/rec10@716 4e526526-5e11-4fc0-8910-f8fd03428081 --- diff --git a/rec10/trunk/src/recque.py b/rec10/trunk/src/recque.py index 898077c..1fe095c 100644 --- a/rec10/trunk/src/recque.py +++ b/rec10/trunk/src/recque.py @@ -22,40 +22,39 @@ def writeRecQue(parentpath,chtxt,title,opts): f.close() def readRecQue(recquepath): - if int(time.time()-os.path.getmtime(recquepath))>300: - f=open(recquepath,"r") + f=open(recquepath,"r") + line = unicode(f.readline(),'utf-8') + title="" + opts="" + chtxt="" + while line: + linec=line.split(",") + if len(linec)>3: + if linec[0]=="99": + title=linec[4] + opts=linec[5] + chtxt=linec[2]+u"_"+linec[3] + break line = unicode(f.readline(),'utf-8') - title="" - opts="" - chtxt="" - while line: - linec=line.split(",") - if len(linec)>3: - if linec[0]=="99": - title=linec[4] - opts=linec[5] - chtxt=linec[2]+u"_"+linec[3] - break - line = unicode(f.readline(),'utf-8') + dbkey="" + if opts.find("E"): dbkey="" - if opts.find("E"): - dbkey="" - opts=opts.replace("E","") - if opts.find("D"): - dbkey=recdblist.REC_ENCODE_QUE - opts=opts.replace("D","") - if opts.find("R"): - dbkey=recdblist.REC_TS_DECODE_QUE - opts=opts.replace("E","") - bt=datetime.datetime.now()+datetime.timedelta(minutes=5) - et=bt+datetime.timedelta(minutes=30) - btime=bt.strftime("%Y-%m-%d %H:%M:%S") - etime=et.strftime("%Y-%m-%d %H:%M:%S") - if len(dbkey)>2: - recdb.rec_reckey(dbkey, title, chtxt, btime, etime, opts) + opts=opts.replace("E","") + if opts.find("D"): + dbkey=recdblist.REC_ENCODE_QUE + opts=opts.replace("D","") + if opts.find("R"): + dbkey=recdblist.REC_TS_DECODE_QUE + opts=opts.replace("E","") + bt=datetime.datetime.now()+datetime.timedelta(minutes=5) + et=bt+datetime.timedelta(minutes=30) + btime=bt.strftime("%Y-%m-%d %H:%M:%S") + etime=et.strftime("%Y-%m-%d %H:%M:%S") + if len(dbkey)>2: + recdb.rec_reckey(dbkey, title, chtxt, btime, etime, opts) def searchRecQue(folderpath): for file in glob.glob(os.path.join(folderpath,"*.recq")): - dtime = time.time()-os.path.getmtime(avipath) + dtime = time.time()-os.path.getmtime(file) dtime = int(dtime) if dtime > 300: try: