This commit is contained in:
Jesse Bannon 2023-04-19 18:15:12 -07:00
parent 96eb309f26
commit 35fae42ab7

View file

@ -1,13 +1,12 @@
import json
import re import re
import subprocess
from typing import Dict from typing import Dict
from typing import List from typing import List
from typing import Optional from typing import Optional
from typing import Tuple from typing import Tuple
from ytdl_sub.entries.entry import Entry from ytdl_sub.entries.entry import Entry
from ytdl_sub.entries.variables.kwargs import YTDL_SUB_CUSTOM_CHAPTERS, CHAPTERS from ytdl_sub.entries.variables.kwargs import CHAPTERS
from ytdl_sub.entries.variables.kwargs import YTDL_SUB_CUSTOM_CHAPTERS
from ytdl_sub.utils.file_handler import FileMetadata from ytdl_sub.utils.file_handler import FileMetadata
@ -237,7 +236,9 @@ class Chapters:
titles: List[str] = [] titles: List[str] = []
# Try to get actual yt-dlp chapters first, then custom chapters, then default to empty list # Try to get actual yt-dlp chapters first, then custom chapters, then default to empty list
chapters = entry.kwargs_get(CHAPTERS, default=entry.kwargs_get(YTDL_SUB_CUSTOM_CHAPTERS, default=[])) chapters = entry.kwargs_get(
CHAPTERS, default=entry.kwargs_get(YTDL_SUB_CUSTOM_CHAPTERS, default=[])
)
for chapter in chapters: for chapter in chapters:
timestamps.append(Timestamp.from_seconds(int(float(chapter["start_time"])))) timestamps.append(Timestamp.from_seconds(int(float(chapter["start_time"]))))