Fix delete not finding the download: wrong id sent to MeTube's /delete
MeTube's queue/pending/done stores are keyed by the download's URL
(PersistentQueue.put: key = value.info.url), not by the id field a Download
reports over Socket.IO (which is what we stored as metube_job_id and were
sending). Sending the wrong key made MeTube's clear()/cancel() silently
no-op ("requested delete for non-existent download" in its own logs) while
still returning {"status": "ok"} regardless -- confirmed live by curling
/history on the real instance and finding the "deleted" entry still
present, unrelated to the DELETE_FILE_ON_TRASHCAN config fix that came
right before this.
delete_download() now takes the video's canonical youtube_url instead.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
441a3ef9df
commit
62f8fb746b
3 changed files with 19 additions and 11 deletions
|
|
@ -77,16 +77,23 @@ class MeTubeClient:
|
|||
response.raise_for_status()
|
||||
return response.json()
|
||||
|
||||
def delete_download(self, metube_job_id: str) -> dict:
|
||||
def delete_download(self, youtube_url: str) -> dict:
|
||||
"""Asks MeTube to remove a finished download from its 'done' list and
|
||||
delete the underlying file (actual file deletion additionally depends
|
||||
on MeTube's own DELETE_FILE_ON_TRASHCAN config, which we don't
|
||||
control). Only ever called with a metube_job_id our own app tracked
|
||||
from a download it started -- never touches files MeTube already had
|
||||
before we existed."""
|
||||
control). Only ever called for a URL our own app itself enqueued --
|
||||
never touches files MeTube already had before we existed.
|
||||
|
||||
MeTube's queue/pending/done stores are keyed by the download's URL
|
||||
(PersistentQueue.put: `key = value.info.url`), NOT by the id field a
|
||||
Download reports over Socket.IO -- passing that id here silently
|
||||
no-ops (MeTube logs "requested delete for non-existent download" and
|
||||
still returns {"status": "ok"} regardless), which is what happened
|
||||
before this was fixed: verified by curling this instance's /history
|
||||
and finding the "deleted" entry still present."""
|
||||
response = httpx.post(
|
||||
f"{self.api_base_url}/delete",
|
||||
json={"ids": [metube_job_id], "where": "done"},
|
||||
json={"ids": [youtube_url], "where": "done"},
|
||||
timeout=self.timeout,
|
||||
)
|
||||
response.raise_for_status()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue