3 # Rec10 TS Recording Tools
4 # Copyright (C) 2009-2011 Yukikaze
5 #import sys # モジュール属性 argv を取得するため
15 mypath = str(os.path.dirname(os.path.abspath(__file__))) + "/"
16 def tv2tsmix(pout, ch, time,getlog=0):
17 tv2b25ts(pout + ".b25", ch, time)
18 txt=b252tsmix(pout + ".b25", pout)
20 #if os.access(pout, os.F_OK):
22 # os.remove(pout + ".b25")
25 def tv2ts(pout, ch, csch, time):
26 if ch.replace(" ","").replace("CS","").isdigit():
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)
42 b252tsmix(pout + ".b25", pout + ".tsmix")
52 tsmix2ts(pout + ".tsmix", pout, tch)
53 if os.access(pout, os.F_OK):
55 #os.remove(path + "/" + t + ext)
59 def b252ts(pout, ch, csch):
60 b252tsmix(pout + ".b25", pout + ".tsmix")
62 if ch.replace(" ","").replace("CS","").isdigit():
71 tsmix2ts(pout + ".tsmix", pout, tch)
72 def tv2b25ts(pout, ch, time):
73 exe = configreader.getConfPath('recpt1')
74 if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
75 status.changeBSCSRecording(1)
77 status.changeTERecording(1)
79 doexe = exe + ' ' + ch + ' ' + time + ' \'' + pout + '\''
80 recdblist.printutf8(doexe)
81 recdblist.addLog(pout, doexe, u"recpt1ログ-コマンド")
82 recdblist.addLog(pout, unicode(commands.getoutput(doexe.encode('utf-8')),'utf-8'), u"recpt1ログ-詳細")
83 except Exception, inst:
84 recdblist.addCommonlogEX(u"Error",u"tv2b25ts(tv2ts.py)", str(type(inst)),str(inst))
85 if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
86 status.changeBSCSRecording(-1)
88 status.changeTERecording(-1)
89 def b252tsmix(pin, pout):
90 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):
92 if configreader.getConfPath('b25_remote')=="1":
94 exe = configreader.getConfPath('b25_env')+" && "
96 inst=u"b25_remoteがオンになっていますが、b25_envが設定されていないかコメントアウトされています。"
97 recdblist.addCommonlogEX(u"Error",u"b252tsmix(tv2ts.py)", "",inst)
98 exe = exe + "nice -n 17 " + configreader.getConfPath('b25')
99 doexe = exe + u' \"' + pin + u'\" \"' + pout + u'\"'
100 recdblist.printutf8(doexe)
101 recdblist.addCommandSelfLog(pin,doexe)
102 txt = unicode(commands.getoutput(doexe.encode('utf-8')),'utf-8')
103 recdblist.addLog(pin, doexe, u"b25ログ-コマンド")
104 recdblist.addLog(pin, txt, u"b25ログ-詳細")
105 recdblist.addCommandLogZip(pin, "b25", "b25", doexe, txt)
107 def tsmix2ts(pin, pout, csch):#csch=0ならcsの処理をしない
108 tssplitterex=configreader.getConfPath("java")+" -jar "+configreader.getConfPath("jTsSplitter")
109 doexe =tssplitterex + " \""+ pin + "\" \""+ pout + "\" " + str(csch)
110 doexe = "nice -n 18 " + doexe
111 os.environ['LANG']="ja_JP.UTF-8"
112 txt = unicode(commands.getoutput(doexe.encode('utf-8')),'utf-8')
113 recdblist.addLog(pin, doexe, u"TsSplitログ-コマンド")
114 recdblist.addLog(pin, txt, u"TsSplitログ-詳細")
116 if os.access(pout, os.F_OK) and os.path.getsize(pout)>10*1000*1000: