From 9dde2475fc6fee815cb9d6d49e9c17ee2505474d Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Fri, 2 Feb 2024 17:03:45 +0100 Subject: [PATCH] Add multi episodes/seasons safeguards --- scanner/scanner/scanner.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scanner/scanner/scanner.py b/scanner/scanner/scanner.py index 5f061e92..95398fcd 100644 --- a/scanner/scanner/scanner.py +++ b/scanner/scanner/scanner.py @@ -7,7 +7,7 @@ import re from aiohttp import ClientSession from pathlib import Path from typing import List, Literal, Any -from providers.provider import Provider +from providers.provider import Provider, ProviderError from providers.types.collection import Collection from providers.types.show import Show from providers.types.episode import Episode, PartialShow @@ -88,6 +88,11 @@ class Scanner: if raw.get("season") == raw.get("year") and "season" in raw: del raw["season"] + if isinstance(raw.get("season"), List): + raise ProviderError(f"An episode can't have multiple seasons (found {raw.get("season")} for {path})") + if isinstance(raw.get("episode"), List): + raise ProviderError(f"Multi-episodes files are not yet supported (for {path})") + logging.info("Identied %s: %s", path, raw) if raw["type"] == "movie":