OSDN Git Service

not to show db error.
authorgn64_jp <gn64_jp@4e526526-5e11-4fc0-8910-f8fd03428081>
Wed, 20 Jan 2010 15:21:29 +0000 (15:21 +0000)
committergn64_jp <gn64_jp@4e526526-5e11-4fc0-8910-f8fd03428081>
Wed, 20 Jan 2010 15:21:29 +0000 (15:21 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/rec10@406 4e526526-5e11-4fc0-8910-f8fd03428081

rec10/trunk/src/dbMySQL.py
rec10/trunk/src/rec10d.py
rec10/trunk/src/ts2x264.py
rec10/trunk/src/tv2audio.py
rec10/trunk/src/tv2mkv.py

index dbecbfc..8c977ab 100644 (file)
@@ -4,6 +4,8 @@
 # Copyright (C) 2009-2010 Yukikaze
 import MySQLdb
 import recdblist
+import warnings
+
 from decimal import Decimal
 class DB_MySQL:
     dbname = ""
@@ -12,6 +14,7 @@ class DB_MySQL:
     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
@@ -948,10 +951,13 @@ class DB_MySQL:
         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()
index ab32b80..2e33b23 100644 (file)
@@ -4,6 +4,8 @@
 # Copyright (C) 2009-2010 Yukikaze
 import os
 
+import warnings
+warnings.filterwarnings('ignore', "the sets module is deprecated")
 import configreader
 import dbMySQL
 import timerec
index 4669914..5e9f35e 100644 (file)
@@ -33,10 +33,10 @@ def ts2x264(pin, pout, opts):#sizeは"HD"か"SD"
         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):
@@ -48,8 +48,8 @@ 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"
@@ -167,16 +167,18 @@ def encode_ffmpeg(pin,pout,size,is2pass):
         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")
index 92fdf36..c59a335 100644 (file)
@@ -1,3 +1,4 @@
+import os.path
 #!/usr/bin/python
 # coding: UTF-8
 # Rec10 TS Recording Tools
@@ -9,7 +10,13 @@ def wav2aac_nero(pin,pout):
     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"
index 810a2b8..390e5bd 100644 (file)
@@ -80,14 +80,22 @@ def avi2mkv(pin,pout,opt):
         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)