Skip to content

Commit

Permalink
Fix incorrect linking for groups outside of dest audio range
Browse files Browse the repository at this point in the history
Might ignore a group if the last event was linked, even if the group was a valid target otherwise
  • Loading branch information
tp7 committed Oct 17, 2014
1 parent 3aa5df9 commit 92d8d43
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions sushi.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,9 +396,12 @@ def calculate_shifts(src_stream, dst_stream, events, chapter_times, window, max_
# make sure we don't crash because lines aren't present in the destination stream
if start_point > dst_stream.duration_seconds:
logging.info('Search start point is larger than dst stream duration, ignoring: %s' % unicode(search_group[0]))
link_to = next(x for x in reversed(search_groups[:idx]) if not x[-1].linked)[-1]
for e in search_group:
e.link_event(link_to)
for group in reversed(passed_groups[:idx]):
link_to = next((x for x in reversed(group) if not x.linked), None)
if link_to:
for e in search_group:
e.link_event(link_to)
break
continue

# searching with smaller window
Expand Down

0 comments on commit 92d8d43

Please sign in to comment.