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 recdblist.printutf8("error occures in tv2ts.py tv2ts")
33 recdblist.printutf8(str(type(inst)))
34 recdblist.printutf8(str(inst))
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 recdblist.addlog(pout, unicode(commands.getoutput(doexe.encode('utf-8')),'utf-8'), u"recpt1-log")
87 except Exception, inst:
88 recdblist.printutf8("error occures in tv2ts.py tv2b25ts")
89 recdblist.printutf8(str(type(inst)))
90 recdblist.printutf8(str(inst))
91 if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
92 status.changeBSCSRecording(-1)
94 status.changeTERecording(-1)
95 def tv2b25ts_b25(pout, ch, time):
96 exe = configreader.getpath('recpt1')
97 doexe = exe + ' --b25 ' + ch + ' ' + time + ' \'' + pout + '\''
99 def b252tsmix(pin, pout):
100 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):
102 if configreader.getpath('b25_remote')=="1":
104 exe = configreader.getpath('b25_env')+" && "
106 recdblist.printutf8(u"b25_remoteがオンになっていますが、b25_envが設定されていないかコメントアウトされています。")
107 exe = exe + "nice -n 17 " + configreader.getpath('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, txt, u"b25-log")
112 def tsmix2ts(pin, pout, csch):#csch=0ならcsの処理をしない
114 shutil.move(pin,pout)
116 doexe = configreader.getpath("tssplitter") + " \""+ pin + "\" \""+ pout + "\" " + str(csch)
117 doexe = "nice -n 18 " + doexe
118 os.environ['LANG']="ja_JP.UTF-8"
119 txt = unicode(commands.getoutput(doexe.encode('utf-8')),'utf-8')
120 txt = doexe+"\n\n"+txt
121 recdblist.addlog(pin, txt, "tssplit-log")
123 if os.access(pout, os.F_OK) and os.path.getsize(pout)>10*1000*1000: