OSDN Git Service

add tsid channel information for complete BS support.
[rec10/rec10-git.git] / rec10 / trunk / src / timerec.py
index 9c25f24..fd5068f 100644 (file)
@@ -1,7 +1,7 @@
 #!/usr/bin/python
 # coding: UTF-8
 # Rec10 TS Recording Tools
-# Copyright (C) 2009-2011 Yukikaze
+# Copyright (C) 2009-2012 Yukikaze
 import datetime
 import os
 import os.path
@@ -43,11 +43,11 @@ def task():
             scan_ch.searchCh()
             rec10d.rec10db.change_installed_in_status(100)
         elif rec10d.rec10db.select_installed_in_status()==2:
-            recdblist.printuft8ex("Exit because CH scanning.", 200, 200)
+            recdblist.printutf8ex("Exit because CH scanning.", 200, 200)
             sys.exit(0)
     except Exception, inst:
         recdblist.addCommonlogEX("Error", "install_check(timerec.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
-        install.install()
+        #install.install()
     recdb.deleteOldProgramBeforeTheseHours("24")
     recdb.delete_old_auto_bayes("1")
     recdb.delete_old_auto_keyword("1")
@@ -227,10 +227,10 @@ def task():
                 if pid > 0:#親プロセスの場合
                     ""
                 else:
-                    makeMP4=0
+                    makeMP4=1
                     try:
-                        if configreader.getConfEnv("make_mp4")==1:
-                            makeMP4=1
+                        if configreader.getConfEnv("make_mp4")==0:
+                            makeMP4=0
                     except:
                         ""
                     if re.search("m", opt):
@@ -242,7 +242,9 @@ def task():
                     if makeMP4==1:
                         tv2mp4.raw2mp4(os.path.join(recpath,title+".264"),os.path.join(recpath,title+".mp4"),opt)
                     else:
-                        tv2mkv.raw2mkv(os.path.join(recpath,title+".264"),os.path.join(recpath,title+".mkv"),opt)
+                        tv2mp4.raw2mp4(os.path.join(recpath,title+".264"),os.path.join(recpath,title+".mp4"),opt)
+                        tv2mkv.mp42mkv(os.path.join(recpath,title+".mp4"), os.path.join(recpath,title+".mkv"))
+                        os.remove(os.path.join(recpath,title+".mp4"))
                     recdb.deleteReckey(recdblist.REC_CHANGING_CANTAINER, title, chtxt, btime)
                     sys.exit()
         elif task["type"] == recdblist.REC_AVI_TO_MP4:
@@ -300,6 +302,8 @@ def search_keyword(key):
                 #if status.getSettings_auto_jbk()==1:
                 if auto==1 or status.getSettings_auto_jbk()==1:
                     topt=opt
+                    if topt==None:
+                        topt=status.getSettings_auto_opt()
                     if len(topt)==0:
                         topt=status.getSettings_auto_opt()
                     try:
@@ -333,7 +337,7 @@ def type_reserve(typetxt,chtxt,title,bt,et,opt):
     if (dt < 58 * 60 and dt > 30 * 60):
         bctypet = chdb.searchCHFromChtxt(chtxt)['bctype']
         chdatat = rec10d.rec10db.select_by_bctype_epg_ch(bctypet)
-        dt1 = bt - datetime.datetime.strptime(chdatat[0][4], "%Y-%m-%d %H:%M:%S")
+        dt1 = bt - datetime.datetime.strptime(chdatat[0][5], "%Y-%m-%d %H:%M:%S")
         dt1 = dt1.days * 24 * 60 * 60 + dt1.seconds
         if dt1 < 60 * 60:
             recdata = epgdb.searchTime(title, btime, "5", chtxt)
@@ -361,7 +365,7 @@ def type_reserve(typetxt,chtxt,title,bt,et,opt):
             else:
                 recdblist.printutf8(u"追いかけ機能エラー:番組データが見付かりません。")
         else:
-            if rec10d.rec10db.select_by_bctype_epg_ch(bctypet)[0][5] != "0":
+            if rec10d.rec10db.select_by_bctype_epg_ch(bctypet)[0][6] != "0":
                 rec10d.rec10db.update_status_by_bctype_epg_ch(bctypet, "3")
         sys.exit()
     elif (dt <= 30 * 60 and dt > 20 * 60):
@@ -501,7 +505,7 @@ def type_keyword(typetxt,chtxt,title,bt,et,opt,deltatime):
         recdb.deleteReckey(typetxtnow, title, chtxt, btime)
         recdb.reserveReckey(typetxtres, title, chtxt, btime, etime, opt)
         recdblist.addCommonlogEX(u"エラー","timerec.py",u"nothing match","",log_level=200)
-        recdblist.addCommonlogEX(u"エラー","timerec.py",u"key "+title+u" : "+titlet+u" "+btimet+u" "+etimet,"",log_level=200)
+        recdblist.addCommonlogEX(u"エラー","timerec.py",u"key "+title+u" "+btime+u" "+etime,"",log_level=200)
 def type_keyword_every_day(type,chtxt,title,bt,et,opt,deltatime,deltaday,counter):
     btime = bt.strftime("%Y-%m-%d %H:%M:%S")
     etime = et.strftime("%Y-%m-%d %H:%M:%S")