OSDN Git Service

implement ffmepg interlaced option.
[rec10/rec10-git.git] / rec10 / trunk / src / checker.py
index fb43db7..9e69503 100644 (file)
@@ -1,29 +1,43 @@
 #!/usr/bin/python
 # coding: UTF-8
 # Rec10 TS Recording Tools
-# Copyright (C) 2009 Yukikaze
+# Copyright (C) 2009-2010 Yukikaze
 import os
+import os.path
 import time
-def checkB25Decode(b25filepath, decodedfilepath):
+
+def checkB25Decode(b25filepath, decodedfilepath , csch):
     ret = 0
     if os.path.isfile(decodedfilepath):##tsファイルが存在している
         dtime = time.time()-os.path.getmtime(decodedfilepath)
         dtime = int(dtime)
-        if dtime > 120:
-            if (compareFilesize(b25filepath, decodedfilepath, 10) and minimizeCheck(decodedfilepath, 800)):
-                ret = 1
-        else:
-            time.sleep(100)
-            if dtime > 120:
+        if dtime > 20:
+            if csch>0:
                 if (compareFilesize(b25filepath, decodedfilepath, 10) and minimizeCheck(decodedfilepath, 800)):
                     ret = 1
-    #print "delete b25 is " + str(ret)
+            else:
+                if (compareFilesize(b25filepath, decodedfilepath, 60) and minimizeCheck(decodedfilepath, 800)):
+                    ret = 1
+        else:
+            time.sleep(30)
+            dtime = time.time()-os.path.getmtime(decodedfilepath)
+            dtime = int(dtime)
+            if dtime > 20:
+                if csch>0:
+                    if (compareFilesize(b25filepath, decodedfilepath, 10) and minimizeCheck(decodedfilepath, 800)):
+                        ret = 1
+                else:
+                    if (compareFilesize(b25filepath, decodedfilepath, 60) and minimizeCheck(decodedfilepath, 800)):
+                        ret = 1
+    #recdblist.printutf8("deleting b25 is " + str(ret))
     return ret
 def compareFilesize(pathbase, path, percentage):
     """
     return true if size of path is larger than that of pathbase.
     percentage is int(0< <100)
     """
+    if not os.path.exists(pathbase):
+        return 0
     basesize = os.path.getsize(pathbase)
     pathsize = os.path.getsize(path)
     size = pathsize * 100-basesize * percentage
@@ -35,7 +49,6 @@ def minimizeCheck(filepath, minsize):
     """
     minsize is Megabytes
     """
-    print os.path.getsize(filepath)
     if os.path.getsize(filepath) > minsize * 1000 * 1000:
         return 1
     else: