Keep removed watchlist shows from reappearing

This commit is contained in:
Dymas
2026-05-26 07:17:22 +02:00
parent b72d93268c
commit f5c476162e
7 changed files with 136 additions and 7 deletions
+20
View File
@@ -871,6 +871,26 @@ class DownloadQueue:
covered.update(self._expand_episode_spec((row["episodes"] if isinstance(row, sqlite3.Row) else row[0]), available_episodes))
return covered
def detach_show(self, show_id):
normalized_show_id = str(show_id or "").strip()
if not normalized_show_id:
return {"ok": True, "count": 0}
count = 0
with self.lock, self._connect() as conn:
rows = conn.execute("SELECT * FROM jobs WHERE show_id = ?", (normalized_show_id,)).fetchall()
for row in rows:
job = self._job_from_row(row)
job["show_id"] = ""
job["skip_watchlist_sync"] = True
job["updated_at"] = now_iso()
self._upsert_job_conn(conn, job)
count += 1
if self.current_job is not None and str(self.current_job.get("show_id") or "").strip() == normalized_show_id:
self.current_job["show_id"] = ""
self.current_job["skip_watchlist_sync"] = True
self.current_job["updated_at"] = now_iso()
return {"ok": True, "count": count}
def retry(self, job_id):
with self.lock:
job = self._find(job_id)