From 45400749c3eebeee27013cde4d5ba2da11aa8355 Mon Sep 17 00:00:00 2001 From: Jules-WinnfieldX Date: Sun, 3 Dec 2023 21:24:32 -0700 Subject: [PATCH] Change config import to just copy contents of urls. --- cyberdrop_dl/__init__.py | 2 +- cyberdrop_dl/managers/path_manager.py | 3 --- cyberdrop_dl/utils/transfer/transfer_v4_config.py | 12 ++++++++++-- pyproject.toml | 2 +- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/cyberdrop_dl/__init__.py b/cyberdrop_dl/__init__.py index 3537f131b..a64c06dae 100644 --- a/cyberdrop_dl/__init__.py +++ b/cyberdrop_dl/__init__.py @@ -1 +1 @@ -__version__ = "5.0.11" +__version__ = "5.0.12" diff --git a/cyberdrop_dl/managers/path_manager.py b/cyberdrop_dl/managers/path_manager.py index 3a2a495be..be07a2360 100644 --- a/cyberdrop_dl/managers/path_manager.py +++ b/cyberdrop_dl/managers/path_manager.py @@ -49,7 +49,6 @@ def startup(self) -> None: self.download_dir = self.manager.config_manager.settings_data['Files']['download_folder'] self.sorted_dir = self.manager.config_manager.settings_data['Sorting']['sort_folder'] self.log_dir = self.manager.config_manager.settings_data['Logs']['log_folder'] - self.input_file = self.manager.config_manager.settings_data['Files']['input_file'] self.history_db = self.cache_dir / "cyberdrop.db" @@ -66,5 +65,3 @@ def startup(self) -> None: self.input_file.touch(exist_ok=True) self.history_db.touch(exist_ok=True) - - diff --git a/cyberdrop_dl/utils/transfer/transfer_v4_config.py b/cyberdrop_dl/utils/transfer/transfer_v4_config.py index e81adcf83..a5bb81623 100644 --- a/cyberdrop_dl/utils/transfer/transfer_v4_config.py +++ b/cyberdrop_dl/utils/transfer/transfer_v4_config.py @@ -112,11 +112,19 @@ def transfer_v4_config(manager: Manager, old_config_path: Path, new_config_name: old_urls_path = Path(old_data['Files']['input_file']) new_urls = manager.path_manager.config_dir / new_config_name / "URLs.txt" + new_urls.touch(exist_ok=True) + if old_urls_path.is_absolute(): - old_urls_path.rename(new_urls) + with open(str(old_urls_path), 'r') as urls_file: + urls = urls_file.readlines() + with open(new_urls, 'w') as urls_file: + urls_file.writelines(urls) elif len(old_urls_path.parts) == 1: if (old_config_path / old_urls_path.name).is_file(): - (old_config_path / old_urls_path.name).rename(new_urls) + with open(str(old_config_path / old_urls_path.name), 'r') as urls_file: + urls = urls_file.readlines() + with open(new_urls, 'w') as urls_file: + urls_file.writelines(urls) else: new_urls.touch(exist_ok=True) diff --git a/pyproject.toml b/pyproject.toml index 15b5f229f..63024b716 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "cyberdrop-dl" -version = "5.0.11" +version = "5.0.12" description = "Bulk downloader for multiple file hosts" authors = ["Jules Winnfield "] readme = "README.md"