OSDN Git Service

enable 5.1ch audio demux
authorgn64_jp <gn64_jp@4e526526-5e11-4fc0-8910-f8fd03428081>
Sun, 31 May 2009 06:25:02 +0000 (06:25 +0000)
committergn64_jp <gn64_jp@4e526526-5e11-4fc0-8910-f8fd03428081>
Sun, 31 May 2009 06:25:02 +0000 (06:25 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/rec10@28 4e526526-5e11-4fc0-8910-f8fd03428081

rec10/trunk/src/rec10gridserver.py
rec10/trunk/src/timerec.py
rec10/trunk/src/tv2avi.py

index 0feef5d..fc6ade0 100755 (executable)
@@ -31,7 +31,7 @@ def getTask():
             btime=task['btime']
             etime=task['etime']
             chtxt=task['chtxt']
-            recdb.del_reckey("ts2avi", title, chtxt, btime)
+            #recdb.del_reckey("ts2avi", title, chtxt, btime)
             recdb.rec_reckey("grid", title, chtxt, btime, etime, opt)
             rett="title="+title+","+"opt="+opt+";"
             break
index e73d2df..823161d 100644 (file)
@@ -154,7 +154,8 @@ def task():
             #print "dt="+str(dt)
             if dt<6*60*60:
                 recdb.dellastrec(title,chtxt,btime)
-                recdb.recend(title,chtxt,btime,etime,opt)
+                #recdb.recend(title,chtxt,btime,etime,opt)
+                recdb.rec_reckey("tsfin", title, chtxt, btime, etime, opt)
                 print "録画開始"
                 pid=os.fork()
                 if pid>0:#親プロセスの場合
@@ -163,8 +164,8 @@ def task():
                     #print title
                     tv2avi.timetv2avi(recpath+"/"+title+".avi",chtxt,btime,etime,opt)
                     if not os.access(recpath+"/"+title+".ts", os.F_OK):
-                        recdb.delend(title,chtxt,btime)
-                        recdb.misrecwrite(title,chtxt,btime,etime,opt)
+                        recdb.del_reckey("tsfin", title, chtxt, btime)
+                        recdb.rec_reckey("tsmiss", title, chtxt, btime, etime, opt)
                     sys.exit(0)
         elif task["type"]=="b25-avi":
             title=task['title']
@@ -202,10 +203,14 @@ def task():
                         pin=recpath+"/"+title+".ts"
                         if re.search("d",opt):
                             pin=recpath+"/"+title+"sa.avi"
+                        if re.search("5",opt):
+                            pin=recpath+"/"+title+"sa.avi"
                         pout=recpath+"/"+title+".avi"
                         print pin+":"+pout+":"+opt
-                        ts2x264.ts2x264(pin, pout, opt)
                         recdb.del_reckey("ts2avi",title,chtxt,btime)
+                        recdb.rec_reckey("local", title, chtxt, btime, etime, opt)
+                        ts2x264.ts2x264(pin, pout, opt)
+                        
                         #tv2avi.timetv2avi(recpath+"/"+title+".avi",chtxt,btime,etime,opt)
                         sys.exit(0)
                 else:
index ac62b95..56f6af2 100644 (file)
@@ -31,6 +31,9 @@ def timetv2avi(pout, chtxt, btime, etime,opt):
     tv2ts.tv2ts(tsout + ".ts", chdb.chtxtsearch(chtxt)['ch'], chdb.chtxtsearch(chtxt)['csch'], rectime)
     aviin = tsout + ".ts"
     dualaudio = 0
+    pentaaudio = 0
+    if re.search("5",opt):
+        pentaaudio = 1
     if re.search("d",opt):
         dualaudio = 1
     if re.search("\[二\]", pout):
@@ -57,9 +60,13 @@ def timetv2avi(pout, chtxt, btime, etime,opt):
         makexvid = 0
     else:
         makexvid = 1
-    """if dualaudio == 1:
+    if dualaudio == 1:
+        dualaudiots2avi(aviin, tsout + "sa.avi")
+        aviin = tsout + "sa.avi"
+    if pentaaudio ==1:
         dualaudiots2avi(aviin, tsout + "sa.avi")
         aviin = tsout + "sa.avi"
+    """
     if makexvid==1:
         ts2xvid.ts2xvid(aviin, pout,opts)
     else:
@@ -89,6 +96,9 @@ def tv2avi(pout, chtxt, btime, etime,opt):
     tv2ts.tv2ts(tsout + ".ts", chdb.chtxtsearch(chtxt)['ch'], chdb.chtxtsearch(chtxt)['csch'], time)
     aviin = tsout + ".ts"
     dualaudio = 0
+    pentaaudio = 0 
+    if re.search("5",opt):
+        pentaaudio = 1
     if re.search("d",opt):
         dualaudio = 1
     if re.search('\[二\]', pout):
@@ -111,6 +121,9 @@ def tv2avi(pout, chtxt, btime, etime,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"
     ts2x264.ts2x264(aviin, pout,opts)
     #os.remove(aviin)
 def b252avi(pout, chtxt,opt):
@@ -132,6 +145,9 @@ def b252avi(pout, chtxt,opt):
     #tv2ts.tv2ts(tsout + ".ts", chdb.chtxtsearch(chtxt)['ch'], chdb.chtxtsearch(chtxt)['csch'], rectime)
     aviin = tsout + ".ts"
     dualaudio = 0
+    pentaaudio = 0
+    if re.search("5",opt):
+        pentaaudio = 1
     if re.search("d",opt):
         dualaudio = 1
     if re.search('\[二\]', pout):
@@ -161,6 +177,9 @@ def b252avi(pout, chtxt,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"
     if makexvid==1:
         ts2xvid.ts2xvid(aviin, pout,opts)
     else:
@@ -226,5 +245,24 @@ def dualaudiots2avi(pin, pout):
     os.remove(ffpin1)
     os.remove(ffpin2)
 
-
+def pentaaudiots2avi(pin, pout):
+    bontsdemux = configreader.getpath('bontsdemux')
+    wine = configreader.getpath('wine')
+    cmdwine = configreader.getpath('cmdwine')
+    bonpin = "Z:\\" + pin[1:]
+    outf = os.path.splitext(pin)[0]
+    bonpout = "Z:\\" + outf[1:]
+    exe = 'wine ' + bontsdemux + " -i \"" + bonpin + "\" -delay 167 -nd -sound 3 -o \"" + bonpout + "\" -start -quit"
+    #print exe
+    exe = 'xvfb-run -a ' + exe
+    #exe='export Display=:2&&'+exe
+    print exe
+    os.system(exe)
+    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 + "\'"
+    #print exe
+    os.system(exe)
+    os.remove(ffpin1)
+    os.remove(ffpin2)