]> git.parisson.com Git - telemeta.git/commitdiff
fix fading in kdenlive rendering
authorGuillaume Pellerin <yomguy@parisson.com>
Fri, 21 Jun 2013 20:06:56 +0000 (22:06 +0200)
committerGuillaume Pellerin <yomguy@parisson.com>
Fri, 21 Jun 2013 20:06:56 +0000 (22:06 +0200)
telemeta/util/kdenlive/mlt_process_batch.py

index 9332acb986fea912f0a559ada4bd4911f119a0e8..afaad379288ec61ff9adfd24c32f728c8b2d7da1 100755 (executable)
@@ -5,7 +5,7 @@ if __name__ == '__main__':
     root_dir = sys.argv[-1]
 
     fading = False
-    if '--fade' in sys.argv:
+    if '--fading' in sys.argv:
         fading = True
 
     for root, dirs, files in os.walk(root_dir):
@@ -13,17 +13,24 @@ if __name__ == '__main__':
             prefix, extension = os.path.splitext(filename)
             path = root + os.sep + filename
 
-            flag = path + '.faded'
-            if 'mlt' in extension and not os.path.exists(flag) and fading:
-                from telemeta.util.kdenlive.fade import AutoFade
-                fade = AutoFade(path)
-                data = fade.run()
-                f = open(path, 'w')
-                f.write(data)
-                f.close()
-                os.system('touch ' + flag)
-
             flag = path + '.processed'
             if 'sh' in extension and not os.path.exists(flag):
+                if fading:
+                    from telemeta.util.kdenlive.fade import AutoFade
+                    local_files = os.listdir(root)
+                    for local_file in local_files:
+                        local_name, local_ext = os.path.splitext(local_file)
+                        if 'mlt' in local_ext:
+                            local_path = root + os.sep + local_file
+                            local_flag = local_path + '.faded'
+                            if not os.path.exists(local_flag):
+                                os.system('cp ' + path + ' ' + path + '.bak')
+                                fade = AutoFade(local_path)
+                                data = fade.run()
+                                f = open(local_path, 'w')
+                                f.write(data)
+                                f.close()
+                                os.system('touch ' + local_flag)
+
                 os.system('nice -n 19 ' + path)
                 os.system('touch ' + flag)