Skip to content

Commit 92d8d43

Browse files
committed
Fix incorrect linking for groups outside of dest audio range
Might ignore a group if the last event was linked, even if the group was a valid target otherwise
1 parent 3aa5df9 commit 92d8d43

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

sushi.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -396,9 +396,12 @@ def calculate_shifts(src_stream, dst_stream, events, chapter_times, window, max_
396396
# make sure we don't crash because lines aren't present in the destination stream
397397
if start_point > dst_stream.duration_seconds:
398398
logging.info('Search start point is larger than dst stream duration, ignoring: %s' % unicode(search_group[0]))
399-
link_to = next(x for x in reversed(search_groups[:idx]) if not x[-1].linked)[-1]
400-
for e in search_group:
401-
e.link_event(link_to)
399+
for group in reversed(passed_groups[:idx]):
400+
link_to = next((x for x in reversed(group) if not x.linked), None)
401+
if link_to:
402+
for e in search_group:
403+
e.link_event(link_to)
404+
break
402405
continue
403406

404407
# searching with smaller window

0 commit comments

Comments
 (0)