fix(downloads): a YouTube clip outside the catalog takes its title from the fetch
It was queued as "Clip (clip)" and stayed so: nothing renamed it once yt-dlp had answered.
This commit is contained in:
@@ -421,3 +421,22 @@ def test_service_reference_url_follows_the_clip_spec(db, make_user, as_user, yt_
|
||||
job = _clip(as_user(make_user()), source="youtube", ref=yt_video, start_s=65, end_s=90).json()
|
||||
row = db.get(DownloadJob, job["id"])
|
||||
assert service.reference_url(row, None) == f"https://www.youtube.com/watch?v={yt_video}&t=65s"
|
||||
|
||||
|
||||
def test_a_youtube_clip_outside_the_catalog_takes_its_title_from_the_fetch(
|
||||
db, make_user, as_user, worker, monkeypatch
|
||||
):
|
||||
def extract(job_id, asset_id, url, spec, staging, adapter, **kw):
|
||||
f = Path(staging) / "zyxwvutsrqp.mp4"
|
||||
f.write_bytes(b"range")
|
||||
return {"requested_downloads": [{"filepath": str(f)}], "title": "Found On YouTube"}
|
||||
|
||||
monkeypatch.setattr(pipeline, "_extract_with_fallback", extract)
|
||||
job = _clip(as_user(make_user()), source="youtube", ref="zyxwvutsrqp").json()
|
||||
assert job["display_name"] == "Clip (clip)"
|
||||
job, asset = worker["run"](job)
|
||||
assert (job.status, asset.title, job.display_name) == (
|
||||
"done",
|
||||
"Found On YouTube (clip)",
|
||||
"Found On YouTube (clip)",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user