OSDN Git Service

fix small bugs.
authorgn64_jp <gn64_jp@4e526526-5e11-4fc0-8910-f8fd03428081>
Sun, 17 Jan 2010 12:10:27 +0000 (12:10 +0000)
committergn64_jp <gn64_jp@4e526526-5e11-4fc0-8910-f8fd03428081>
Sun, 17 Jan 2010 12:10:27 +0000 (12:10 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/rec10@404 4e526526-5e11-4fc0-8910-f8fd03428081

rec10/trunk/src/dbMySQL.py
rec10/trunk/src/timerec.py
rec10/trunk/src/ts2x264.py
rec10/trunk/src/tv2audio.py

index 5c4e7c3..dbecbfc 100644 (file)
@@ -917,10 +917,13 @@ class DB_MySQL:
         db = self.connect_db()
         for i,j in list.items():
             retl=(i,chtxt,"0",str(Decimal(j)/beforenumf),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_all=CONVERT((ratio_all*%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_all=CONVERT((ratio_all*%s+%s)/%s,DECIMAL(32,14))",retl)
+            except:
+                ""
         self.close_db(db)
     def change_ratio_rec_reduce_in_auto_bayes_key(self,chtxt,beforenum,newnum):
         beforenum=str(beforenum)
index 405fee5..eee795a 100644 (file)
@@ -361,7 +361,10 @@ def type_final(typetxt,chtxt,title,bt,et,opt):
             etime = et.strftime("%Y-%m-%d %H:%M:%S")
             recdb.rec_reckey(typetxtdecque, newtitle, chtxt, btime, etime, opt)
         else:
-            shutil.copy(os.path.join(recpath,title+".ts.b25"), os.path.join(movepath,title+".ts.b25"))
+            try:
+                shutil.copy(os.path.join(recpath,title+".ts.b25"), os.path.join(movepath,title+".ts.b25"))
+            except:
+                ""
             recdb.rec_reckey(recdblist.REC_MOVE_END, newtitle, chtxt, btime, etime, opt)
         sys.exit()
 def type_keyword(typetxt,chtxt,title,bt,et,opt,deltatime):
@@ -465,7 +468,10 @@ def type_decode_que(typetxt,chtxt,title,bt,et,opt):
                 etime = et.strftime("%Y-%m-%d %H:%M:%S")
                 recdb.rec_reckey(typetxtencque, title, chtxt, btime, etime, opt)
             else:
-                shutil.copy(os.path.join(recpath,title+".ts"), os.path.join(movepath,title+".ts"))
+                try:
+                    shutil.copy(os.path.join(recpath,title+".ts"), os.path.join(movepath,title+".ts"))
+                except:
+                    ""
                 recdb.rec_reckey(recdblist.REC_MOVE_END, title, chtxt, btime, etime, opt)
             if checker.checkB25Decode(recpath + "/" + title + ".ts.b25", recpath + "/" + title + ".ts") == 1:
                 os.remove(recpath + "/" + title + ".ts.b25")
@@ -515,7 +521,10 @@ def type_encode_que(typetxt,chtxt,title,bt,et,opt):
             #tv2avi.ts2avi(pin, pout, opt)
             recdb.del_reckey(typetxting, title, chtxt, btime)
             if re.search("E", opt):
-                shutil.copy(os.path.join(recpath,title+".mp4"), os.path.join(movepath,title+".mp4"))
+                try:
+                    shutil.copy(os.path.join(recpath,title+".mp4"), os.path.join(movepath,title+".mp4"))
+                except:
+                    ""
                 recdb.rec_reckey(recdblist.REC_MOVE_END, title, chtxt, btime, etime, opt)
             recdb.rec_reckey(typetxtfin, title, chtxt, btime, etime, opt)
             sys.exit()
index 77ae4c4..4669914 100644 (file)
@@ -15,6 +15,7 @@ def ts2x264(pin, pout, opts):#sizeは"HD"か"SD"
     dualpass = 0
     isvfr=0
     is24fps=0
+    islight=0
     size="Tall"
     if re.search("2", opts):
         dualpass = 1
@@ -34,13 +35,15 @@ def ts2x264(pin, pout, opts):#sizeは"HD"か"SD"
         is24fps=1
     if re.search("d",opts):
         encode_ffmpeg(pin, pout, size, dualpass)
+    if re.search("l",opts):
+        islight=1
     else:
-        encode(pin, pout,size,isvfr,dualpass,is24fps)
-def encode(pin,pout,size,isvfr,is2pass,is24fps):
+        encode(pin, pout,size,isvfr,dualpass,is24fps,islight)
+def encode(pin,pout,size,isvfr,is2pass,is24fps,islight):
     encvf=""
     txt=""
-    encvf="-vf yadif=0,pp=ac,pp=mb"
-    harddup=",pp=ac,hqdn3d=2:1:2,harddup"
+    encvf="-vf yadif=0,pp=l5"
+    harddup=",hqdn3d=2:1:2,unsharp=l3x3:0.75:c3x3:0.75,harddup"
     ofps="-ofps 30000/1001"
     fps="-fps 30000/1001"
     bm=1
@@ -52,7 +55,7 @@ def encode(pin,pout,size,isvfr,is2pass,is24fps):
         ofps="-ofps 24000/1001"
         fps="-fps 30000/1001"
         encvf="-vf pullup,softskip"
-        harddup=",pp=ac,pp=l5,unsharp=l3x3:0.75:c3x3:0.75,hqdn3d=2:1:2,harddup"
+        harddup=",pp=l5,unsharp=l3x3:0.75:c3x3:0.75,hqdn3d=2:1:2,harddup"
         bm=1
         x264enc1=":me=hex:bframes=3"
         x264enc2=":frameref=6:subme=8:subq=7:trellis=2:aq-strength=0.6:deblock=1,1:psy-rd=0.4:partitions=all:8x8dct:direct_pred=auto:me=umh:bframes=3"
@@ -67,6 +70,9 @@ def encode(pin,pout,size,isvfr,is2pass,is24fps):
         bm=1
         x264enc1=":me=hex:bframes=3:cqm=jvt"
         x264enc2=":frameref=3:subme=8:subq=7:8x8dct:direct_pred=auto:me=umh:bframes=3:weight_b:cqm=jvt"
+    if islight==1:
+        x264enc1=":no8x8dct:b-adapt=0:bframes=0:no-cabac:no-deblock:me=dia:partitions=i8x8,i4x4:frameref=1:subme=1:trellis=0:scenecut=0"
+        x264enc2=":no8x8dct:b-adapt=0:bframes=0:no-cabac:no-deblock:me=dia:partitions=i8x8,i4x4:frameref=1:subme=1:trellis=0:scenecut=0"
     if size == "HD":
         encvf = encvf + ",scale=1280:720::0:4"+harddup
         bitrate = "bitrate=" + str(tv2avi.Bitrate_HD*bm)
@@ -93,7 +99,7 @@ def encode(pin,pout,size,isvfr,is2pass,is24fps):
         crf="crf=22"
     if is2pass == 1:
         pas1exe = "mencoder \'" + pin + "\' -vfm ffmpeg -quiet -nosound -sws 9 -ovc x264 " + encvf +" "+fps+" "+ofps+" -x264encopts " + bitrate +x264enc1+ ":threads=auto:level_idc=42:pass=1:turbo=2 -passlogfile \'" + pin + ".log\' " + " -o /dev/null"
-        pas2exe = "mencoder \'" + pin + "\' -vfm ffmpeg -quiet -sws 9 -ovc x264 " + encvf +" "+fps+ " "+ofps+" -x264encopts " + bitrate +x264enc2+ ":level_idc=42:threads=auto:pass=2 -passlogfile \'" + pin + ".log\' -oac faac -o \'" + pout + "\'"
+        pas2exe = "mencoder \'" + pin + "\' -vfm ffmpeg -quiet -sws 9 -ovc x264 " + encvf +" "+fps+ " "+ofps+" -x264encopts " + bitrate +x264enc2+ ":level_idc=42:threads=auto:pass=2 -passlogfile \'" + pin + ".log\' -oac mp3lame -lameopts cbr:br=256 -o \'" + pout + "\'"
         pas1exe = "nice -n 19 " + pas1exe
         pas2exe = "nice -n 19 " + pas2exe
         recdblist.printutf8(pas1exe)
@@ -102,7 +108,7 @@ def encode(pin,pout,size,isvfr,is2pass,is24fps):
         time.sleep(5)
         txt=txt+unicode(commands.getoutput(pas2exe.encode('utf-8')),'utf-8')
     else:
-        pas1exe = "mencoder \'" + pin + "\' -vfm ffmpeg -quiet -sws 9 -ovc x264 " + encvf+" "+fps + " "+ofps+" -x264encopts " + bitrate +x264enc2+":level_idc=42:threads=auto -oac faac -o \'" + pout + "\'"
+        pas1exe = "mencoder \'" + pin + "\' -vfm ffmpeg -quiet -sws 9 -ovc x264 " + encvf+" "+fps + " "+ofps+" -x264encopts " + bitrate +x264enc2+":level_idc=42:threads=auto -oac mp3lame -lameopts cbr:br=256 -o \'" + pout + "\'"
         pas1exe = "nice -n 19 " + pas1exe
         recdblist.printutf8(pas1exe)
         txt=txt+unicode(commands.getoutput(pas1exe.encode('utf-8')),'utf-8')
index 6e178ef..fd78248 100644 (file)
@@ -6,10 +6,12 @@ import os
 import configreader
 
 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)
 def wav2mp3_lame(pin,pout):
+    os.environ['LANG']="ja_JP.UTF-8"
     lame="lame"
     exe=lame+" -b 128 \""+pin+"\" \""+pout+"\""
     os.system(exe)
\ No newline at end of file