Add keep_max_files_sort_by option for playlist-index-based retention (#1484)
Adds a keep_max_files_sort_by config option that controls how entries are ordered when pruning with keep_max_files.
Previously, pruning always sorted by upload_date (keeping the most recent). This adds support for sorting by playlist_index (keeping the lowest indices), which is useful for playlists where position matters more than upload date e.g. keeping the first N episodes of a series.
Changes
keep_max_files_sort_by- newoutput_optionsfield accepting"upload_date"(default, preserving existing behaviour) or"playlist_index"playlist_indexonDownloadMapping- persisted in the archive JSON so it's available at prune time; old archives without the field gracefully default toNone- Fallback behaviour - if
sort_byis"playlist_index"but no entries have an index (e.g. old archives), logs a warning and falls back toupload_date(current behaviour) - Prebuilt preset support -
only_recent_sort_byoverride wired into thedownload_deletion_optionshelper
Closes #1461
Thanks @michaeldyrynda for the AAA PR! This is great stuff