mirror of
https://github.com/zoriya/Kyoo.git
synced 2026-06-05 04:39:27 +00:00
Safe guard anilist titles
This commit is contained in:
@@ -18,10 +18,12 @@ pipeline: list[Callable[[str, Guess], Awaitable[Guess]]] = [
|
|||||||
|
|
||||||
|
|
||||||
async def identify(path: str) -> Video:
|
async def identify(path: str) -> Video:
|
||||||
raw = guessit(
|
try:
|
||||||
path,
|
titles = list((await get_anilist_data()).titles.keys())
|
||||||
expected_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)
|
# guessit should only return one (according to the doc)
|
||||||
title = raw.get("title", [])[0]
|
title = raw.get("title", [])[0]
|
||||||
|
|||||||
Reference in New Issue
Block a user