Fix non-interactive anikoto backup downloads
- force anikoto-cli backup runs to auto-select the queued anime title through fzf filter options - add a regression test for the backup retry environment - bump the project version to 0.46.3 and document the fix in the changelog and README
This commit is contained in:
+15
-1
@@ -30,6 +30,7 @@ from app_support import (
|
||||
now_iso,
|
||||
printable_command,
|
||||
send_discord_webhook_event,
|
||||
sh_quote,
|
||||
strip_control,
|
||||
)
|
||||
|
||||
@@ -1346,6 +1347,18 @@ class DownloadQueue:
|
||||
attempts.append(("anikoto-cli", lambda job: command_for_job(job, downloader="anikoto-cli")))
|
||||
return attempts
|
||||
|
||||
def _attempt_env(self, base_env, job, downloader_name):
|
||||
attempt_env = dict(base_env)
|
||||
if downloader_name == "anikoto-cli":
|
||||
query = str(job.get("query") or job.get("title") or "").strip()
|
||||
if query:
|
||||
# Force fzf into non-interactive exact-match mode so backup downloads
|
||||
# can auto-select the intended anime inside the queue worker.
|
||||
attempt_env["FZF_DEFAULT_OPTS"] = (
|
||||
f"--exact --filter={sh_quote(query)} --select-1 --exit-0"
|
||||
)
|
||||
return attempt_env
|
||||
|
||||
def _fail_job_startup(self, job, exc):
|
||||
message = f"Could not start download: {exc}"
|
||||
with self.lock:
|
||||
@@ -1455,10 +1468,11 @@ class DownloadQueue:
|
||||
self._append_log(job, f"Launching {downloader_name}: {job['command']}")
|
||||
|
||||
try:
|
||||
attempt_env = self._attempt_env(env, job, downloader_name)
|
||||
process = subprocess.Popen(
|
||||
command,
|
||||
cwd=str(PROJECT_ROOT),
|
||||
env=env,
|
||||
env=attempt_env,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT,
|
||||
text=True,
|
||||
|
||||
Reference in New Issue
Block a user