Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
Change config import to just copy contents of urls.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jules-WinnfieldX committed Dec 4, 2023
1 parent f3c8faa commit 4540074
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cyberdrop_dl/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "5.0.11"
__version__ = "5.0.12"
3 changes: 0 additions & 3 deletions cyberdrop_dl/managers/path_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -66,5 +65,3 @@ def startup(self) -> None:

self.input_file.touch(exist_ok=True)
self.history_db.touch(exist_ok=True)


12 changes: 10 additions & 2 deletions cyberdrop_dl/utils/transfer/transfer_v4_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit 4540074

Please sign in to comment.