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 ext = os.path.splitext(pout)[1]#ext=".なんたら"
25 tempt = os.path.split(pout)
27 if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
28 status.changeBSCSRecording(1)
30 status.changeTERecording(1)
32 tv2b25ts(pout + ".b25", ch, time)
33 except Exception, inst:
34 recdblist.addCommonlogEX(u"Error",u"tv2ts(tv2ts.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
35 if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
36 status.changeBSCSRecording(-1)
38 status.changeTERecording(-1)
39 b252tsmix(pout + ".b25", pout + ".tsmix")
49 tsmix2ts(pout + ".tsmix", pout, tch)
50 if os.access(pout, os.F_OK):
52 #os.remove(path + "/" + t + ext)
56 def b252ts(pout, ch, csch):
57 ext = os.path.splitext(pout)[1]#ext=".なんたら"
58 tempt = os.path.split(pout)
60 b252tsmix(pout + ".b25", pout + ".tsmix")
70 tsmix2ts(pout + ".tsmix", pout, tch)
71 if os.access(pout, os.F_OK):
73 #os.remove(path + "/" + t + ext)
77 def tv2b25ts(pout, ch, time):
78 exe = configreader.getConfPath('recpt1')
79 if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
80 status.changeBSCSRecording(1)
82 status.changeTERecording(1)
84 doexe = exe + ' ' + ch + ' ' + time + ' \'' + pout + '\''
85 recdblist.printutf8(doexe)
86 recdblist.addLog(pout, doexe, u"recpt1ログ-コマンド")
87 recdblist.addLog(pout, unicode(commands.getoutput(doexe.encode('utf-8')),'utf-8'), u"recpt1ログ-詳細")
88 except Exception, inst:
89 recdblist.addCommonlogEX(u"Error",u"tv2b25ts(tv2ts.py)", str(type(inst)),str(inst))
90 if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
91 status.changeBSCSRecording(-1)
93 status.changeTERecording(-1)
94 def tv2b25ts_b25(pout, ch, time):
95 exe = configreader.getConfPath('recpt1')
96 doexe = exe + ' --b25 ' + ch + ' ' + time + ' \'' + pout + '\''
98 def b252tsmix(pin, pout):
99 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):
101 if configreader.getConfPath('b25_remote')=="1":
103 exe = configreader.getConfPath('b25_env')+" && "
105 inst=u"b25_remoteがオンになっていますが、b25_envが設定されていないかコメントアウトされています。"
106 recdblist.addCommonlogEX(u"Error",u"b252tsmix(tv2ts.py)", "",inst)
107 exe = exe + "nice -n 17 " + configreader.getConfPath('b25')
108 doexe = exe + u' \"' + pin + u'\" \"' + pout + u'\"'
109 recdblist.printutf8(doexe)
110 txt = unicode(commands.getoutput(doexe.encode('utf-8')),'utf-8')
111 recdblist.addLog(pin, doexe, u"b25ログ-コマンド")
112 recdblist.addLog(pin, txt, u"b25ログ-詳細")
114 def tsmix2ts(pin, pout, csch):#csch=0ならcsの処理をしない
115 doexe = configreader.getConfPath("tssplitter") + " \""+ pin + "\" \""+ pout + "\" " + str(csch)
116 doexe = "nice -n 18 " + doexe
117 os.environ['LANG']="ja_JP.UTF-8"
118 txt = unicode(commands.getoutput(doexe.encode('utf-8')),'utf-8')
119 recdblist.addLog(pin, doexe, u"TsSplitログ-コマンド")
120 recdblist.addLog(pin, txt, u"TsSplitログ-詳細")
122 if os.access(pout, os.F_OK) and os.path.getsize(pout)>10*1000*1000: