# Copyright (C) 2009-2010 Yukikaze
import MySQLdb
import recdblist
+import warnings
+
from decimal import Decimal
class DB_MySQL:
dbname = ""
dbpasswd = ""
dbport = 0
def __init__(self, dbname, user, passwd, host="localhost", port=3306):
+ warnings.filterwarnings('ignore', "Data truncated for column")
self.dbname = dbname
self.dbhost = host
self.dbusr = user
db = self.connect_db()
for i,j in list.items():
retl=(i,chtxt,str(Decimal(j)/beforenumf),"0",beforenum,str(j),beforenum)
- db[1].execute("INSERT INTO in_auto_bayes_key (keychar,chtxt,ratio_rec,ratio_all) \
- VALUES (%s,%s,%s,%s)\
- ON DUPLICATE KEY UPDATE \
- ratio_rec=CONVERT((ratio_rec*%s+%s)/%s,DECIMAL(32,14))",retl)
+ try:
+ db[1].execute("INSERT INTO in_auto_bayes_key (keychar,chtxt,ratio_rec,ratio_all) \
+ VALUES (%s,%s,%s,%s)\
+ ON DUPLICATE KEY UPDATE \
+ ratio_rec=CONVERT((ratio_rec*%s+%s)/%s,DECIMAL(32,14))",retl)
+ except:
+ ""
self.close_db(db)
def select_by_key_in_auto_bayes_key(self,key,chtxt):
db = self.connect_db()
# Copyright (C) 2009-2010 Yukikaze
import os
+import warnings
+warnings.filterwarnings('ignore', "the sets module is deprecated")
import configreader
import dbMySQL
import timerec
isvfr=1
if re.search("a", opts):
is24fps=1
- if re.search("d",opts):
- encode_ffmpeg(pin, pout, size, dualpass)
if re.search("l",opts):
islight=1
+ if re.search("d",opts):
+ encode_ffmpeg(pin, pout, size, dualpass)
else:
encode(pin, pout,size,isvfr,dualpass,is24fps,islight)
def encode(pin,pout,size,isvfr,is2pass,is24fps,islight):
fps="-fps 30000/1001"
bm=1
scale=""
- x264enc1=":me=hex:bframes=3"
- x264enc2=":direct=auto:me=umh:bframes=3"
+ x264enc1=":me=dia:subme=4"
+ x264enc2=":frameref=3:subme=8:bframes=3"
crf=""
if is24fps==1:
ofps="-ofps 24000/1001"
crf="crf=22"
txt=""
if is2pass==1:
+ os.environ['LANG']="ja_JP.UTF-8"
exe1=ffmpeg+" -y -i \""+pin+"\" -pass 1 -vsync 400 -vcodec libx264 -b "+bitrate+"k "+vf1+s+"-deinterlace -an -passlogfile \'" + pin + ".log\' " + " /dev/null"
exe2=ffmpeg+" -y -i \""+pin+"\" -pass 2 -vsync 400 -vcodec libx264 -b "+bitrate+"k "+vf2+s+"-deinterlace -an -passlogfile \'" + pin + ".log\' \"" +pout+"\"" #aviにすべきかどうか
txt=txt+exe1+"\n"+exe2+"\m"
recdblist.printutf8(exe1)
- os.system(exe1)
- os.system(exe2)
+ os.system(exe1.encode('utf-8'))
+ os.system(exe2.encode('utf-8'))
else:
+ os.environ['LANG']="ja_JP.UTF-8"
exe=ffmpeg+" -y -i \""+pin+"\" -vsync 400 -vcodec libx264 -b "+bitrate+"k "+vf2+s+"-deinterlace -an \"" +pout+"\""
txt=txt+exe+"\n"
- os.system(exe)
+ os.system(exe.encode('utf-8'))
logo=pin
logo=logo.replace(".m2v",".ts")
logo=logo.replace(".ts",".log")
+import os.path
#!/usr/bin/python
# coding: UTF-8
# Rec10 TS Recording Tools
os.environ['LANG']="ja_JP.UTF-8"
neroaac=configreader.getpath('NeroAAC')
exe=neroaac+" -br 128000 -2pass -if \""+pin+"\" -of \""+pout+"\""
- os.system(exe.encode('utf-8'))
+ try:
+ os.system(exe.encode('utf-8'))
+ except:
+ if not os.path.exists(pout):
+ lame="lame"
+ exe=lame+" -b 128 \""+pin+"\" \""+pout+"\""
+ os.system(exe.encode('utf-8'))
def wav2mp3_lame(pin,pout):
os.environ['LANG']="ja_JP.UTF-8"
lame="lame"
pincap=pin.replace(".avi",".srt")
cap2ass=configreader.getpath("Caption2Ass")
pints=pin.replace(".avi",".ts")
+ pinaac=pin.replace(".avi",".aac")
e0=wineexe+u" "+cap2ass+u" -format srt \"Z:\\"+pints+"\" \"Z:\\"+pincap+"\""
- e1=exe + u" -o '" + pout + u"' --forced-track 0:no --forced-track 1:no -a 1 -d 0 -S '" + pin + u"' --track-order 0:0,0:1"
- e1s=exe + u" -o '" + pout + u"' --forced-track 0:no --forced-track 1:no -a 1 -d 0 -S '" + pin + u"' --forced-track 0:no -s 0 -A -D '"+pincap+"' --track-order 0:0,0:1,1:0"
+ e1="ffmpeg -i '"+pints+"' -vn -f aac -acodec copy '"+pinaac+"'"
+
+ e2=exe +" -o '"+pout+u"' --forced-track 0:no -d 0 -A -S '"+pin+"' --sync 0:0 --forced-track 0:no -a 0 -D -S '"+pinaac+"' --track-order 0:0,1:0"
+ e2s=exe +" -o '"+pout+u"' --forced-track 0:no -d 0 -A -S '"+pin+"' --sync 0:0 --forced-track 0:no -a 0 -D -S '"+pinaac+"' --forced-track 0:no -s 0 -D -A '"+pincap+"' --track-order 0:0,1:0,2:0"
+
+
+ #e2=exe + u" -o '" + pout + u"' --forced-track 0:no --forced-track 1:no -a 1 -d 0 -S '" + pin + u"' --track-order 0:0,0:1"
+ #e2s=exe + u" -o '" + pout + u"' --forced-track 0:no --forced-track 1:no -a 1 -d 0 -S '" + pin + u"' --forced-track 0:no -s 0 -A -D '"+pincap+"' --track-order 0:0,0:1,1:0"
txt=txt+execcomd(e0)
+ txt=txt+execcomd(e1)
if os.path.exists(pincap) and (os.path.getsize(pincap)>1000):
- txt=txt+execcomd(e1s)
+ txt=txt+execcomd(e2s)
else:
- txt=txt+execcomd(e1)
+ txt=txt+execcomd(e2)
logo=pout.replace(".mkv",".log")
if status.getSettings_auto_del_tmp()==1:
deltitle(dir,title)