From 0dcd6e3f8dd876072aa47e5d888d54e36472c8ec Mon Sep 17 00:00:00 2001 From: Miguel Martinez Date: Fri, 2 Feb 2018 11:24:37 -0800 Subject: [PATCH 1/3] improve transition management * adds ToNameMatcher for identify destination name (TO CLIP NAME) in a transition event. While (TO FROM NAME) Name is pushed to the previous entry on the list. * Update regular expression for EFFECTS Matcher. As Working with Toon Boom Storyboard Pro EDL files, its output uses a different phrasing for EFFECTS comment. * Move Location for next_event assignment in EventMatcher.apply(). Reason: After a transition event, the event didn't have value for next_event so it was preventing iteration. Only Cut assigned the property. (Tested for my known cases) --- edl/__init__.py | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/edl/__init__.py b/edl/__init__.py index 533537c..66a4426 100644 --- a/edl/__init__.py +++ b/edl/__init__.py @@ -126,6 +126,7 @@ def matches(self, line): def apply(self, stack, line): sys.stderr.write("Skipping:" + line) + class FCMMatcher(Matcher): """Matches the FCM attribute """ @@ -139,6 +140,7 @@ def apply(self, stack, line): except (IndexError, AttributeError): pass + class TitleMatcher(Matcher): """Matches the EDL Title attribute """ @@ -198,7 +200,26 @@ def apply(self, stack, line): if m: stack[-1].clip_name = m.group(2).strip() +class ToNameMatcher(Matcher): + """ + Identifies TO CLIP NAME as the destination clip for the transition. + Pushes FROM CLIP NAME value to the previous entry (the source). + """ + + def __init__(self): + # Following similar convention to NameMatcher, finds destination name + Matcher.__init__(self, '\*\s*TO CLIP NAME:(\s+)(.+)') + def apply(self, stack, line): + m = re.search(self.regex, line) + #print line + if len(stack) > 0: + if m: + # this "From" is the name from previous Clip + stack[-2].clip_name = stack[-1].clip_name + # this "To" is the name we want to keep for this event + stack[-1].clip_name = m.group(2).strip() + class SourceMatcher(Matcher): """No documentation for this class yet. """ @@ -219,7 +240,13 @@ class EffectMatcher(Matcher): """ def __init__(self): - Matcher.__init__(self, 'EFFECTS NAME IS(\s+)(.+)') + """ + Matches + * EFFECT NAME: CROSS DISSOLVE (Toon boom Storyboard Pro Edl) + or + EFFECTS NAME IS CROSS DISSOLVE (Adobe Premiere Edl) + """ + Matcher.__init__(self, '.*EFFECT.*(?:IS|:)(\s+)(.+)') def apply(self, stack, line): m = re.search(self.regex, line) @@ -273,9 +300,11 @@ def apply(self, stack, line): values = map(self.stripper, matches) evt = Event(dict(zip(keys, values))) t = evt.tr_code - if t == 'C': - if len(stack) > 0: + + if len(stack) > 0: stack[-1].next_event = evt + + if t == 'C': evt.transition = Cut() elif t == 'D': evt.transition = Dissolve() @@ -557,8 +586,8 @@ def __init__(self, fps=None): def get_matchers(self): return [TitleMatcher(), EventMatcher(self.fps), EffectMatcher(), - NameMatcher(), SourceMatcher(), TimewarpMatcher(self.fps), - CommentMatcher(), FCMMatcher()] + NameMatcher(), ToNameMatcher(), SourceMatcher(), + TimewarpMatcher(self.fps), CommentMatcher()] def parse(self, input_): stack = None From f04fe3cbda7467f9c968155f0fd29eee609bc886 Mon Sep 17 00:00:00 2001 From: Paul Kilgo Date: Mon, 8 May 2017 16:26:07 -0700 Subject: [PATCH 2/3] Fix build-time dependences on timecode --- edl/__init__.py | 2 +- edl/version.py | 1 + setup.py | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 edl/version.py diff --git a/edl/__init__.py b/edl/__init__.py index 66a4426..69e5cf8 100644 --- a/edl/__init__.py +++ b/edl/__init__.py @@ -8,7 +8,7 @@ import pprint import timecode -__version__ = '0.1.11' +from .version import __version__ class List(object): diff --git a/edl/version.py b/edl/version.py new file mode 100644 index 0000000..850505a --- /dev/null +++ b/edl/version.py @@ -0,0 +1 @@ +__version__ = '0.1.10' diff --git a/setup.py b/setup.py index 7b0f615..2a0aa35 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ #!/usr/bin/env python from distutils.core import setup -import edl +exec(open('edl/version.py').read()) requires = [ 'timecode' @@ -9,7 +9,7 @@ setup( name='edl', - version=edl.__version__, + version=__version__, description='Simple EDL reading library', author='Simon Hargreaves', author_email='simon@simon-hargreaves.com', From db262b07e0141381872ffabb95509956c90b6af1 Mon Sep 17 00:00:00 2001 From: Paul Kilgo Date: Tue, 9 May 2017 18:30:52 -0700 Subject: [PATCH 3/3] Fix wrong version --- edl/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/edl/version.py b/edl/version.py index 850505a..13b7089 100644 --- a/edl/version.py +++ b/edl/version.py @@ -1 +1 @@ -__version__ = '0.1.10' +__version__ = '0.1.11'