OSDN Git Service

fix ch,csch not number problem.
[rec10/rec10-git.git] / rec10 / trunk / src / tv2ts.py
index 85ddc8e..8e2c7e7 100644 (file)
@@ -11,30 +11,32 @@ import configreader
 import status
 import recdblist
 mypath = str(os.path.dirname(os.path.abspath(__file__))) + "/"
-def tv2tsmix(pout, ch, time):
+def tv2tsmix(pout, ch, time,getlog=0):
     tv2b25ts(pout + ".b25", ch, time)
-    b252tsmix(pout + ".b25", pout)
+    txt=b252tsmix(pout + ".b25", pout)
+    return txt
     #if os.access(pout, os.F_OK):
     #    try:
     #        os.remove(pout + ".b25")
     #    except:
     #        ""
 def tv2ts(pout, ch, csch, time):
-    ext = os.path.splitext(pout)[1]#ext=".なんたら"
-    tempt = os.path.split(pout)
-    path = tempt[0]
-    if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
-        status.changeBSCSRecording(1)
-    else:
-        status.changeTERecording(1)
-    try:
-        tv2b25ts(pout + ".b25", ch, time)
-    except Exception, inst:
-        recdblist.addCommonlogEX(u"Error",u"tv2ts(tv2ts.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
-    if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
-        status.changeBSCSRecording(-1)
+    if ch.replace(" ","").isdigit():
+        if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
+            status.changeBSCSRecording(1)
+        else:
+            status.changeTERecording(1)
+        try:
+            tv2b25ts(pout + ".b25", ch, time)
+        except Exception, inst:
+            recdblist.addCommonlogEX(u"Error",u"tv2ts(tv2ts.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
+        if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
+            status.changeBSCSRecording(-1)
+        else:
+            status.changeTERecording(-1)
     else:
-        status.changeTERecording(-1)
+         ch="0"
+         csch="0"
     b252tsmix(pout + ".b25", pout + ".tsmix")
     tch="0"
     if csch!=u"0":
@@ -53,28 +55,20 @@ def tv2ts(pout, ch, csch, time):
         except:
             ""
 def b252ts(pout, ch, csch):
-    ext = os.path.splitext(pout)[1]#ext=".なんたら"
-    tempt = os.path.split(pout)
-    path = tempt[0]
     b252tsmix(pout + ".b25", pout + ".tsmix")
     tch=u"0"
-    if csch!=u"0":
-        tch=csch
-    elif ch==u"101":
-        tch=u"101"
-    elif ch==u"102":
-        tch=u"102"
-    #else:
-    #    tch=ch
+    if ch.replace(" ","").isdigit():
+        if csch!=u"0":
+            tch=csch
+        elif ch==u"101":
+            tch=u"101"
+        elif ch==u"102":
+            tch=u"102"
+    else:
+        tch="0"
     tsmix2ts(pout + ".tsmix", pout, tch)
-    if os.access(pout, os.F_OK):
-        try:
-            #os.remove(path + "/" + t + ext)
-            ""
-        except:
-            ""
 def tv2b25ts(pout, ch, time):
-    exe = configreader.getPathSetting('recpt1')
+    exe = configreader.getConfPath('recpt1')
     if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
         status.changeBSCSRecording(1)
     else:
@@ -90,27 +84,24 @@ def tv2b25ts(pout, ch, time):
         status.changeBSCSRecording(-1)
     else:
         status.changeTERecording(-1)
-def tv2b25ts_b25(pout, ch, time):
-    exe = configreader.getPathSetting('recpt1')
-    doexe = exe + ' --b25 ' + ch + ' ' + time + ' \'' + pout + '\''
-    os.system(doexe)
 def b252tsmix(pin, pout):
     if not (os.path.exists(pout) and os.path.getsize(pin)>os.path.getsize(pout)*0.95 and os.path.getsize(pin)<os.path.getsize(pout)*1.05):
         exe=""
-        if configreader.getPathSetting('b25_remote')=="1":
+        if configreader.getConfPath('b25_remote')=="1":
             try:
-                exe = configreader.getPathSetting('b25_env')+" && "
+                exe = configreader.getConfPath('b25_env')+" && "
             except:
                 inst=u"b25_remoteがオンになっていますが、b25_envが設定されていないかコメントアウトされています。"
                 recdblist.addCommonlogEX(u"Error",u"b252tsmix(tv2ts.py)", "",inst)
-        exe = exe + "nice -n 17 " + configreader.getPathSetting('b25')
+        exe = exe + "nice -n 17 " + configreader.getConfPath('b25')
         doexe = exe + u' \"' + pin + u'\" \"' + pout + u'\"'
         recdblist.printutf8(doexe)
         txt = unicode(commands.getoutput(doexe.encode('utf-8')),'utf-8')
         recdblist.addLog(pin, doexe, u"b25ログ-コマンド")
         recdblist.addLog(pin, txt, u"b25ログ-詳細")
+        return txt
 def tsmix2ts(pin, pout, csch):#csch=0ならcsの処理をしない
-    doexe = configreader.getPathSetting("tssplitter") + " \""+ pin + "\" \""+ pout + "\" " + str(csch)
+    doexe = configreader.getConfPath("tssplitter") + " \""+ pin + "\" \""+ pout + "\" " + str(csch)
     doexe = "nice -n 18 " + doexe
     os.environ['LANG']="ja_JP.UTF-8"
     txt = unicode(commands.getoutput(doexe.encode('utf-8')),'utf-8')