3 #import sys # モジュール属性 argv を取得するため
12 mypath = str(os.path.dirname(os.path.abspath(__file__))) + "/"
13 def tv2tsmix(pout, ch, time):
14 tv2b25ts(pout + ".b25", ch, time)
15 b252tsmix(pout + ".b25", pout)
16 #if os.access(pout, os.F_OK):
18 # os.remove(pout + ".b25")
21 def tv2ts(pout, ch, csch, time):
22 ext = os.path.splitext(pout)[1]#ext=".なんたら"
23 tempt = os.path.split(pout)
25 if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
26 status.changeBSCSRecording(1)
28 status.changeTERecording(1)
30 tv2b25ts(pout + ".b25", ch, time)
31 except Exception, inst:
32 print "error occures in tv2ts.py tv2ts"
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.getpath('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 txt=u"####recpt1-log####\n"
87 txt = txt + unicode(commands.getoutput(doexe.encode('utf-8')),'utf-8')
88 logo=pout.replace(".ts.b25",".log")
90 f.write(txt.encode('utf-8'))
92 except Exception, inst:
93 print "error occures in tv2ts.py tv2b25ts"
96 if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
97 status.changeBSCSRecording(-1)
99 status.changeTERecording(-1)
100 def tv2b25ts_b25(pout, ch, time):
101 exe = configreader.getpath('recpt1')
102 doexe = exe + ' --b25 ' + ch + ' ' + time + ' \'' + pout + '\''
104 def b252tsmix(pin, pout):
105 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):
107 if configreader.getpath('b25_remote')=="1":
109 exe = configreader.getpath('b25_env')+" && "
111 recdblist.printutf8(u"b25_remoteがオンになっていますが、b25_envが設定されていないかコメントアウトされています。")
112 exe = exe + "nice -n 17 " + configreader.getpath('b25')
113 doexe = exe + u' \"' + pin + u'\" \"' + pout + u'\"'
114 recdblist.printutf8(doexe)
115 logo=pin.replace(".ts.b25",".log")
116 txt = unicode(commands.getoutput(doexe.encode('utf-8')),'utf-8')
128 txt = "\n####b25-log####\n"+stxt
130 f.write(txt.encode('utf-8'))
132 def tsmix2ts(pin, pout, csch):#csch=0ならcsの処理をしない
134 shutil.move(pin,pout)
136 doexe = configreader.getpath("tssplitter") + " \""+ pin + "\" \""+ pout + "\" " + str(csch)
137 doexe = "nice -n 18 " + doexe
138 logo=pin.replace(".ts.tsmix",".log")
139 os.environ['LANG']="ja_JP.UTF-8"
140 txt = unicode(commands.getoutput(doexe.encode('utf-8')),'utf-8')
142 txt = "\n####tssplit-log####\nCommand:"+doexe+"\nlog:\n"+stxt
144 f.write(txt.encode('utf-8'))
147 if os.access(pout, os.F_OK) and os.path.getsize(pout)>10*1000*1000: