3 # Rec10 TS Recording Tools
4 # Copyright (C) 2009-2011 Yukikaze
5 #import sys # モジュール属性 argv を取得するため
15 import recording_earth_pt1
16 mypath = str(os.path.dirname(os.path.abspath(__file__))) + "/"
17 def tv2tsmix(pout, ch, time,getlog=0):
18 tv2b25ts(pout + ".b25", ch, time)
19 txt=b252tsmix(pout + ".b25", pout)
21 #if os.access(pout, os.F_OK):
23 # os.remove(pout + ".b25")
26 def tv2ts(pout, ch, csch, time):
27 if ch.replace(" ","").replace("CS","").isdigit():
28 if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
29 status.changeBSCSRecording(1)
31 status.changeTERecording(1)
33 tv2b25ts(pout + ".b25", ch, time)
34 except Exception, inst:
35 recdblist.addCommonlogEX(u"Error",u"tv2ts(tv2ts.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
36 if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
37 status.changeBSCSRecording(-1)
39 status.changeTERecording(-1)
43 b252tsmix(pout + ".b25", pout + ".tsmix")
53 tsmix2ts(pout + ".tsmix", pout, tch)
54 if os.access(pout, os.F_OK):
56 #os.remove(path + "/" + t + ext)
60 def b252ts(pout, ch, csch):
61 b252tsmix(pout + ".b25", pout + ".tsmix")
63 if ch.replace(" ","").replace("CS","").isdigit():
72 tsmix2ts(pout + ".tsmix", pout, tch)
73 def tv2b25ts(pout, ch, time):
74 if recording_earth_pt1.useDVB()==0:
75 exe = configreader.getConfPath('recpt1')
76 if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
77 status.changeBSCSRecording(1)
79 status.changeTERecording(1)
81 doexe = exe + ' ' + ch + ' ' + time + ' \'' + pout + '\''
82 recdblist.printutf8(doexe)
83 recdblist.addLog(pout, doexe, u"recpt1ログ-コマンド")
84 recdblist.addLog(pout, unicode(commands.getoutput(doexe.encode('utf-8')),'utf-8'), u"recpt1ログ-詳細")
85 except Exception, inst:
86 recdblist.addCommonlogEX(u"Error",u"tv2b25ts(tv2ts.py)", str(type(inst)),str(inst))
87 if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
88 status.changeBSCSRecording(-1)
90 status.changeTERecording(-1)
91 elif recording_earth_pt1.useDVB()==1:
92 if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
93 status.changeBSCSRecording(1)
95 status.changeTERecording(1)
97 recording_earth_pt1.record(ch,"0",pout,time,0)
98 except Exception, inst:
99 recdblist.addCommonlogEX(u"Error",u"tv2b25ts(tv2ts.py)", str(type(inst)),str(inst))
100 if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
101 status.changeBSCSRecording(-1)
103 status.changeTERecording(-1)
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.getConfPath('b25_remote')=="1":
109 exe = configreader.getConfPath('b25_env')+" && "
111 inst=u"b25_remoteがオンになっていますが、b25_envが設定されていないかコメントアウトされています。"
112 recdblist.addCommonlogEX(u"Error",u"b252tsmix(tv2ts.py)", "",inst)
113 exe = exe + "nice -n 17 " + configreader.getConfPath('b25')
114 doexe = exe + u' \"' + pin + u'\" \"' + pout + u'\"'
115 recdblist.printutf8(doexe)
116 recdblist.addCommandSelfLog(pin,doexe)
117 txt = unicode(commands.getoutput(doexe.encode('utf-8')),'utf-8')
118 recdblist.addLog(pin, doexe, u"b25ログ-コマンド")
119 recdblist.addLog(pin, txt, u"b25ログ-詳細")
120 recdblist.addCommandLogZip(pin, "b25", "b25", doexe, txt)
122 def tsmix2ts(pin, pout, csch):#csch=0ならcsの処理をしない
123 tssplitterex=configreader.getConfPath("java")+" -jar "+configreader.getConfPath("jTsSplitter")
124 doexe =tssplitterex + " \""+ pin + "\" \""+ pout + "\" " + str(csch)
125 doexe = "nice -n 18 " + doexe
126 os.environ['LANG']="ja_JP.UTF-8"
127 txt = unicode(commands.getoutput(doexe.encode('utf-8')),'utf-8')
128 recdblist.addLog(pin, doexe, u"TsSplitログ-コマンド")
129 recdblist.addLog(pin, txt, u"TsSplitログ-詳細")
131 if os.access(pout, os.F_OK) and os.path.getsize(pout)>10*1000*1000: