3 #import sys # モジュール属性 argv を取得するため
11 mypath = str(os.path.dirname(os.path.abspath(__file__))) + "/"
12 def tv2tsmix(pout, ch, time):
13 tv2b25ts(pout + ".b25", ch, time)
14 b252tsmix(pout + ".b25", pout)
15 #if os.access(pout, os.F_OK):
17 # os.remove(pout + ".b25")
20 def tv2ts(pout, ch, csch, time):
21 ext = os.path.splitext(pout)[1]#ext=".なんたら"
22 tempt = os.path.split(pout)
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 print "error occures in tv2ts.py tv2ts"
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.getpath('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 txt=u"####recpt1-log####\n"
86 txt = txt + unicode(commands.getoutput(doexe.encode('utf-8')),'utf-8')
87 logo=pout.replace(".ts.b25",".log")
89 f.write(txt.encode('utf-8'))
91 except Exception, inst:
92 print "error occures in tv2ts.py tv2b25ts"
95 if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
96 status.changeBSCSRecording(-1)
98 status.changeTERecording(-1)
99 def tv2b25ts_b25(pout, ch, time):
100 exe = configreader.getpath('recpt1')
101 doexe = exe + ' --b25 ' + ch + ' ' + time + ' \'' + pout + '\''
103 def b252tsmix(pin, pout):
104 if not (os.path.exists(pout) and os.path.getsize(pin)==os.path.getsize(pout)):
106 if configreader.getpath('b25_remote')=="1":
108 exe = configreader.getpath('b25_env')+" && "
110 recdblist.printutf8(u"b25_remoteがオンになっていますが、b25_envが設定されていないかコメントアウトされています。")
111 exe = exe + "nice -n 17 " + configreader.getpath('b25')
112 doexe = exe + u' \"' + pin + u'\" \"' + pout + u'\"'
113 recdblist.printutf8(doexe)
114 logo=pin.replace(".ts.b25",".log")
115 txt = unicode(commands.getoutput(doexe.encode('utf-8')),'utf-8')
127 txt = "\n####b25-log####\n"+stxt
129 f.write(txt.encode('utf-8'))
131 def tsmix2ts(pin, pout, csch):#csch=0ならcsの処理をしない
133 shutil.move(pin,pout)
135 doexe = configreader.getpath("tssplitter") + " \""+ pin + "\" \""+ pout + "\" " + str(csch)
136 doexe = "nice -n 18 " + doexe
137 logo=pin.replace(".ts.tsmix",".log")
138 os.environ['LANG']="ja_JP.UTF-8"
139 txt = unicode(commands.getoutput(doexe.encode('utf-8')),'utf-8')
141 txt = "\n####tssplit-log####\nCommand:"+doexe+"\nlog:\n"+stxt
143 f.write(txt.encode('utf-8'))
146 if os.access(pout, os.F_OK):