[BUGFIX] Fix splitting chapters extracted from comments (#593)
This commit is contained in:
parent
e1242eaa61
commit
d5d9978cdb
1 changed files with 8 additions and 8 deletions
|
|
@ -234,14 +234,14 @@ class Chapters:
|
||||||
timestamps: List[Timestamp] = []
|
timestamps: List[Timestamp] = []
|
||||||
titles: List[str] = []
|
titles: List[str] = []
|
||||||
|
|
||||||
# Try to get actual yt-dlp chapters first, then custom chapters, then default to empty list
|
if entry.kwargs_contains(CHAPTERS):
|
||||||
chapters = entry.kwargs_get(
|
for chapter in entry.kwargs_get(CHAPTERS, []):
|
||||||
CHAPTERS, default=entry.kwargs_get(YTDL_SUB_CUSTOM_CHAPTERS, default=[])
|
timestamps.append(Timestamp.from_seconds(int(float(chapter["start_time"]))))
|
||||||
)
|
titles.append(chapter["title"])
|
||||||
|
elif entry.kwargs_contains(YTDL_SUB_CUSTOM_CHAPTERS):
|
||||||
for chapter in chapters:
|
for start_time, title in entry.kwargs_get(YTDL_SUB_CUSTOM_CHAPTERS, {}).items():
|
||||||
timestamps.append(Timestamp.from_seconds(int(float(chapter["start_time"]))))
|
timestamps.append(Timestamp.from_str(start_time))
|
||||||
titles.append(chapter["title"])
|
titles.append(title)
|
||||||
|
|
||||||
return Chapters(timestamps=timestamps, titles=titles)
|
return Chapters(timestamps=timestamps, titles=titles)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue