wrolpi/modules/videos
lrnselfreliance 9797af157a
Removing a duplicate video keeps the Download that is finishing (#942)
* A refresh that finishes before tags.yaml is imported no longer reports a failed save (#941)

Every refresh fires save_tags_config at its cleanup.  In the first seconds
after a start, a refresh can finish before the startup import of tags.yaml,
which on a rebuilt database happens while the first refresh runs.  The dump
then asked ConfigFile.save to write a database that held no tags over the
file; the save guard refused, as it must, but it did so with an ERROR traceback
and a "Failed to save config: config/tags.yaml" event for the user, although
nothing was lost: the import that followed read the file and recreated the tags.

save_tags_config now skips the dump while the config has not been imported and
says so at WARNING.  The file stays the source of truth until the import.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>

* Removing a duplicate video keeps the Download that is finishing

After a video download, Video.delete_duplicate_videos removes the other copies
of the same video, which happens when the file name changed (a renamed file, a
new title).  Each copy was deleted through FileGroup.delete, which also deletes
the Download of the copy's URL and, without one, adds the URL to the skip list.
The duplicates share that URL with the video just downloaded, so the Download
still running was deleted from under its worker: the worker read its row again
to record the result and failed with NoResultFound ("Unexpected error"), and the
download's record was gone.

FileGroup.delete and Video.delete take keep_download; the duplicate cleanup
passes it, so the URL's Download and the skip list are left alone.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* Only a duplicate at the downloaded URL keeps its Download

delete_duplicate_videos also finds copies by source_id, and those can sit under
another URL.  Such a copy is deleted as any video is, with that URL's Download
or a skip-list entry; only a copy that shares the URL being downloaded leaves
the finishing Download alone.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-11-02 19:18:46 -07:00
..
channel Remove unused code found by vulture (#885) 2026-10-27 15:50:09 -06:00
test Removing a duplicate video keeps the Download that is finishing (#942) 2026-11-02 19:18:46 -07:00
video Tests fail when a request writes outside request.ctx.db.write() (#864) 2026-10-23 17:09:39 -06:00
__init__.py files: shared modeler batch loop for video, doc, zim, archive (#722) 2026-09-24 16:47:46 -06:00
api.py db: request-path library functions use the request's connection (#774) 2026-10-04 11:05:20 -06:00
common.py The tail-decode check ignores the h264 decoder's "mmco: unref short failure" note (#938) 2026-11-02 18:00:03 -07:00
conftest.py Search: fast ABC mode by default, opt-in deep search 2026-07-03 10:32:16 -06:00
cookies.py Using shared context to sync cookies between processes. 2026-02-22 14:32:27 -07:00
downloader.py A download records the sha256 of its files in the wrolpi section (#904) 2026-10-30 19:34:49 -06:00
errors.py Remove unused code found by vulture (#885) 2026-10-27 15:50:09 -06:00
lib.py A channels.yaml import keeps a Channel's once-Downloads (#898) 2026-10-29 16:59:56 -06:00
models.py Removing a duplicate video keeps the Download that is finishing (#942) 2026-11-02 19:18:46 -07:00
normalize_video_url.py A video that is uploaded is attached to its Channel. Saving Channels config with both download url and frequency in case downloads config is corrupted. 2024-10-16 18:56:11 -06:00
schema.py Remove unused code found by vulture (#885) 2026-10-27 15:50:09 -06:00
transcode.py A transcode or remux refreshes the sha256 sums a download recorded (#906) 2026-10-30 19:41:29 -06:00