Skip to content

Bulk asynchronous downloader for multiple file hosts

Allow adding CacheDuration to datetime and timedelta values

Jacobfea5a17a0cb4
diff --git a/cyberdrop_dl/config_definitions/custom_types.py b/cyberdrop_dl/config_definitions/custom_types.py
index 909d88f0c..c24eb3a42 100644
--- a/cyberdrop_dl/config_definitions/custom_types.py
+++ b/cyberdrop_dl/config_definitions/custom_types.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from datetime import timedelta
+from datetime import datetime, timedelta
from typing import Annotated
import humanfriendly
@@ -145,3 +145,8 @@ class CacheDuration(BaseModel):
return humanfriendly.format_timespan(self.total_seconds(), detailed=False)
elif isinstance(self.duration, timedelta):
return humanfriendly.format_timespan(self.duration.total_seconds(), detailed=False)
+
+ def __radd__(self, other):
+ if isinstance(other, datetime) or isinstance(other, timedelta):
+ return other + self.duration
+ return NotImplemented