3 #import sys # モジュール属性 argv を取得するため
13 #japanesenkf.overrideEncodings()
15 mypath=str(os.path.dirname(os.path.abspath(__file__)))+"/"
16 def tv2tsmix(pout,ch,time):
17 if len(ch)>2:#BS/CSは100とかCS??とかなので3文字以上
18 status.setBSCSRecording(status.getBSCSRecording()+1)
20 status.setTERecording(status.getTERecording()+1)
21 tv2b25ts(pout+".b25",ch,time)
22 if len(ch)>2:#BS/CSは100とかCS??とかなので3文字以上
23 status.setBSCSRecording(status.getBSCSRecording()-1)
25 status.setTERecording(status.getTERecording()-1)
27 b252tsmix(pout+".b25",pout)
28 #os.remove(pout+".b25")
29 if os.access(pout, os.F_OK):
31 os.remove(pout+".b25")
34 def tv2ts(pout,ch,csch,time):
35 ext=os.path.splitext(pout)[1]#ext=".なんたら"
36 t=hashlib.md5(pout).hexdigest()
37 tempt=os.path.split(pout)
39 if len(ch)>2:#BS/CSは100とかCS??とかなので3文字以上
40 status.setBSCSRecording(status.getBSCSRecording()+1)
42 status.setTERecording(status.getTERecording()+1)
43 tv2b25ts(pout+".b25",ch,time)
44 if len(ch)>2:#BS/CSは100とかCS??とかなので3文字以上
45 status.setBSCSRecording(status.getBSCSRecording()-1)
47 status.setTERecording(status.getTERecording()-1)
48 b252tsmix(pout+".b25",path+"/"+t+ext)
49 tsmix2ts(path+"/"+t+ext,pout,csch)
50 #os.remove(path+"/"+t+"."+temp[1])
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 t=hashlib.md5(pout).hexdigest()
60 tempt=os.path.split(pout)
62 b252tsmix(pout+".b25",path+"/"+t+ext)
63 tsmix2ts(path+"/"+t+ext,pout,csch)
64 if os.access(pout, os.F_OK):
66 os.remove(path+"/"+t+ext)
70 def tv2b25ts(pout,ch,time):
71 exe=configreader.getpath('recpt1')
72 doexe=exe+' '+ch+' '+time+' \''+pout+'\''
74 def tv2b25ts_b25(pout,ch,time):
75 exe=configreader.getpath('recpt1')
76 doexe=exe+' --b25 '+ch+' '+time+' \''+pout+'\''
78 def b252tsmix(pin,pout):
79 exe=configreader.getpath('b25')
80 doexe=exe.encode('utf-8')+u' \''+pin.encode('utf-8')+u'\' \''+pout.encode('utf-8')+u'\''
81 doexe="/usr/bin/nice -n 17 "+doexe
82 txt=commands.getoutput(doexe)
83 def tsmix2ts(pin,pout,csch):#csch=0ならcsの処理をしない
84 wine=configreader.getpath('wine')
85 exe=configreader.getpath('splitt')
88 shutil.move(pin.encode('utf-8'),pout.encode('utf-8'))
90 csopt='-CS'+str(csch)+" "
91 dirname=os.path.dirname(pin)
92 filename=os.path.basename(pin)
93 fn=os.path.splitext(filename)[0]
94 fileext=os.path.splitext(filename)[1]
95 outpath=dirname+"/"+fn+'_CS1('+str(csch)+')'+fileext
96 #print dirname+" : "+filename+" : "+fn+" : "+fileext
98 outpath=os.path.join(dirname,fn+'_CS1('+str(csch)+')'+fileext)
100 #doexe=wine+u' '+exe+u' -SD -1SEG -EIT '+csopt+u'-SEPA3 -OUT '+path+'/ '+pin
101 doexe=wine+u' '+exe+u' -SD -1SEG -EIT '+csopt+' -OUT '+path.encode('utf-8')+'/ '+pin.encode('utf-8')
102 doexe='xvfb-run -a -e xvfberror.txt '+doexe
103 doexe="/usr/bin/nice -n 18 "+doexe
108 shutil.move(outpath.encode('utf-8'),pout.encode('utf-8'))
112 if os.access(pout, os.F_OK):
113 os.remove(pin.encode('utf-8'))