OSDN Git Service

stop using trunk directory in rectool
[rec10/rec10-git.git] / rec10 / trunk / src / tv2ts.py
index f69551d..bb87965 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 sys # モジュール属性 argv を取得するため
 import commands
 import os
@@ -14,8 +14,8 @@ import status
 import recdblist
 import recording_earth_pt1
 mypath = str(os.path.dirname(os.path.abspath(__file__))) + "/"
-def tv2tsmix(pout, ch, time,getlog=0):
-    tv2b25ts(pout + ".b25", ch, time)
+def tv2tsmix(pout, ch, time,tsid="0",getlog=0):
+    tv2b25ts(pout + ".b25", ch, time,tsid)
     txt=b252tsmix(pout + ".b25", pout)
     return txt
     #if os.access(pout, os.F_OK):
@@ -23,14 +23,14 @@ def tv2tsmix(pout, ch, time,getlog=0):
     #        os.remove(pout + ".b25")
     #    except:
     #        ""
-def tv2ts(pout, ch, csch, time):
+def tv2ts(pout, ch, csch, time,tsid):
     if ch.replace(" ","").replace("CS","").isdigit():
         if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
             status.changeBSCSRecording(1)
         else:
             status.changeTERecording(1)
         try:
-            tv2b25ts(pout + ".b25", ch, time)
+            tv2b25ts(pout + ".b25", ch, time,tsid)
         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文字以上
@@ -70,7 +70,7 @@ def b252ts(pout, ch, csch):
     else:
         tch="0"
     tsmix2ts(pout + ".tsmix", pout, tch)
-def tv2b25ts(pout, ch, time):
+def tv2b25ts(pout, ch, time,tsid):
     if recording_earth_pt1.useDVB()==0:
         exe = configreader.getConfPath('recpt1')
         if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
@@ -94,14 +94,18 @@ def tv2b25ts(pout, ch, time):
         else:
             status.changeTERecording(1)
         try:
-            recording_earth_pt1.record(ch,"0",pout,time,0)
+            recording_earth_pt1.record(ch,tsid,pout,time,0)
         except Exception, inst:
             recdblist.addCommonlogEX(u"Error",u"tv2b25ts(tv2ts.py)", str(type(inst)),str(inst))
         if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
             status.changeBSCSRecording(-1)
         else:
             status.changeTERecording(-1)
-    os.chmod(pout,0755)
+    if os.path.exists(pout):
+        try:
+            os.chmod(pout,0755)
+        except:
+            ""
 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=""