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 txt=b252tsmix(pout + ".b25", pout)
18 #if os.access(pout, os.F_OK):
20 # os.remove(pout + ".b25")
23 def tv2ts(pout, ch, csch, time):
24 if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
25 status.changeBSCSRecording(1)
27 status.changeTERecording(1)
29 tv2b25ts(pout + ".b25", ch, time)
30 except Exception, inst:
31 recdblist.addCommonlogEX(u"Error",u"tv2ts(tv2ts.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
32 if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
33 status.changeBSCSRecording(-1)
35 status.changeTERecording(-1)
36 b252tsmix(pout + ".b25", pout + ".tsmix")
46 tsmix2ts(pout + ".tsmix", pout, tch)
47 if os.access(pout, os.F_OK):
49 #os.remove(path + "/" + t + ext)
53 def b252ts(pout, ch, csch):
54 b252tsmix(pout + ".b25", pout + ".tsmix")
62 tsmix2ts(pout + ".tsmix", pout, tch)
63 def tv2b25ts(pout, ch, time):
64 exe = configreader.getConfPath('recpt1')
65 if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
66 status.changeBSCSRecording(1)
68 status.changeTERecording(1)
70 doexe = exe + ' ' + ch + ' ' + time + ' \'' + pout + '\''
71 recdblist.printutf8(doexe)
72 recdblist.addLog(pout, doexe, u"recpt1ログ-コマンド")
73 recdblist.addLog(pout, unicode(commands.getoutput(doexe.encode('utf-8')),'utf-8'), u"recpt1ログ-詳細")
74 except Exception, inst:
75 recdblist.addCommonlogEX(u"Error",u"tv2b25ts(tv2ts.py)", str(type(inst)),str(inst))
76 if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
77 status.changeBSCSRecording(-1)
79 status.changeTERecording(-1)
80 def b252tsmix(pin, pout):
81 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):
83 if configreader.getConfPath('b25_remote')=="1":
85 exe = configreader.getConfPath('b25_env')+" && "
87 inst=u"b25_remoteがオンになっていますが、b25_envが設定されていないかコメントアウトされています。"
88 recdblist.addCommonlogEX(u"Error",u"b252tsmix(tv2ts.py)", "",inst)
89 exe = exe + "nice -n 17 " + configreader.getConfPath('b25')
90 doexe = exe + u' \"' + pin + u'\" \"' + pout + u'\"'
91 recdblist.printutf8(doexe)
92 txt = unicode(commands.getoutput(doexe.encode('utf-8')),'utf-8')
93 recdblist.addLog(pin, doexe, u"b25ログ-コマンド")
94 recdblist.addLog(pin, txt, u"b25ログ-詳細")
96 def tsmix2ts(pin, pout, csch):#csch=0ならcsの処理をしない
97 doexe = configreader.getConfPath("tssplitter") + " \""+ pin + "\" \""+ pout + "\" " + str(csch)
98 doexe = "nice -n 18 " + doexe
99 os.environ['LANG']="ja_JP.UTF-8"
100 txt = unicode(commands.getoutput(doexe.encode('utf-8')),'utf-8')
101 recdblist.addLog(pin, doexe, u"TsSplitログ-コマンド")
102 recdblist.addLog(pin, txt, u"TsSplitログ-詳細")
104 if os.access(pout, os.F_OK) and os.path.getsize(pout)>10*1000*1000: