github jmbannon/ytdl-sub 2026.07.16
ytdl-sub 2026.07.16

7 hours ago

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 - new output_options field accepting "upload_date" (default, preserving existing behaviour) or "playlist_index"
  • playlist_index on DownloadMapping - persisted in the archive JSON so it's available at prune time; old archives without the field gracefully default to None
  • Fallback behaviour - if sort_by is "playlist_index" but no entries have an index (e.g. old archives), logs a warning and falls back to upload_date (current behaviour)
  • Prebuilt preset support - only_recent_sort_by override wired into the download_deletion_options helper

Closes #1461

Thanks @michaeldyrynda for the AAA PR! This is great stuff

Don't miss a new ytdl-sub release

NewReleases is sending notifications on new releases.