OSDN Git Service

fix bug.
[rec10/rec10-git.git] / rec10 / trunk / src / tv2avi.py
index da2d077..6ca0afb 100644 (file)
@@ -61,35 +61,20 @@ def b252ts(pout, chtxt, btime, etime, opt):
             pentaaudio = 1
         if re.search("d", opt):
             dualaudio = 1
-        if re.search("\[二\]", pout):
+        if re.search(u"\[二\]", pout):
             dualaudio = 1
-        elif re.search('(二)', pout):
+        elif re.search(u'(二)', pout):
             dualaudio = 1
-        elif re.search('\(二\)', pout):
+        elif re.search(u'\(二\)', pout):
             dualaudio = 1
-        if opt == "":
-            opts = ""
-            if chdb.chtxtsearch(chtxt)['bctype'] == 'cs':
-                opts = opts + "S2"
-                if chtxt == "disch":
-                    ""
-                elif chtxt == "hisch":
-                    ""
-                else:
-                    opts = opts + "a"
-            else:
-                opts = opts + "Ha2"
-        else:
-            opts = opt
         if dualaudio == 1:
             dualaudiots2avi(aviin, tsout + ".sa.avi")
-            aviin = tsout + ".sa.avi"
         if pentaaudio == 1:
             dualaudiots2avi(aviin, tsout + ".sa.avi")
-            aviin = tsout + ".sa.avi"
-    except:
-        ""
-    #status.setB25Decoding(status.getB25Decoding()-1)
+    except Exception, inst:
+        print "Error happend in b252ts in tv2avi"
+        print type(inst)
+        print inst
     status.changeB25Decoding(-1)
 def timetv2avi(pout, chtxt, btime, etime, opt):
     bt = datetime.datetime.strptime(btime, "%Y-%m-%d %H:%M:%S")
@@ -144,8 +129,10 @@ def ts2avi(pin, pout, opt):
     #status.setEncoding(status.getEncoding() + 1)
     try:
         ts2x264.ts2x264(pin, pout, opt)
-    except:
-        ""
+    except Exception, inst:
+        print "error occures in tv2avi.py tv2avi"
+        print type(inst)
+        print inst
     status.changeEncoding(-1)
     #status.setEncoding(status.getEncoding()-1)
 def tv2avi(pout, chtxt, btime, etime, opt):
@@ -238,13 +225,13 @@ def dualaudiots2avi(pin, pout):
     #recdblist.printutf8(exe)
     exe = xvfb + ' -a ' + exe
     recdblist.printutf8(exe)
-    os.system(exe)
+    os.system(exe.encode('utf-8'))
     ffpin1 = pin.replace("ts", "wav")
     ffpin2 = pin.replace("ts", "m2v")
     exe = "ffmpeg -y  -i \'" + ffpin1 + "\' -i \'" + ffpin2 + "\' -r 29.97 -vsync 200 -vcodec copy -acodec libmp3lame -async 200 -ab 128k -f avi  \'" + pout + "\'"
     recdblist.printutf8(exe)
     #commands.getoutput(exe)
-    os.system(exe)
+    os.system(exe.encode('utf-8'))
     os.remove(ffpin1)
     os.remove(ffpin2)
 def dualaudio2sep(pin, pout, delay):