OSDN Git Service

test dead encode killing.
authorgn64_jp <gn64_jp@4e526526-5e11-4fc0-8910-f8fd03428081>
Sat, 31 Dec 2011 10:31:44 +0000 (10:31 +0000)
committergn64_jp <gn64_jp@4e526526-5e11-4fc0-8910-f8fd03428081>
Sat, 31 Dec 2011 10:31:44 +0000 (10:31 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/rec10@880 4e526526-5e11-4fc0-8910-f8fd03428081

rec10/trunk/src/auto_process.py

index c235244..23d6b30 100644 (file)
@@ -203,26 +203,30 @@ def killDeadEncode(path):
     rawlist = glob.glob(path + "/*.264")\r
     for fn in rawlist:\r
         if int(time.time()-os.path.getmtime(fn))>3000:\r
-            tspath=unicode(fn.replace(".264",".ts"),'utf-8')\r
             m2vpath=unicode(fn.replace(".264",".m2v"),'utf-8')\r
             x264path=fn\r
-            x264path=re.sub("\\\[","\[",x264path)\r
+            x264path=re.sub("\\[","[",x264path)\r
             x264path=re.sub("\[","\\\[",x264path)\r
-            x264path=re.sub("\\\]","\]",x264path)\r
-            x264path=re.sub("\]","\\\]",x264path)\r
+            x264path=re.sub("\\]","]",x264path)\r
+            x264path=re.sub("]","\\]",x264path)\r
             #x264path=x264path.replace("[^\\]\]","\\\]")\r
+            tspath=unicode(x264path.replace(".264",".ts"),'utf-8')\r
+            m2vpath=unicode(x264path.replace(".264",".m2v"),'utf-8')\r
             x264path=unicode(x264path,'utf-8')\r
             os.environ['LANG']="ja_JP.UTF-8"\r
-            ktmp=u"ps auxww | grep \""+x264path+u"\" | egrep -v grep | egrep -v \"sh -c\" | grep x264 | awk '{print $2}'"\r
+            ktmp=[]\r
+            ktmp.append(u"ps auxww | grep \""+x264path+u"\" | egrep -v grep | egrep -v \"sh -c\" | grep x264 | awk '{print $2}'")\r
+            ktmp.append(u"ps auxww | grep \""+tspath+u"\" | egrep -v grep | egrep -v \"sh -c\" | grep mencoder | awk '{print $2}'")\r
+            ktmp.append(u"ps auxww | grep \""+m2vpath+u"\" | egrep -v grep | egrep -v \"sh -c\" | grep ffmpeg | awk '{print $2}'")\r
             recdblist.printutf8(u"エンコード処理異常終了タスク終了")\r
-            recdblist.printutf8(ktmp)\r
-            ktmt=commands.getoutput(ktmp.encode('utf-8'))\r
+            for istr in ktmp:\r
+                recdblist.printutf8(i)\r
+                ktmt=commands.getoutput(istr.encode('utf-8'))\r
             if len(ktmt)>0:\r
                 ktmt=ktmt[0]\r
             try:\r
                 if int(ktmt)>0:\r
-                    ktmp=u"kill -9 `"+ktmp+u"`"\r
-                    #recdblist.printutf8(ktmp)\r
+                    ktmp=u"kill -9 `"+istr+u"`"\r
                     recdblist.printutf8(ktmp)\r
                     os.system(ktmp.encode('utf-8'))\r
             except:\r