3 #import sys # モジュール属性 argv を取得するため
13 mypath = str(os.path.dirname(os.path.abspath(__file__))) + "/"
14 def tv2tsmix(pout, ch, time,getlog=0):
15 tv2b25ts(pout + ".b25", ch, time)
16 b252tsmix(pout + ".b25", pout)
17 #if os.access(pout, os.F_OK):
19 # os.remove(pout + ".b25")
22 def tv2ts(pout, ch, csch, time):
23 ext = os.path.splitext(pout)[1]#ext=".なんたら"
24 tempt = os.path.split(pout)
26 if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
27 status.changeBSCSRecording(1)
29 status.changeTERecording(1)
31 tv2b25ts(pout + ".b25", ch, time)
32 except Exception, inst:
33 recdblist.addCommonlogEX(u"Error",u"tv2ts(tv2ts.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
34 if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
35 status.changeBSCSRecording(-1)
37 status.changeTERecording(-1)
38 b252tsmix(pout + ".b25", pout + ".tsmix")
48 tsmix2ts(pout + ".tsmix", pout, tch)
49 if os.access(pout, os.F_OK):
51 #os.remove(path + "/" + t + ext)
55 def b252ts(pout, ch, csch):
56 ext = os.path.splitext(pout)[1]#ext=".なんたら"
57 tempt = os.path.split(pout)
59 b252tsmix(pout + ".b25", pout + ".tsmix")
69 tsmix2ts(pout + ".tsmix", pout, tch)
70 if os.access(pout, os.F_OK):
72 #os.remove(path + "/" + t + ext)
76 def tv2b25ts(pout, ch, time):
77 exe = configreader.getConfPath('recpt1')
78 if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
79 status.changeBSCSRecording(1)
81 status.changeTERecording(1)
83 doexe = exe + ' ' + ch + ' ' + time + ' \'' + pout + '\''
84 recdblist.printutf8(doexe)
85 recdblist.addLog(pout, doexe, u"recpt1ログ-コマンド")
86 recdblist.addLog(pout, unicode(commands.getoutput(doexe.encode('utf-8')),'utf-8'), u"recpt1ログ-詳細")
87 except Exception, inst:
88 recdblist.addCommonlogEX(u"Error",u"tv2b25ts(tv2ts.py)", str(type(inst)),str(inst))
89 if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
90 status.changeBSCSRecording(-1)
92 status.changeTERecording(-1)
93 def tv2b25ts_b25(pout, ch, time):
94 exe = configreader.getConfPath('recpt1')
95 doexe = exe + ' --b25 ' + ch + ' ' + time + ' \'' + pout + '\''
97 def b252tsmix(pin, pout):
98 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):
100 if configreader.getConfPath('b25_remote')=="1":
102 exe = configreader.getConfPath('b25_env')+" && "
104 inst=u"b25_remoteがオンになっていますが、b25_envが設定されていないかコメントアウトされています。"
105 recdblist.addCommonlogEX(u"Error",u"b252tsmix(tv2ts.py)", "",inst)
106 exe = exe + "nice -n 17 " + configreader.getConfPath('b25')
107 doexe = exe + u' \"' + pin + u'\" \"' + pout + u'\"'
108 recdblist.printutf8(doexe)
109 txt = unicode(commands.getoutput(doexe.encode('utf-8')),'utf-8')
110 recdblist.addLog(pin, doexe, u"b25ログ-コマンド")
111 recdblist.addLog(pin, txt, u"b25ログ-詳細")
113 def tsmix2ts(pin, pout, csch):#csch=0ならcsの処理をしない
114 doexe = configreader.getConfPath("tssplitter") + " \""+ pin + "\" \""+ pout + "\" " + str(csch)
115 doexe = "nice -n 18 " + doexe
116 os.environ['LANG']="ja_JP.UTF-8"
117 txt = unicode(commands.getoutput(doexe.encode('utf-8')),'utf-8')
118 recdblist.addLog(pin, doexe, u"TsSplitログ-コマンド")
119 recdblist.addLog(pin, txt, u"TsSplitログ-詳細")
121 if os.access(pout, os.F_OK) and os.path.getsize(pout)>10*1000*1000: