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 ext=os.path.splitext(pout)[1]#ext=".なんたら"
36 #t=base64.b16encode(pout)
38 t=hashlib.md5(pout).hexdigest()
41 #t=str(random.randint(10000,90000))
42 tempt=os.path.split(pout)
44 tv2b25ts(pout+".b25",ch,time)
45 b252tsmix(pout+".b25",path+"/"+t+ext)
46 tsmix2ts(path+"/"+t+ext,pout,csch)
47 #os.remove(path+"/"+t+"."+temp[1])
48 if os.access(pout, os.F_OK):
50 os.remove(path+"/"+t+ext)
54 def b252ts(pout,ch,csch):
56 ext=os.path.splitext(pout)[1]#ext=".なんたら"
60 t=hashlib.md5(pout).hexdigest()
61 #t=base64.b16encode(pout)
63 #t=str(random.randint(10000,90000))
64 tempt=os.path.split(pout)
66 #tv2b25ts(pout+".b25",ch,time)
67 b252tsmix(pout+".b25",path+"/"+t+ext)
68 tsmix2ts(path+"/"+t+ext,pout,csch)
69 #os.remove(path+"/"+t+"."+temp[1])
70 if os.access(pout, os.F_OK):
72 os.remove(path+"/"+t+ext)
76 def tv2b25ts(pout,ch,time):
77 exe=configreader.getpath('recpt1')
79 doexe=exe+' '+ch+' '+time+' \''+pout+'\''
82 def tv2b25ts_b25(pout,ch,time):
83 exe=configreader.getpath('recpt1')
85 doexe=exe+' --b25 '+ch+' '+time+' \''+pout+'\''
88 def b252tsmix(pin,pout):
90 exe=configreader.getpath('b25')
91 doexe=exe.encode('utf-8')+u' \''+pin.encode('utf-8')+u'\' \''+pout.encode('utf-8')+u'\''
93 doexe="/usr/bin/nice -n 17 "+doexe
94 txt=commands.getoutput(doexe)
98 def tsmix2ts(pin,pout,csch):#csch=0ならcsの処理をしない
99 wine=configreader.getpath('wine')
100 exe=configreader.getpath('splitt')
103 #mvexe="mv \'"+outpath+"\' \'"+pout+"\'"
106 #os.rename(outpath,pout)
108 shutil.move(pin.encode('utf-8'),pout.encode('utf-8'))
110 csopt='-CS'+str(csch)+" "
111 dirname=os.path.dirname(pin)
112 filename=os.path.basename(pin)
113 fn=os.path.splitext(filename)[0]
114 fileext=os.path.splitext(filename)[1]
115 outpath=dirname+"/"+fn+'_CS1('+str(csch)+')'+fileext
116 #print dirname+" : "+filename+" : "+fn+" : "+fileext
118 outpath=os.path.join(dirname,fn+'_CS1('+str(csch)+')'+fileext)
120 #doexe=wine+u' '+exe+u' -SD -1SEG -EIT '+csopt+u'-SEPA3 -OUT '+path+'/ '+pin
121 doexe=wine+u' '+exe+u' -SD -1SEG -EIT '+csopt+' -OUT '+path.encode('utf-8')+'/ '+pin.encode('utf-8')
122 doexe='xvfb-run -a -e xvfberror.txt '+doexe
123 doexe="/usr/bin/nice -n 18 "+doexe
128 shutil.move(outpath.encode('utf-8'),pout.encode('utf-8'))
132 if os.access(pout, os.F_OK):
133 os.remove(pin.encode('utf-8'))