3 #import sys # モジュール属性 argv を取得するため
14 #japanesenkf.overrideEncodings()
16 mypath=str(os.path.dirname(os.path.abspath(__file__)))+"/"
17 def tv2tsmix(pout,ch,time):
18 tv2b25ts(pout+".b25",ch,time)
19 b252tsmix(pout+".b25",pout)
20 #os.remove(pout+".b25")
21 if os.access(pout, os.F_OK):
23 os.remove(pout+".b25")
26 def tv2ts(pout,ch,csch,time):
30 #tv2tsmix(temp[0]+"mix."+temp[1],ch,time)
31 #tsmix2ts(temp[0]+"mix."+temp[1],pout,csch)
32 #os.remove(temp[0]+"mix."+temp[1])
34 #t=base64.b16encode(pout)
36 t=hashlib.md5(pout).hexdigest()
39 #t=str(random.randint(10000,90000))
40 tempt=os.path.split(pout)
42 tv2b25ts(pout+".b25",ch,time)
43 b252tsmix(pout+".b25",path+"/"+t+"."+temp[1])
44 tsmix2ts(path+"/"+t+"."+temp[1],pout,csch)
45 #os.remove(path+"/"+t+"."+temp[1])
46 if os.access(pout, os.F_OK):
48 os.remove(path+"/"+t+"."+temp[1])
52 def b252ts(pout,ch,csch):
57 t=hashlib.md5(pout).hexdigest()
58 #t=base64.b16encode(pout)
60 #t=str(random.randint(10000,90000))
61 tempt=os.path.split(pout)
63 #tv2b25ts(pout+".b25",ch,time)
64 b252tsmix(pout+".b25",path+"/"+t+"."+temp[1])
65 tsmix2ts(path+"/"+t+"."+temp[1],pout,csch)
66 #os.remove(path+"/"+t+"."+temp[1])
67 if os.access(pout, os.F_OK):
69 os.remove(path+"/"+t+"."+temp[1])
73 def tv2b25ts(pout,ch,time):
74 exe=configreader.getpath('recpt1')
76 doexe=exe+' '+ch+' '+time+' \''+pout+'\''
79 def tv2b25ts_b25(pout,ch,time):
80 exe=configreader.getpath('recpt1')
82 doexe=exe+' --b25 '+ch+' '+time+' \''+pout+'\''
85 def b252tsmix(pin,pout):
87 exe=configreader.getpath('b25')
88 doexe=exe.encode('utf-8')+u' \''+pin.encode('utf-8')+u'\' \''+pout.encode('utf-8')+u'\''
90 doexe="/usr/bin/nice -n 17 "+doexe
93 def tsmix2ts(pin,pout,csch):#csch=0ならcsの処理をしない
94 wine=configreader.getpath('wine')
95 exe=configreader.getpath('splitt')
98 #mvexe="mv \'"+outpath+"\' \'"+pout+"\'"
101 #os.rename(outpath,pout)
103 shutil.move(pin.encode('utf-8'),pout.encode('utf-8'))
105 csopt='-CS'+str(csch)+" "
106 dirname=os.path.dirname(pin)
107 filename=os.path.basename(pin)
108 fn=os.path.splitext(filename)[0]
109 fileext=os.path.splitext(filename)[1]
110 outpath=dirname+"/"+fn+'_CS1('+str(csch)+')'+fileext
111 #print dirname+" : "+filename+" : "+fn+" : "+fileext
113 outpath=os.path.join(dirname,fn+'_CS1('+str(csch)+')'+fileext)
115 #doexe=wine+u' '+exe+u' -SD -1SEG -EIT '+csopt+u'-SEPA3 -OUT '+path+'/ '+pin
116 doexe=wine+u' '+exe+u' -SD -1SEG -EIT '+csopt+' -OUT '+path.encode('utf-8')+'/ '+pin.encode('utf-8')
117 doexe='xvfb-run -a -e xvfberror.txt '+doexe
118 doexe="/usr/bin/nice -n 18 "+doexe
123 shutil.move(outpath.encode('utf-8'),pout.encode('utf-8'))
127 if os.access(pout, os.F_OK):
128 os.remove(pin.encode('utf-8'))