From 31cd0b971e16e533de1b552db19af48bab0085a6 Mon Sep 17 00:00:00 2001 From: yomguy Date: Thu, 13 Dec 2012 18:23:34 +0100 Subject: [PATCH] fir counters --- kdenlive/fade.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/kdenlive/fade.py b/kdenlive/fade.py index ab53fce..82165ef 100644 --- a/kdenlive/fade.py +++ b/kdenlive/fade.py @@ -27,8 +27,6 @@ class KdenliveAutoFade(object): def __init__(self): self.n_frames = 2 - self.audio_count = 0 - self.video_count = 0 def audio_fade_in(self, frame_out): child = {'attributes': {u'id': u'fadeout', @@ -157,6 +155,9 @@ class KdenliveAutoFade(object): return child def run(self, path_in, path_out): + audio_count = 0 + video_count = 0 + d = xmltodict(path_in) for attr in d['children']: if 'playlist' in attr['name'] and 'children' in attr: @@ -168,18 +169,19 @@ class KdenliveAutoFade(object): frame_out = att['attributes']['out'] if 'audio' in producer: - if not self.audio_count % 2: + if not audio_count % 2: att['children'] = [self.audio_fade_in(frame_out)] else: att['children'] = [self.audio_fade_out(frame_in)] - self.audio_count =+ 1 + audio_count += 1 + if 'video' in producer: - if not self.video_count % 2: + if not video_count % 2: att['children'] = [self.video_fade_in(frame_out)] else: att['children'] = [self.video_fade_out(frame_in)] - self.video_count =+ 1 + video_count += 1 data = dicttoxml(d) f = open(path_out, 'w') -- 2.39.5