Harden queue matching and retry behavior

This commit is contained in:
Dymas
2026-05-26 00:02:02 +02:00
parent 1ceb773f99
commit b72d93268c
8 changed files with 114 additions and 40 deletions
+2 -14
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.6"
VERSION = "0.45.7"
ALLANIME_BASE = "allanime.day"
ALLANIME_API = f"https://api.{ALLANIME_BASE}"
ALLANIME_REFERER = "https://allmanga.to"
@@ -941,16 +941,6 @@ def build_job(payload, config):
anime_name = sanitize_path_component(payload.get("anime_name") or title)
if not query:
raise ValueError("Missing search query")
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()
@@ -970,7 +960,7 @@ def build_job(payload, config):
"season": normalize_season(payload.get("season")),
"episode_offset": normalize_episode_offset(payload.get("episode_offset")),
"query": query,
"result_index": index,
"result_index": None,
"mode": mode,
"quality": quality,
"episodes": validate_episode_spec(payload.get("episodes")),
@@ -995,8 +985,6 @@ def command_for_job(job):
"-e",
job["episodes"],
]
if job.get("result_index"):
command.extend(["-S", str(job["result_index"])])
if job["mode"] == "dub":
command.append("--dub")
command.append(job["query"])