Skip to content

Commit 7682582

Browse files
committed
First chapter should start at beginning of file
1 parent 1c40318 commit 7682582

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

chapterize.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ def _get_frames(f_id: str):
1717

1818
def _get_chapters(frames, length_ms):
1919
for i, (timestamp, path) in enumerate(frames):
20+
start_time = 0 if i == 0 else timestamp
2021
end_time = frames[i + 1][0] if i + 1 < len(frames) else length_ms
2122
with open(path, 'rb') as pic:
2223
apic = APIC(
@@ -27,7 +28,7 @@ def _get_chapters(frames, length_ms):
2728
tit2 = TIT2(text=f'Chapter {i + 1}')
2829
yield CHAP(
2930
element_id=f'chp{i}',
30-
start_time=timestamp,
31+
start_time=start_time,
3132
end_time=end_time,
3233
sub_frames=[tit2, apic]
3334
)

0 commit comments

Comments
 (0)