diff --git a/docs/source/config_reference/plugins.rst b/docs/source/config_reference/plugins.rst index 69afce80..8e63e291 100644 --- a/docs/source/config_reference/plugins.rst +++ b/docs/source/config_reference/plugins.rst @@ -640,6 +640,8 @@ Defines where to output files and thumbnails after all post-processing has compl maintain_download_archive: True keep_files_before: now keep_files_after: 19000101 + keep_max_files: 1000 + keep_files_date_eval: "{upload_date_standardized}" ``download_archive_name`` @@ -690,6 +692,16 @@ Defines where to output files and thumbnails after all post-processing has compl ``keep_max_files``. +``keep_files_date_eval`` + +:expected type: str +:description: + Uses this standardized date in the form of YYYY-MM-DD to record in the + download archive for a given entry. Subsequently, uses this value to + perform evaluation for keep_files_before/after and keep_max_files. Defaults + to the entry's upload_date_standardized variable. + + ``keep_max_files`` :expected type: Optional[OverridesFormatter] diff --git a/docs/source/config_reference/scripting/entry_variables.rst b/docs/source/config_reference/scripting/entry_variables.rst index 84247234..eea90981 100644 --- a/docs/source/config_reference/scripting/entry_variables.rst +++ b/docs/source/config_reference/scripting/entry_variables.rst @@ -659,3 +659,9 @@ ytdl_sub_input_url_index :type: ``Integer`` :description: The index of the input URL as defined in the subscription, top-most being the 0th index. + +ytdl_sub_keep_files_date_eval +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +:type: ``String`` +:description: + The standardized date variable supplied in ``output_options.keep_files_date_eval``. diff --git a/src/ytdl_sub/entries/script/variable_definitions.py b/src/ytdl_sub/entries/script/variable_definitions.py index 4c939801..cc86737d 100644 --- a/src/ytdl_sub/entries/script/variable_definitions.py +++ b/src/ytdl_sub/entries/script/variable_definitions.py @@ -824,10 +824,10 @@ class YtdlSubVariableDefinitions(ABC): ) @cached_property - def ytdl_sub_entry_date_eval(self: "VariableDefinitions") -> StringVariable: + def ytdl_sub_keep_files_date_eval(self: "VariableDefinitions") -> StringVariable: """ :description: - The standardized date variable supplied in ``output_options.entry_date_eval`` + The standardized date variable supplied in ``output_options.keep_files_date_eval``. """ return StringVariable( variable_name="ytdl_sub_entry_date_eval", @@ -1132,7 +1132,7 @@ class VariableDefinitions( self.ytdl_sub_input_url, self.ytdl_sub_input_url_index, self.ytdl_sub_input_url_count, - self.ytdl_sub_entry_date_eval, + self.ytdl_sub_keep_files_date_eval, } @cache diff --git a/src/ytdl_sub/subscriptions/subscription_download.py b/src/ytdl_sub/subscriptions/subscription_download.py index db5b456c..9acabda4 100644 --- a/src/ytdl_sub/subscriptions/subscription_download.py +++ b/src/ytdl_sub/subscriptions/subscription_download.py @@ -222,7 +222,7 @@ class SubscriptionDownload(BaseSubscription, ABC): # Inject OutputOption variables here entry.add( { - VARIABLES.ytdl_sub_entry_date_eval: ( + VARIABLES.ytdl_sub_keep_files_date_eval: ( self.output_options.keep_files_date_eval.format_string ) } diff --git a/src/ytdl_sub/ytdl_additions/enhanced_download_archive.py b/src/ytdl_sub/ytdl_additions/enhanced_download_archive.py index 25f1a923..2c633a74 100644 --- a/src/ytdl_sub/ytdl_additions/enhanced_download_archive.py +++ b/src/ytdl_sub/ytdl_additions/enhanced_download_archive.py @@ -75,7 +75,7 @@ class DownloadMapping: DownloadMapping for the entry """ return DownloadMapping( - upload_date=entry.get(v.ytdl_sub_entry_date_eval, str), + upload_date=entry.get(v.ytdl_sub_keep_files_date_eval, str), extractor=entry.download_archive_extractor, file_names=set(), )