Skip to content

Bulk asynchronous downloader for multiple file hosts

feat: add `--logs.rotate-date-position` option

NTFSvolumee9a6fa220b3a
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2fb76009f..07ff84149 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -22,10 +22,11 @@ All notable changes to this project will be documented here. For more details, v
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
-## UNRELEASED
+## [10.15.0] - UNRELEASED
### Added
+- New `--logs.rotate-date-position` option
- Support Patreon creators with custom domains. User must define the domains with the new `--crawlers.generic.patreon` option
- Support direct media URLs (Patreon)
diff --git a/cyberdrop_dl/config/default.yaml b/cyberdrop_dl/config/default.yaml
index 6e3866b15..e6a9d2994 100644
--- a/cyberdrop_dl/config/default.yaml
+++ b/cyberdrop_dl/config/default.yaml
@@ -173,6 +173,7 @@ logs:
http_traffic: true
level: DEBUG
rotate: false
+ rotate_date_position: suffix
max_children:
album: 0
forum: 0
diff --git a/cyberdrop_dl/config/schema.json b/cyberdrop_dl/config/schema.json
index a6d65e760..9458634f7 100644
--- a/cyberdrop_dl/config/schema.json
+++ b/cyberdrop_dl/config/schema.json
@@ -855,6 +855,12 @@
"default": false,
"title": "Rotate",
"type": "boolean"
+ },
+ "rotate_date_position": {
+ "default": "suffix",
+ "enum": ["prefix", "suffix"],
+ "title": "Rotate Date Position",
+ "type": "string"
}
},
"title": "Logs",
diff --git a/cyberdrop_dl/config/settings.py b/cyberdrop_dl/config/settings.py
index 78cc594b2..b442a624f 100644
--- a/cyberdrop_dl/config/settings.py
+++ b/cyberdrop_dl/config/settings.py
@@ -108,7 +108,9 @@ class Logs(ConfigGroup, name=None): # noqa: PLW1641
"Delete all log files inside `--logs.folder` if they are older that this"
rotate: bool = False
- "Append current datetimme to every log file on each run"
+ "Add current datetime to every log file on each run"
+
+ rotate_date_position: Literal["prefix", "suffix"] = "suffix"
_created_at: dt.datetime = PrivateAttr(default_factory=dt.datetime.now)
@@ -130,10 +132,15 @@ class Logs(ConfigGroup, name=None): # noqa: PLW1641
def resolve(path: Path) -> Path:
log_file = folder / path
- if self.rotate:
- file_name = f"{log_file.stem}_{now_file_iso}{log_file.suffix}"
- log_file = log_file.parent / now_folder_iso / file_name
- return log_file
+ if not self.rotate:
+ return log_file
+
+ stem = (
+ f"{now_file_iso}_{log_file.stem}"
+ if self.rotate_date_position == "prefix"
+ else f"{log_file.stem}_{now_file_iso}"
+ )
+ return log_file.parent / now_folder_iso / f"{stem}{log_file.suffix}"
self.files = LogFiles.model_construct(
None, **{name: resolve(value) for name, value in self.files.model_dump().items()}
diff --git a/docs/reference/config/logs.md b/docs/reference/config/logs.md
index 99ee5b995..32fe00e59 100644
--- a/docs/reference/config/logs.md
+++ b/docs/reference/config/logs.md
@@ -102,7 +102,7 @@ logs:
| ------ | ------- |
| `bool` | `false` |
-If enabled, `cyberdrop-dl` will add the current date and time as a suffix to each log file, in the format `YYMMDD_HHMMSS`
+If enabled, `cyberdrop-dl` will add the current datetime to each log file, in the format `YYMMDD_HHMMSS`.
Every log file will be created inside a sub folder with the current date
@@ -113,6 +113,19 @@ logs:
rotate: false
```
+# `rotate_date_position`
+
+| Type | Default |
+| -------------------- | -------- |
+| `prefix` or `suffix` | `suffix` |
+
+Ignored unless `--logs.rotate` is enabled
+
+```yaml
+logs:
+ rotate_date_position: "suffix"
+```
+
# Files
## `main`