3 #import sys # モジュール属性 argv を取得するため
13 #japanesenkf.overrideEncodings()
15 mypath=str(os.path.dirname(os.path.abspath(__file__)))+"/"
16 def tv2tsmix(pout,ch,time):
17 tv2b25ts(pout+".b25",ch,time)
18 b252tsmix(pout+".b25",pout)
19 #os.remove(pout+".b25")
20 if os.access(pout, os.F_OK):
22 os.remove(pout+".b25")
25 def tv2ts(pout,ch,csch,time):
29 #tv2tsmix(temp[0]+"mix."+temp[1],ch,time)
30 #tsmix2ts(temp[0]+"mix."+temp[1],pout,csch)
31 #os.remove(temp[0]+"mix."+temp[1])
33 t=base64.b16encode(pout)
34 #t=str(random.randint(10000,90000))
35 tempt=os.path.split(pout)
37 tv2b25ts(pout+".b25",ch,time)
38 b252tsmix(pout+".b25",path+"/"+t+"."+temp[1])
39 tsmix2ts(path+"/"+t+"."+temp[1],pout,csch)
40 #os.remove(path+"/"+t+"."+temp[1])
41 if os.access(pout, os.F_OK):
43 os.remove(path+"/"+t+"."+temp[1])
47 def b252ts(pout,ch,csch):
49 t=base64.b16encode(pout)
50 #t=str(random.randint(10000,90000))
51 tempt=os.path.split(pout)
53 #tv2b25ts(pout+".b25",ch,time)
54 b252tsmix(pout+".b25",path+"/"+t+"."+temp[1])
55 tsmix2ts(path+"/"+t+"."+temp[1],pout,csch)
56 #os.remove(path+"/"+t+"."+temp[1])
57 if os.access(pout, os.F_OK):
59 os.remove(path+"/"+t+"."+temp[1])
63 def tv2b25ts(pout,ch,time):
64 exe=configreader.getpath('recpt1')
66 doexe=exe+' '+ch+' '+time+' \''+pout+'\''
69 def tv2b25ts_b25(pout,ch,time):
70 exe=configreader.getpath('recpt1')
72 doexe=exe+' --b25 '+ch+' '+time+' \''+pout+'\''
75 def b252tsmix(pin,pout):
77 exe=configreader.getpath('b25')
78 doexe=exe.encode('utf-8')+u' \''+pin.encode('utf-8')+u'\' \''+pout.encode('utf-8')+u'\''
80 doexe="/usr/bin/nice -n 17 "+doexe
83 def tsmix2ts(pin,pout,csch):#csch=0ならcsの処理をしない
84 wine=configreader.getpath('wine')
85 exe=configreader.getpath('splitt')
88 #mvexe="mv \'"+outpath+"\' \'"+pout+"\'"
91 #os.rename(outpath,pout)
93 shutil.move(pin.encode('utf-8'),pout.encode('utf-8'))
95 csopt='-CS'+str(csch)+" "
96 dirname=os.path.dirname(pin)
97 filename=os.path.basename(pin)
98 fn=os.path.splitext(filename)[0]
99 fileext=os.path.splitext(filename)[1]
100 outpath=dirname+"/"+fn+'_CS1('+str(csch)+')'+fileext
101 #print dirname+" : "+filename+" : "+fn+" : "+fileext
103 outpath=os.path.join(dirname,fn+'_CS1('+str(csch)+')'+fileext)
105 #doexe=wine+u' '+exe+u' -SD -1SEG -EIT '+csopt+u'-SEPA3 -OUT '+path+'/ '+pin
106 doexe=wine+u' '+exe+u' -SD -1SEG -EIT '+csopt+' -OUT '+path.encode('utf-8')+'/ '+pin.encode('utf-8')
107 doexe='xvfb-run -a -e xvfberror.txt '+doexe
108 doexe="/usr/bin/nice -n 18 "+doexe
113 shutil.move(outpath.encode('utf-8'),pout.encode('utf-8'))
117 if os.access(pout, os.F_OK):
118 os.remove(pin.encode('utf-8'))