Skip to content

Bulk asynchronous downloader for multiple file hosts

refactor: do not try to set file date for HLS segments (#1489)

NTFSvolumeac41f4cead9c
diff --git a/cyberdrop_dl/clients/download_client.py b/cyberdrop_dl/clients/download_client.py
index 1008dcd00..8ba0508a4 100644
--- a/cyberdrop_dl/clients/download_client.py
+++ b/cyberdrop_dl/clients/download_client.py
@@ -136,7 +136,11 @@ class DownloadClient:
if resp.status != HTTPStatus.PARTIAL_CONTENT:
await asyncio.to_thread(media_item.partial_file.unlink, missing_ok=True)
- if not media_item.datetime and (last_modified := get_last_modified(resp.headers)):
+ if (
+ not media_item.is_segment
+ and not media_item.datetime
+ and (last_modified := get_last_modified(resp.headers))
+ ):
msg = f"Unable to parse upload date for {media_item.url}, using `Last-Modified` header as file datetime"
log(msg, 30)
media_item.datetime = last_modified
diff --git a/cyberdrop_dl/downloader/downloader.py b/cyberdrop_dl/downloader/downloader.py
index 7a946cc0e..9f9efffbd 100644
--- a/cyberdrop_dl/downloader/downloader.py
+++ b/cyberdrop_dl/downloader/downloader.py
@@ -316,6 +316,9 @@ class Downloader:
async def set_file_datetime(self, media_item: MediaItem, complete_file: Path) -> None:
"""Sets the file's datetime."""
+ if media_item.is_segment:
+ return
+
if self.manager.config_manager.settings_data.download_options.disable_file_timestamps:
return
if not media_item.datetime: