Stop forcing watchlist ani-cli result indexes

This commit is contained in:
Dymas
2026-05-25 23:24:31 +02:00
parent 1f50c3c666
commit 5db94cffb1
6 changed files with 36 additions and 17 deletions
+13 -9
View File
@@ -20,7 +20,7 @@ from uuid import uuid4
PROJECT_ROOT = Path(__file__).resolve().parent
ANI_CLI = os.environ.get("ANI_CLI_BIN") or shutil.which("ani-cli") or "ani-cli"
APP_NAME = "ani-cli-web"
VERSION = "0.45.3"
VERSION = "0.45.4"
ALLANIME_BASE = "allanime.day"
ALLANIME_API = f"https://api.{ALLANIME_BASE}"
ALLANIME_REFERER = "https://allmanga.to"
@@ -941,12 +941,16 @@ def build_job(payload, config):
anime_name = sanitize_path_component(payload.get("anime_name") or title)
if not query:
raise ValueError("Missing search query")
try:
index = int(payload.get("index", 1))
except (TypeError, ValueError) as exc:
raise ValueError("Invalid result index") from exc
if index < 1:
raise ValueError("Result index must be positive")
raw_index = payload.get("index")
if raw_index in (None, ""):
index = None
else:
try:
index = int(raw_index)
except (TypeError, ValueError) as exc:
raise ValueError("Invalid result index") from exc
if index < 1:
raise ValueError("Result index must be positive")
mode = str(payload.get("mode") or config["mode"]).lower()
quality = str(payload.get("quality") or config["quality"]).lower()
@@ -990,9 +994,9 @@ def command_for_job(job):
job["quality"],
"-e",
job["episodes"],
"-S",
str(job["result_index"]),
]
if job.get("result_index"):
command.extend(["-S", str(job["result_index"])])
if job["mode"] == "dub":
command.append("--dub")
command.append(job["query"])