OSDN Git Service

fix rename miss.
[rec10/rec10-git.git] / rec10 / trunk / src / recque.py
index 77125f1..0471326 100644 (file)
@@ -1,66 +1,66 @@
-#!/usr/bin/python
-# coding: UTF-8
-# Rec10 TS Recording Tools
-# Copyright (C) 2009-2010 Yukikaze
-import datetime
-import os
-import os.path
-import glob
-import time
-import traceback
-
-import configreader
-import recdblist
-import recdb
-def writeRecQue(parentpath,chtxt,title,opts):
-    f=open(os.path.join(parentpath,title+".recq"),"w")
-    optt=opts
-    #optt=opts.replace("E","")
-    #optt=optt.replace("D","")
-    #optt=optt.replace("R","")
-    str="99"+","+datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")+","+configreader.getEnvSetting("iff")+","+chtxt+","+title+","+optt
-    f.write(str.encode('utf-8'))
-    f.close()
-
-def readRecQue(recquepath):
-    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')
-    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("R","")
-    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(file)
-        dtime = int(dtime)
-        if dtime > 300:
-            try:
-                readRecQue(os.path.join(folderpath, file))
-                os.remove(os.path.join(folderpath, file))
-            except Exception, inst:
-                recdblist.addCommonlogEX("Error", "searchRecQue(recque.py)", str(type(inst)), str(inst)+traceback.format_exc(),log_level=200)
-                
\ No newline at end of file
+#!/usr/bin/python\r
+# coding: UTF-8\r
+# Rec10 TS Recording Tools\r
+# Copyright (C) 2009-2010 Yukikaze\r
+import datetime\r
+import os\r
+import os.path\r
+import glob\r
+import time\r
+import traceback\r
+\r
+import configreader\r
+import recdblist\r
+import recdb\r
+def writeRecQue(parentpath,chtxt,title,opts):\r
+    f=open(os.path.join(parentpath,title+".recq"),"w")\r
+    optt=opts\r
+    #optt=opts.replace("E","")\r
+    #optt=optt.replace("D","")\r
+    #optt=optt.replace("R","")\r
+    str="99"+","+datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")+","+configreader.getConfEnv("iff")+","+chtxt+","+title+","+optt\r
+    f.write(str.encode('utf-8'))\r
+    f.close()\r
+\r
+def readRecQue(recquepath):\r
+    f=open(recquepath,"r")\r
+    line = unicode(f.readline(),'utf-8')\r
+    title=""\r
+    opts=""\r
+    chtxt=""\r
+    while line:\r
+        linec=line.split(",")\r
+        if len(linec)>3:\r
+            if linec[0]=="99":\r
+                title=linec[4]\r
+                opts=linec[5]\r
+                chtxt=linec[2]+u"_"+linec[3]\r
+                break\r
+        line = unicode(f.readline(),'utf-8')\r
+    dbkey=""\r
+    if opts.find("E"):\r
+        dbkey=""\r
+        opts=opts.replace("E","")\r
+    if opts.find("D"):\r
+        dbkey=recdblist.REC_ENCODE_QUE\r
+        opts=opts.replace("D","")\r
+    if opts.find("R"):\r
+        dbkey=recdblist.REC_TS_DECODE_QUE\r
+        opts=opts.replace("R","")\r
+    bt=datetime.datetime.now()+datetime.timedelta(minutes=5)\r
+    et=bt+datetime.timedelta(minutes=30)\r
+    btime=bt.strftime("%Y-%m-%d %H:%M:%S")\r
+    etime=et.strftime("%Y-%m-%d %H:%M:%S")\r
+    if len(dbkey)>2:\r
+        recdb.reserveReckey(dbkey, title, chtxt, btime, etime, opts)\r
+def searchRecQue(folderpath):\r
+    for file in glob.glob(os.path.join(folderpath,"*.recq")):\r
+        dtime = time.time()-os.path.getmtime(file)\r
+        dtime = int(dtime)\r
+        if dtime > 300:\r
+            try:\r
+                readRecQue(os.path.join(folderpath, file))\r
+                os.remove(os.path.join(folderpath, file))\r
+            except Exception, inst:\r
+                recdblist.addCommonlogEX("Error", "searchRecQue(recque.py)", str(type(inst)), str(inst)+traceback.format_exc(),log_level=200)\r
+                \r