Safe guard anilist titles

This commit is contained in:
Zoe Roux 2026-05-01 21:43:51 +02:00
parent 40959251ef
commit a54a67c4f6
No known key found for this signature in database

View File

@ -18,10 +18,12 @@ pipeline: list[Callable[[str, Guess], Awaitable[Guess]]] = [
async def identify(path: str) -> Video:
raw = guessit(
path,
expected_titles=list((await get_anilist_data()).titles.keys()),
)
try:
titles = list((await get_anilist_data()).titles.keys())
except Exception as e:
logger.error("Failed to get expected titles", exc_info=e)
titles = []
raw = guessit(path, expected_titles=titles)
# guessit should only return one (according to the doc)
title = raw.get("title", [])[0]