wrolpi/modules/videos/test
lrnselfreliance 315b60e9eb
channels.yaml imports by diffing (#872)
* channels.yaml imports by diffing

channels.yaml declares two sections: Channels keyed by directory
(comparing name, URL, Tag, file format, and the source id and flags,
which keep the database's value when missing), and the Downloads listed
under each Channel, keyed by (directory, URL); an existing Download keeps
its own frequency.  An unchanged import writes nothing (it ran about a
thousand queries and committed several times).

Removed Channels are deleted with their Collection (and Downloads);
a Download removed from a Channel is deleted.  A channel Collection
without a Channel is deleted unless listed (then it gets its Channel).
A Channel whose directory changed, with the same name, is moved.  An
invalid entry is skipped and counted, and keeps its Channel (by name when
its directory is invalid) and that Channel's Downloads; so does an entry
without a list of Downloads.  Duplicate directories still refuse the
import.  Unknown Tags are dropped once tags.yaml is imported.

New Downloads are created in the import's one write (commit=False on
Channel.get_or_create_download, Download.delete and delete_with_videos).
After the import, Videos are claimed and source ids fetched only for new
and changed Channels; Downloads are linked without a query per Download,
and not while entries are skipped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* channels.yaml: moves, invalid Downloads, and saves after the write

- A moved Channel's Download diff is retargeted to its new directory:
  one its new entry lists is the same Download, one it does not is
  deleted in the same import (the old directory was treated as kept).
- An unreadable Download is counted as skipped, and its Channel keeps
  its Downloads (it was dropped, and the Channel's Download deleted).
- A new Download without a frequency is dropped before the write and
  counted (it re-opened a write on every import).
- No source id is fetched while entries are skipped (its save would be
  refused, leaving the database newer than the file); a fetched one is
  saved with dump_config, which records the database's version.
- Download.delete(commit=False) neither changes the skip list nor starts
  config saves, which would read the database before the import commits
  (and write a removed Download back into channels.yaml).  The import
  saves download_manager.yaml after its write.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 13:13:42 -06:00
..
__init__.py A new start 2021-11-01 16:43:09 -06:00
test_api.py db: request-path library functions use the request's connection (#774) 2026-10-04 11:05:20 -06:00
test_audio_modeling.py files: shared modeler batch loop for video, doc, zim, archive (#722) 2026-09-24 16:47:46 -06:00
test_channel_directory_scenarios.py db: write intent is the opt-in, not a second session helper 2026-08-07 20:15:50 -06:00
test_channel_refresh_events.py videos: silence the automatic channel refresh before downloads (#671) 2026-08-20 15:15:18 -06:00
test_channel_refresh_external_files.py Displaying download progress (speed, eta) for file and video downloads. 2026-03-12 19:31:35 -06:00
test_channels_config.py Database configs carry a version the database keeps too (#866) 2026-10-24 14:58:18 -06:00
test_channels_config_import.py channels.yaml imports by diffing (#872) 2026-10-25 13:13:42 -06:00
test_common.py Database configs carry a version the database keeps too (#866) 2026-10-24 14:58:18 -06:00
test_cookies.py Using shared context to sync cookies between processes. 2026-02-22 14:32:27 -07:00
test_downloader.py Video download deletes yt-dlp format leftovers of any extension (#816) 2026-10-11 16:20:25 -06:00
test_lib.py Remove a file's Tags Directory links when WROLPi deletes it (#861) 2026-10-23 14:40:57 -06:00
test_models.py Handling when skip_urls is a None. Logging a warning (and ignoring) when duplicate json files are in a Video FileGroup. 2026-03-13 15:27:43 -06:00
test_transcode.py Video transcodes run at the least CPU priority (#824) 2026-10-12 12:10:44 -06:00
test_transcode_audio.py videos: transcode can remove the audio stream (silent video) (#737) 2026-09-26 17:49:14 -06:00
test_transcode_job.py videos: hide the transcoder's temporary output from the file refresh (#731) 2026-09-26 14:59:51 -06:00
test_video.py Remove a file's Tags Directory links when WROLPi deletes it (#861) 2026-10-23 14:40:57 -06:00
test_video_edit.py db: request-path library functions use the request's connection (#774) 2026-10-04 11:05:20 -06:00
test_video_modeler_loop.py Fixing bug where not all archives were modeled. 2025-12-18 17:19:57 -07:00
test_video_url_resolver.py Trying to get existing channel using more variations of Youtube URLs. 2026-03-20 17:26:51 -06:00