TagMapping implementation

Silly bug I made
This commit is contained in:
Jamie Hardt
2021-06-01 14:48:10 -07:00
parent be7a01cab9
commit 76a90363fb

View File

@@ -19,7 +19,7 @@ class TagCompiler:
) )
) )
def marker_tags(self, at): def _marker_tags(self, at):
retval = dict() retval = dict()
applicable = [(m, t) for (m, t) in self.session.markers_timed() if t >= at] applicable = [(m, t) for (m, t) in self.session.markers_timed() if t >= at]
for marker, time in sorted(applicable, key=lambda x: x[1]): for marker, time in sorted(applicable, key=lambda x: x[1]):
@@ -29,7 +29,7 @@ class TagCompiler:
return retval return retval
@staticmethod @staticmethod
def coalesce_tags(clip_tags: dict, track_tags: dict, def _coalesce_tags(clip_tags: dict, track_tags: dict,
track_comment_tags: dict, track_comment_tags: dict,
timespan_tags: dict, timespan_tags: dict,
marker_tags: dict, session_tags: dict): marker_tags: dict, session_tags: dict):
@@ -93,7 +93,7 @@ class TagCompiler:
yield item, list(time_spans) yield item, list(time_spans)
@staticmethod @staticmethod
def time_span_tags(at_time: Fraction, applicable_spans) -> dict: def _time_span_tags(at_time: Fraction, applicable_spans) -> dict:
retval = dict() retval = dict()
for tags in [a[0] for a in applicable_spans if a.start <= at_time <= a.finish]: for tags in [a[0] for a in applicable_spans if a.start <= at_time <= a.finish]:
retval.update(tags) retval.update(tags)
@@ -106,9 +106,9 @@ class TagCompiler:
for event, time_spans in parsed_with_time_spans: for event, time_spans in parsed_with_time_spans:
event: 'TagCompiler.Intermediate' event: 'TagCompiler.Intermediate'
marker_tags = self.marker_tags(event.start) marker_tags = self._marker_tags(event.start)
time_span_tags = self.time_span_tags(event.start, time_spans) time_span_tags = self._time_span_tags(event.start, time_spans)
tags = self.coalesce_tags(clip_tags=event.clip_tags, tags = self._coalesce_tags(clip_tags=event.clip_tags,
track_tags=event.track_tags, track_tags=event.track_tags,
track_comment_tags=event.track_comment_tags, track_comment_tags=event.track_comment_tags,
timespan_tags=time_span_tags, timespan_tags=time_span_tags,