feat: add flag to ignore already archived items from being added to download history.
This commit is contained in:
parent
ff9fd6a061
commit
cf8704a2aa
3 changed files with 9 additions and 4 deletions
1
FAQ.md
1
FAQ.md
|
|
@ -55,6 +55,7 @@ or the `environment:` section in `compose.yaml` file.
|
|||
| YTP_AUTO_CLEAR_HISTORY_DAYS | Number of days after which completed download history is cleared. | `0` |
|
||||
| YTP_DEFAULT_PAGINATION | The default number of items per page for history. | `50` |
|
||||
| YTP_TASK_HANDLER_RANDOM_DELAY | The maximum random delay in seconds before starting a task handler. | `60` |
|
||||
| YTP_IGNORE_ARCHIVED_ITEMS | Don't report archived items in the download history. | `false` |
|
||||
|
||||
> [!NOTE]
|
||||
> To raise the maximum workers for specific extractor, you need to add a ENV variable that follows the pattern `YTP_MAX_WORKERS_FOR_<EXTRACTOR_NAME>`.
|
||||
|
|
|
|||
|
|
@ -734,7 +734,7 @@ class DownloadQueue(metaclass=Singleton):
|
|||
# This sometimes can be different from the final extracted ID, so we need to verify again after extraction.
|
||||
if archive_id and item.is_archived():
|
||||
store_type, dlInfo = await self.get_item(archive_id=archive_id)
|
||||
if not store_type:
|
||||
if not store_type and not self.config.ignore_archived_items:
|
||||
dlInfo = Download(
|
||||
info=ItemDTO(
|
||||
id=archive_id.split()[1],
|
||||
|
|
@ -763,7 +763,7 @@ class DownloadQueue(metaclass=Singleton):
|
|||
)
|
||||
return {"status": "ok"}
|
||||
|
||||
message: str = f"The URL '{item.url}' is already downloaded and recorded in archive."
|
||||
message: str = f"The URL '{item.url}':'{archive_id}' is already downloaded and recorded in archive."
|
||||
LOG.warning(message)
|
||||
self._notify.emit(
|
||||
Events.LOG_INFO, data={"preset": item.preset}, title="Already Downloaded", message=message
|
||||
|
|
@ -827,7 +827,7 @@ class DownloadQueue(metaclass=Singleton):
|
|||
if store_type:
|
||||
break
|
||||
|
||||
if not store_type:
|
||||
if not store_type and not self.config.ignore_archived_items:
|
||||
new_archive_id = new_archive_id or extra_ids.pop(0)
|
||||
dlInfo = Download(
|
||||
info=ItemDTO(
|
||||
|
|
@ -855,7 +855,7 @@ class DownloadQueue(metaclass=Singleton):
|
|||
)
|
||||
return {"status": "ok"}
|
||||
|
||||
message: str = f"The URL '{item.url}' is already downloaded and recorded in archive."
|
||||
message: str = f"The URL '{item.url}':'{archive_ids.pop(0)}' is already downloaded and recorded in archive."
|
||||
LOG.warning(message)
|
||||
self._notify.emit(
|
||||
Events.LOG_INFO, data={"preset": item.preset}, title="Already Downloaded", message=message
|
||||
|
|
|
|||
|
|
@ -216,6 +216,9 @@ class Config(metaclass=Singleton):
|
|||
task_handler_random_delay: float = 60.0
|
||||
"""The maximum random delay in seconds before starting a task handler."""
|
||||
|
||||
ignore_archived_items: bool = False
|
||||
"""Dont report archived items in the download history."""
|
||||
|
||||
pictures_backends: list[str] = [
|
||||
"https://unsplash.it/1920/1080?random",
|
||||
"https://picsum.photos/1920/1080",
|
||||
|
|
@ -280,6 +283,7 @@ class Config(metaclass=Singleton):
|
|||
"temp_disabled",
|
||||
"allow_internal_urls",
|
||||
"simple_mode",
|
||||
"ignore_archived_items",
|
||||
)
|
||||
"The variables that are booleans."
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue