diff --git a/docs/source/prebuilt_presets/tv_shows.rst b/docs/source/prebuilt_presets/tv_shows.rst index 10a4e724..9647e1ab 100644 --- a/docs/source/prebuilt_presets/tv_shows.rst +++ b/docs/source/prebuilt_presets/tv_shows.rst @@ -91,26 +91,32 @@ Or for a specific preset The following are supported. Be sure the combined season + episode ordering include the year, month, day, i.e. upload-year + upload-month-day. -``tv_show_by_date_season_ordering`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -* upload-year -* upload-year-month -* release-year -* release-year-month +Season Ordering +~~~~~~~~~~~~~~~ -``tv_show_by_date_episode_ordering`` +``tv_show_by_date_season_ordering`` supports one of the following: + +* ``upload-year`` (default) +* ``upload-year-month`` +* ``release-year`` +* ``release-year-month`` + + +Episode Ordering ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -* upload-day -* upload-month-day -* upload-month-day-reversed +``tv_show_by_date_episode_ordering`` supports one of the following: + +* ``upload-month-day`` (default) +* ``upload-month-day-reversed`` * Reversed means more recent episodes appear at the top of a season by having a lower value. -* release-day -* release-month-day -* release-month-day-reversed -* download-index +* ``upload-day`` +* ``release-day`` +* ``release-month-day`` +* ``release-month-day-reversed`` +* ``download-index`` * Episodes are numbered by the download order. **NOTE**: this is fetched using the length of the download archive. Do not use if you intend to remove old videos. @@ -184,16 +190,19 @@ Or for a specific preset The following are supported. -``tv_show_collection_episode_ordering`` + +Episode Ordering ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -* upload-year-month-day -* upload-year-month-day-reversed -* release-year-month-day -* release-year-month-day-reversed -* playlist-index +``tv_show_collection_episode_ordering`` supports one of the following: - * Only use playlist-index episode formatting for playlists that will be fully downloaded once and never again. Otherwise, indices can change. -* playlist-index-reversed +* ``upload-year-month-day`` (default) +* ``upload-year-month-day-reversed`` +* ``release-year-month-day`` +* ``release-year-month-day-reversed`` +* ``playlist-index`` + + * Only use ``playlist-index`` episode formatting for playlists that will be fully downloaded once and never again. Otherwise, indices can change. +* ``playlist-index-reversed`` TV Show Collection presets use upload-year-month-day as the default. diff --git a/src/ytdl_sub/downloaders/url/downloader.py b/src/ytdl_sub/downloaders/url/downloader.py index 2db75fb1..1f5eb56d 100644 --- a/src/ytdl_sub/downloaders/url/downloader.py +++ b/src/ytdl_sub/downloaders/url/downloader.py @@ -531,8 +531,8 @@ class MultiUrlDownloader(SourcePlugin[MultiUrlValidator]): download_logger.info("Entry rejected by download match-filter, skipping ..") return None - upload_date_idx = self._enhanced_download_archive.mapping.get_num_entries_with_upload_date( - upload_date_standardized=entry.get(v.upload_date_standardized, str) + upload_date_idx = self._enhanced_download_archive.mapping.get_num_entries_with_date( + standardized_date=entry.get(v.ytdl_sub_keep_files_date_eval, str) ) download_idx = self._enhanced_download_archive.num_entries diff --git a/src/ytdl_sub/prebuilt_presets/tv_show/episode.yaml b/src/ytdl_sub/prebuilt_presets/tv_show/episode.yaml index 81825bce..4e9ccc7d 100644 --- a/src/ytdl_sub/prebuilt_presets/tv_show/episode.yaml +++ b/src/ytdl_sub/prebuilt_presets/tv_show/episode.yaml @@ -9,6 +9,7 @@ presets: thumbnail_name: "{thumbnail_file_name}" info_json_name: "{episode_file_path}.{info_json_ext}" maintain_download_archive: True + keep_files_date_eval: "{episode_date_standardized}" ytdl_options: break_on_existing: True diff --git a/src/ytdl_sub/ytdl_additions/enhanced_download_archive.py b/src/ytdl_sub/ytdl_additions/enhanced_download_archive.py index 2c633a74..0b20ec81 100644 --- a/src/ytdl_sub/ytdl_additions/enhanced_download_archive.py +++ b/src/ytdl_sub/ytdl_additions/enhanced_download_archive.py @@ -248,11 +248,11 @@ class DownloadMappings: del self._entry_mappings[entry_id] return self - def get_num_entries_with_upload_date(self, upload_date_standardized: str) -> int: + def get_num_entries_with_date(self, standardized_date: str) -> int: """ Parameters ---------- - upload_date_standardized + standardized_date A standardized upload date Returns @@ -260,7 +260,7 @@ class DownloadMappings: Number of entries in the mapping with this upload date """ return len( - [_ for _ in self._entry_mappings.values() if _.upload_date == upload_date_standardized] + [_ for _ in self._entry_mappings.values() if _.upload_date == standardized_date] ) def get_num_entries(self) -> int: diff --git a/tests/resources.py b/tests/resources.py index c1aa18d4..68817c85 100644 --- a/tests/resources.py +++ b/tests/resources.py @@ -3,7 +3,7 @@ import shutil from pathlib import Path DISABLE_YOUTUBE_TESTS: bool = True -REGENERATE_FIXTURES: bool = False +REGENERATE_FIXTURES: bool = True RESOURCE_PATH: Path = Path("tests") / "resources" _FILE_FIXTURE_PATH: Path = RESOURCE_PATH / "file_fixtures" diff --git a/tests/resources/expected_downloads_summaries/integration/by-date/Kodi/release-year-month/release-day/is_yt_1.json b/tests/resources/expected_downloads_summaries/integration/by-date/Kodi/release-year-month/release-day/is_yt_1.json index 44eb6ba5..0ead8778 100644 --- a/tests/resources/expected_downloads_summaries/integration/by-date/Kodi/release-year-month/release-day/is_yt_1.json +++ b/tests/resources/expected_downloads_summaries/integration/by-date/Kodi/release-year-month/release-day/is_yt_1.json @@ -1,5 +1,5 @@ { - "Best Prebuilt TV Show by Date/.ytdl-sub-subscription_test-download-archive.json": "04415c1fa29845362550a3175b8e04ba", + "Best Prebuilt TV Show by Date/.ytdl-sub-subscription_test-download-archive.json": "95d3790190cece6e49d2f4d5f68868b1", "Best Prebuilt TV Show by Date/Season 200008/s200008.e0701 - Mock Entry 20-3-thumb.jpg": "e80c508c4818454300133fe1dc1a9cd7", "Best Prebuilt TV Show by Date/Season 200008/s200008.e0701 - Mock Entry 20-3.info.json": "INFO_JSON", "Best Prebuilt TV Show by Date/Season 200008/s200008.e0701 - Mock Entry 20-3.mp4": "6dd6860e8075e5e99c85e14729c41bdb", diff --git a/tests/resources/expected_downloads_summaries/integration/by-date/Kodi/release-year/release-month-day-reversed/is_yt_1.json b/tests/resources/expected_downloads_summaries/integration/by-date/Kodi/release-year/release-month-day-reversed/is_yt_1.json index f47077ac..7bc26567 100644 --- a/tests/resources/expected_downloads_summaries/integration/by-date/Kodi/release-year/release-month-day-reversed/is_yt_1.json +++ b/tests/resources/expected_downloads_summaries/integration/by-date/Kodi/release-year/release-month-day-reversed/is_yt_1.json @@ -1,5 +1,5 @@ { - "Best Prebuilt TV Show by Date/.ytdl-sub-subscription_test-download-archive.json": "980e8fc95a180c37d086daca7cbf0a86", + "Best Prebuilt TV Show by Date/.ytdl-sub-subscription_test-download-archive.json": "1e8b4072d6d6aace4cac0c94ac0e711e", "Best Prebuilt TV Show by Date/Season 2000/s2000.e14698 - Mock Entry 20-1-thumb.jpg": "e80c508c4818454300133fe1dc1a9cd7", "Best Prebuilt TV Show by Date/Season 2000/s2000.e14698 - Mock Entry 20-1.info.json": "INFO_JSON", "Best Prebuilt TV Show by Date/Season 2000/s2000.e14698 - Mock Entry 20-1.mp4": "f4846a3b9ee6a16df3348916077d6476", diff --git a/tests/resources/expected_downloads_summaries/integration/by-date/Kodi/release-year/release-month-day/is_yt_1.json b/tests/resources/expected_downloads_summaries/integration/by-date/Kodi/release-year/release-month-day/is_yt_1.json index d2eba273..290d9fa6 100644 --- a/tests/resources/expected_downloads_summaries/integration/by-date/Kodi/release-year/release-month-day/is_yt_1.json +++ b/tests/resources/expected_downloads_summaries/integration/by-date/Kodi/release-year/release-month-day/is_yt_1.json @@ -1,5 +1,5 @@ { - "Best Prebuilt TV Show by Date/.ytdl-sub-subscription_test-download-archive.json": "8f3393f91d67446ebe9f3715e5a4d071", + "Best Prebuilt TV Show by Date/.ytdl-sub-subscription_test-download-archive.json": "f13a43a83e725981df8417ab1d36705a", "Best Prebuilt TV Show by Date/Season 2000/s2000.e080701 - Mock Entry 20-3-thumb.jpg": "e80c508c4818454300133fe1dc1a9cd7", "Best Prebuilt TV Show by Date/Season 2000/s2000.e080701 - Mock Entry 20-3.info.json": "INFO_JSON", "Best Prebuilt TV Show by Date/Season 2000/s2000.e080701 - Mock Entry 20-3.mp4": "219480c0ee2075ed86ccba740cca3d70", diff --git a/tests/resources/expected_downloads_summaries/integration/collection/Kodi/release-year-month-day-reversed/s_1/is_yt_1.json b/tests/resources/expected_downloads_summaries/integration/collection/Kodi/release-year-month-day-reversed/s_1/is_yt_1.json index 0921148d..e9a36254 100644 --- a/tests/resources/expected_downloads_summaries/integration/collection/Kodi/release-year-month-day-reversed/s_1/is_yt_1.json +++ b/tests/resources/expected_downloads_summaries/integration/collection/Kodi/release-year-month-day-reversed/s_1/is_yt_1.json @@ -1,5 +1,5 @@ { - "Best Prebuilt TV Show Collection/.ytdl-sub-subscription_test-download-archive.json": "05ed34568687c712ac7aaaf653267651", + "Best Prebuilt TV Show Collection/.ytdl-sub-subscription_test-download-archive.json": "df87dea55d4f4076ab4c075a3bceaa3d", "Best Prebuilt TV Show Collection/Season 01/s01.e100052498 - Mock Entry 20-1-thumb.jpg": "e80c508c4818454300133fe1dc1a9cd7", "Best Prebuilt TV Show Collection/Season 01/s01.e100052498 - Mock Entry 20-1.info.json": "INFO_JSON", "Best Prebuilt TV Show Collection/Season 01/s01.e100052498 - Mock Entry 20-1.mp4": "170f6eaaa831b92e80ba798b5ae50b60", diff --git a/tests/resources/expected_downloads_summaries/integration/collection/Kodi/release-year-month-day-reversed/s_2/is_yt_1.json b/tests/resources/expected_downloads_summaries/integration/collection/Kodi/release-year-month-day-reversed/s_2/is_yt_1.json index 003cb784..3a8abfa0 100644 --- a/tests/resources/expected_downloads_summaries/integration/collection/Kodi/release-year-month-day-reversed/s_2/is_yt_1.json +++ b/tests/resources/expected_downloads_summaries/integration/collection/Kodi/release-year-month-day-reversed/s_2/is_yt_1.json @@ -1,5 +1,5 @@ { - "Best Prebuilt TV Show Collection/.ytdl-sub-subscription_test-download-archive.json": "36c4e50c0d8e359fb75a13b99834a42d", + "Best Prebuilt TV Show Collection/.ytdl-sub-subscription_test-download-archive.json": "e89ac9f59f9f9ef22e01c9055708b81c", "Best Prebuilt TV Show Collection/Season 01/s01.e100052699 - Mock Entry 20-4-thumb.jpg": "e80c508c4818454300133fe1dc1a9cd7", "Best Prebuilt TV Show Collection/Season 01/s01.e100052699 - Mock Entry 20-4.info.json": "INFO_JSON", "Best Prebuilt TV Show Collection/Season 01/s01.e100052699 - Mock Entry 20-4.mp4": "1ea0b0274a45288449dddcb1c91a0ac7", diff --git a/tests/resources/expected_downloads_summaries/integration/collection/Kodi/release-year-month-day/s_1/is_yt_1.json b/tests/resources/expected_downloads_summaries/integration/collection/Kodi/release-year-month-day/s_1/is_yt_1.json index db41c440..8eb2de94 100644 --- a/tests/resources/expected_downloads_summaries/integration/collection/Kodi/release-year-month-day/s_1/is_yt_1.json +++ b/tests/resources/expected_downloads_summaries/integration/collection/Kodi/release-year-month-day/s_1/is_yt_1.json @@ -1,5 +1,5 @@ { - "Best Prebuilt TV Show Collection/.ytdl-sub-subscription_test-download-archive.json": "d864f3150e18bda48e86f180ec769651", + "Best Prebuilt TV Show Collection/.ytdl-sub-subscription_test-download-archive.json": "8f0390db6223f1c48072c28aabdc4162", "Best Prebuilt TV Show Collection/Season 01/s01.e00080701 - Mock Entry 20-3-thumb.jpg": "e80c508c4818454300133fe1dc1a9cd7", "Best Prebuilt TV Show Collection/Season 01/s01.e00080701 - Mock Entry 20-3.info.json": "INFO_JSON", "Best Prebuilt TV Show Collection/Season 01/s01.e00080701 - Mock Entry 20-3.mp4": "680b08a1e5032d89188def2784e62146", diff --git a/tests/resources/expected_downloads_summaries/integration/collection/Kodi/release-year-month-day/s_2/is_yt_1.json b/tests/resources/expected_downloads_summaries/integration/collection/Kodi/release-year-month-day/s_2/is_yt_1.json index a6e660d5..1edba6fc 100644 --- a/tests/resources/expected_downloads_summaries/integration/collection/Kodi/release-year-month-day/s_2/is_yt_1.json +++ b/tests/resources/expected_downloads_summaries/integration/collection/Kodi/release-year-month-day/s_2/is_yt_1.json @@ -1,5 +1,5 @@ { - "Best Prebuilt TV Show Collection/.ytdl-sub-subscription_test-download-archive.json": "f293f9cd2c5a2c54f7fd15839e074141", + "Best Prebuilt TV Show Collection/.ytdl-sub-subscription_test-download-archive.json": "b6ee943d41ca8b0f9b54bb9cb04da7de", "Best Prebuilt TV Show Collection/Season 01/s01.e00060601 - Mock Entry 20-7-thumb.jpg": "e80c508c4818454300133fe1dc1a9cd7", "Best Prebuilt TV Show Collection/Season 01/s01.e00060601 - Mock Entry 20-7.info.json": "INFO_JSON", "Best Prebuilt TV Show Collection/Season 01/s01.e00060601 - Mock Entry 20-7.mp4": "a75f9d2b28d82b78ae30da3962f57f61",