From: yomguy Date: Thu, 7 Feb 2013 14:09:09 +0000 (+0100) Subject: fix comments X-Git-Tag: 1.4.5~47^2~1 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=8b5f8c1baa44b11bbe8790bd4eaa7ffdd8b0990b;p=telemeta.git fix comments --- diff --git a/telemeta/util/kdenlive/session.py b/telemeta/util/kdenlive/session.py index 99256d5e..9c393437 100644 --- a/telemeta/util/kdenlive/session.py +++ b/telemeta/util/kdenlive/session.py @@ -100,6 +100,15 @@ class KDEnLiveSession(object): if 'profile' in attr['name']: return attr['attributes'] + def fix_text(self, text): + try: + s = text.split(' ') + i = int(s[1]) + s.insert(2, ':') + return ' '.join(s) + except: + return text + def markers_relative(self, offset=0): markers = [] entries = self.entries_video_seconds() @@ -114,6 +123,7 @@ class KDEnLiveSession(object): id = at['attributes']['id'] j = 0 abs_time = 0 + for entry in entries: if rel_time > entry['in'] and rel_time < entry['out'] and id == entry['id']: if j != 0: @@ -121,8 +131,10 @@ class KDEnLiveSession(object): print abs_time break j += 1 + at['attributes']['time'] = abs_time at['attributes']['session_timecode'] = time.strftime('%H:%M:%S', time.gmtime(abs_time+offset)) + at['attributes']['comment'] = self.fix_text(at['attributes']['comment']) markers.append(at['attributes']) return markers