OSDN Git Service

fix que counting bug.
authorgn64_jp <gn64_jp@4e526526-5e11-4fc0-8910-f8fd03428081>
Mon, 12 Oct 2009 23:55:11 +0000 (23:55 +0000)
committergn64_jp <gn64_jp@4e526526-5e11-4fc0-8910-f8fd03428081>
Mon, 12 Oct 2009 23:55:11 +0000 (23:55 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/rec10@178 4e526526-5e11-4fc0-8910-f8fd03428081

rec10/trunk/src/timerec.py

index 5f926c5..b6cb36f 100644 (file)
@@ -33,6 +33,8 @@ def task():
     print "inum:" + str(inum) + "bscsrec:" + str(status.getBSCSRecording()) + "terec:" + str(status.getTERecording()) 
 
     #if inum+status.getBSCSRecording()+status.getTERecording() < 2:
+    encodenum=0
+    b25num=0
     update = chdb.update()
     print update
     if len(update) > 0:
@@ -213,11 +215,14 @@ def task():
                     sys.exit()
         elif task["type"] == recdb.REC_TS_DECODE_QUE:
             if dt < 10 * 60:
-                if status.getB25Decoding() < 2:
-                    pid = os.fork()
-                    if pid != 0:#親プロセスの場合
-                        ""
-                    else:
+                b25num=b25num+1
+                pid = os.fork()
+                if pid != 0:#親プロセスの場合
+                    ""
+                else:
+                    if b25num>1:
+                        time.sleep(5*b25num)
+                    if status.getB25Decoding() < 2:
                         pin = recpath + "/" + title
                         recdb.del_reckey(recdb.REC_TS_DECODE_QUE, title, chtxt, btime)
                         recdb.rec_reckey(recdb.REC_TS_DECODING, title, chtxt, btime, etime, opt)
@@ -239,20 +244,24 @@ def task():
                         if checker.checkB25Decode(recpath + "/" + title + ".ts.b25", recpath + "/" + title + ".ts") == 1:
                             os.remove(recpath + "/" + title + ".ts.b25")
                         sys.exit()
-                else:
-                    recdb.del_reckey(recdb.REC_TS_DECODE_QUE, title, chtxt, btime)
-                    bt = bt + datetime.timedelta(seconds=600)
-                    et = et + datetime.timedelta(seconds=600)
-                    btime = bt.strftime("%Y-%m-%d %H:%M:%S")
-                    etime = et.strftime("%Y-%m-%d %H:%M:%S")
-                    recdb.rec_reckey(recdb.REC_TS_DECODE_QUE, title, chtxt, btime, etime, opt)
+                    else:
+                        recdb.del_reckey(recdb.REC_TS_DECODE_QUE, title, chtxt, btime)
+                        bt = bt + datetime.timedelta(seconds=600)
+                        et = et + datetime.timedelta(seconds=600)
+                        btime = bt.strftime("%Y-%m-%d %H:%M:%S")
+                        etime = et.strftime("%Y-%m-%d %H:%M:%S")
+                        recdb.rec_reckey(recdb.REC_TS_DECODE_QUE, title, chtxt, btime, etime, opt)
+                        sys.exit()
         elif task["type"] == recdb.REC_ENCODE_QUE:
             if dt < 10 * 60:
-                if status.getEncoding() < int(configreader.getenv("enc_max")):
-                    pid = os.fork()
-                    if pid > 0:#親プロセスの場合
-                        ""
-                    else:
+                encodenum=encodenum+1
+                pid = os.fork()
+                if pid > 0:#親プロセスの場合
+                    ""
+                else:
+                    if encodenum>1:
+                        time.sleep(5*encodenum)
+                    if status.getEncoding() < int(configreader.getenv("enc_max")):
                         print opt
                         pin = recpath + "/" + title + ".ts"
                         if re.search("d", opt):
@@ -271,11 +280,12 @@ def task():
                         recdb.del_reckey(recdb.REC_ENCODE_LOCAL, title, chtxt, btime)
                         recdb.rec_reckey(recdb.REC_FIN_LOCAL, title, chtxt, btime, etime, opt)
                         sys.exit()
-                else:
-                    recdb.del_reckey(recdb.REC_ENCODE_QUE, title, chtxt, btime)
-                    bt = bt + datetime.timedelta(seconds=600)
-                    et = et + datetime.timedelta(seconds=600)
-                    btime = bt.strftime("%Y-%m-%d %H:%M:%S")
-                    etime = et.strftime("%Y-%m-%d %H:%M:%S")
-                    recdb.rec_reckey(recdb.REC_ENCODE_QUE, title, chtxt, btime, etime, opt)
+                    else:
+                        recdb.del_reckey(recdb.REC_ENCODE_QUE, title, chtxt, btime)
+                        bt = bt + datetime.timedelta(seconds=600)
+                        et = et + datetime.timedelta(seconds=600)
+                        btime = bt.strftime("%Y-%m-%d %H:%M:%S")
+                        etime = et.strftime("%Y-%m-%d %H:%M:%S")
+                        recdb.rec_reckey(recdb.REC_ENCODE_QUE, title, chtxt, btime, etime, opt)
+                        sys.exit()
     sys.exit()
\ No newline at end of file