3 #import sys # モジュール属性 argv を取得するため
13 mypath = str(os.path.dirname(os.path.abspath(__file__))) + "/"
14 def tv2tsmix(pout, ch, time):
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 print "error occures in tv2ts.py tv2ts"
36 if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
37 status.changeBSCSRecording(-1)
39 status.changeTERecording(-1)
40 b252tsmix(pout + ".b25", pout + ".tsmix")
50 tsmix2ts(pout + ".tsmix", pout, tch)
51 if os.access(pout, os.F_OK):
53 #os.remove(path + "/" + t + ext)
57 def b252ts(pout, ch, csch):
58 ext = os.path.splitext(pout)[1]#ext=".なんたら"
59 tempt = os.path.split(pout)
61 b252tsmix(pout + ".b25", pout + ".tsmix")
71 tsmix2ts(pout + ".tsmix", pout, tch)
72 if os.access(pout, os.F_OK):
74 #os.remove(path + "/" + t + ext)
78 def tv2b25ts(pout, ch, time):
79 exe = configreader.getpath('recpt1')
80 if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
81 status.changeBSCSRecording(1)
83 status.changeTERecording(1)
85 doexe = exe + ' ' + ch + ' ' + time + ' \'' + pout + '\''
86 recdblist.printutf8(doexe)
87 txt=u"####recpt1-log####\n"
88 txt = txt + unicode(commands.getoutput(doexe.encode('utf-8')),'utf-8')
89 logo=pout.replace(".ts.b25",".log")
91 f.write(txt.encode('utf-8'))
93 except Exception, inst:
94 print "error occures in tv2ts.py tv2b25ts"
97 if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
98 status.changeBSCSRecording(-1)
100 status.changeTERecording(-1)
101 def tv2b25ts_b25(pout, ch, time):
102 exe = configreader.getpath('recpt1')
103 doexe = exe + ' --b25 ' + ch + ' ' + time + ' \'' + pout + '\''
105 def b252tsmix(pin, pout):
106 if not (os.path.exists(pout) and os.path.getsize(pin)==os.path.getsize(pout)):
108 if configreader.getpath('b25_remote')=="1":
110 exe = configreader.getpath('b25_env')+" && "
112 recdblist.printutf8(u"b25_remoteがオンになっていますが、b25_envが設定されていないかコメントアウトされています。")
113 exe = exe + "nice -n 17 " + configreader.getpath('b25')
114 doexe = exe + u' \"' + pin + u'\" \"' + pout + u'\"'
115 recdblist.printutf8(doexe)
116 logo=pin.replace(".ts.b25",".log")
117 txt = unicode(commands.getoutput(doexe.encode('utf-8')),'utf-8')
129 txt = "\n####b25-log####\n"+stxt
131 f.write(txt.encode('utf-8'))
133 def tsmix2ts(pin, pout, csch):#csch=0ならcsの処理をしない
135 shutil.move(pin,pout)
137 doexe = configreader.getpath("tssplitter") + " \""+ pin + "\" \""+ pout + "\" " + str(csch)
138 doexe = "nice -n 18 " + doexe
139 logo=pin.replace(".ts.tsmix",".log")
140 os.environ['LANG']="ja_JP.UTF-8"
141 txt = unicode(commands.getoutput(doexe.encode('utf-8')),'utf-8')
143 txt = "\n####tssplit-log####\nCommand:"+doexe+"\nlog:\n"+stxt
145 f.write(txt.encode('utf-8'))
148 if os.access(pout, os.F_OK):