3 #import sys # モジュール属性 argv を取得するため
15 #japanesenkf.overrideEncodings()
17 mypath=str(os.path.dirname(os.path.abspath(__file__)))+"/"
18 def tv2tsmix(pout,ch,time):
19 tv2b25ts(pout+".b25",ch,time)
20 b252tsmix(pout+".b25",pout)
21 #os.remove(pout+".b25")
22 if os.access(pout, os.F_OK):
24 os.remove(pout+".b25")
27 def tv2ts(pout,ch,csch,time):
31 #tv2tsmix(temp[0]+"mix."+temp[1],ch,time)
32 #tsmix2ts(temp[0]+"mix."+temp[1],pout,csch)
33 #os.remove(temp[0]+"mix."+temp[1])
35 #t=base64.b16encode(pout)
37 t=hashlib.md5(pout).hexdigest()
40 #t=str(random.randint(10000,90000))
41 tempt=os.path.split(pout)
43 tv2b25ts(pout+".b25",ch,time)
44 b252tsmix(pout+".b25",path+"/"+t+"."+temp[1])
45 tsmix2ts(path+"/"+t+"."+temp[1],pout,csch)
46 #os.remove(path+"/"+t+"."+temp[1])
47 if os.access(pout, os.F_OK):
49 os.remove(path+"/"+t+"."+temp[1])
53 def b252ts(pout,ch,csch):
58 t=hashlib.md5(pout).hexdigest()
59 #t=base64.b16encode(pout)
61 #t=str(random.randint(10000,90000))
62 tempt=os.path.split(pout)
64 #tv2b25ts(pout+".b25",ch,time)
65 b252tsmix(pout+".b25",path+"/"+t+"."+temp[1])
66 tsmix2ts(path+"/"+t+"."+temp[1],pout,csch)
67 #os.remove(path+"/"+t+"."+temp[1])
68 if os.access(pout, os.F_OK):
70 os.remove(path+"/"+t+"."+temp[1])
74 def tv2b25ts(pout,ch,time):
75 exe=configreader.getpath('recpt1')
77 doexe=exe+' '+ch+' '+time+' \''+pout+'\''
80 def tv2b25ts_b25(pout,ch,time):
81 exe=configreader.getpath('recpt1')
83 doexe=exe+' --b25 '+ch+' '+time+' \''+pout+'\''
86 def b252tsmix(pin,pout):
88 exe=configreader.getpath('b25')
89 doexe=exe.encode('utf-8')+u' \''+pin.encode('utf-8')+u'\' \''+pout.encode('utf-8')+u'\''
91 doexe="/usr/bin/nice -n 17 "+doexe
92 txt=commands.getoutput(doexe)
96 def tsmix2ts(pin,pout,csch):#csch=0ならcsの処理をしない
97 wine=configreader.getpath('wine')
98 exe=configreader.getpath('splitt')
101 #mvexe="mv \'"+outpath+"\' \'"+pout+"\'"
104 #os.rename(outpath,pout)
106 shutil.move(pin.encode('utf-8'),pout.encode('utf-8'))
108 csopt='-CS'+str(csch)+" "
109 dirname=os.path.dirname(pin)
110 filename=os.path.basename(pin)
111 fn=os.path.splitext(filename)[0]
112 fileext=os.path.splitext(filename)[1]
113 outpath=dirname+"/"+fn+'_CS1('+str(csch)+')'+fileext
114 #print dirname+" : "+filename+" : "+fn+" : "+fileext
116 outpath=os.path.join(dirname,fn+'_CS1('+str(csch)+')'+fileext)
118 #doexe=wine+u' '+exe+u' -SD -1SEG -EIT '+csopt+u'-SEPA3 -OUT '+path+'/ '+pin
119 doexe=wine+u' '+exe+u' -SD -1SEG -EIT '+csopt+' -OUT '+path.encode('utf-8')+'/ '+pin.encode('utf-8')
120 doexe='xvfb-run -a -e xvfberror.txt '+doexe
121 doexe="/usr/bin/nice -n 18 "+doexe
126 shutil.move(outpath.encode('utf-8'),pout.encode('utf-8'))
130 if os.access(pout, os.F_OK):
131 os.remove(pin.encode('utf-8'))