diff --git a/cyberdrop_dl/__init__.py b/cyberdrop_dl/__init__.py index 6f8ae5c30..6b444dfce 100644 --- a/cyberdrop_dl/__init__.py +++ b/cyberdrop_dl/__init__.py @@ -1 +1 @@ -__version__ = "5.0.44" +__version__ = "5.0.45" diff --git a/cyberdrop_dl/scraper/crawler.py b/cyberdrop_dl/scraper/crawler.py index 3aa29e3f0..3398c7820 100644 --- a/cyberdrop_dl/scraper/crawler.py +++ b/cyberdrop_dl/scraper/crawler.py @@ -159,14 +159,16 @@ async def create_scrape_item(self, parent_scrape_item: ScrapeItem, url: URL, new async def create_title(self, title: str, album_id: Optional[str], thread_id: Optional[str]) -> str: """Creates the title for the scrape item""" + title = title.strip() if self.manager.config_manager.settings_data['Download_Options']['include_album_id_in_folder_name']: - if not album_id: - return title.strip() + f" ({self.folder_domain})" - return title.strip() + f" {album_id} ({self.folder_domain})" + if album_id: + title = f"{title} {album_id}" if self.manager.config_manager.settings_data['Download_Options']['include_thread_id_in_folder_name']: - if not thread_id: - return title.strip() + f" ({self.folder_domain})" - return title.strip() + f" {thread_id} ({self.folder_domain})" + if thread_id: + title = f"{title} {thread_id}" - return title.strip() + f" ({self.folder_domain})" + if not self.manager.config_manager.settings_data['Download_Options']['remove_domains_from_folder_names']: + title = f"{title} ({self.folder_domain})" + + return title diff --git a/cyberdrop_dl/scraper/crawlers/coomer_crawler.py b/cyberdrop_dl/scraper/crawlers/coomer_crawler.py index 20cb6962e..cf6f0c468 100644 --- a/cyberdrop_dl/scraper/crawlers/coomer_crawler.py +++ b/cyberdrop_dl/scraper/crawlers/coomer_crawler.py @@ -148,7 +148,8 @@ async def create_new_scrape_item(self, link: URL, old_scrape_item: ScrapeItem, u if self.manager.config_manager.settings_data['Download_Options']['include_album_id_in_folder_name']: post_title = post_id + " - " + post_title - new_scrape_item = await self.create_scrape_item(old_scrape_item, link, f"{user} ({self.folder_domain})", True, await self.parse_datetime(date)) + new_title = await self.create_title(user, None, None) + new_scrape_item = await self.create_scrape_item(old_scrape_item, link, new_title, True, await self.parse_datetime(date)) await new_scrape_item.add_to_parent_title(post_title) await self.scraper_queue.put(new_scrape_item) diff --git a/cyberdrop_dl/scraper/crawlers/kemono_crawler.py b/cyberdrop_dl/scraper/crawlers/kemono_crawler.py index 9209e3524..edee492b3 100644 --- a/cyberdrop_dl/scraper/crawlers/kemono_crawler.py +++ b/cyberdrop_dl/scraper/crawlers/kemono_crawler.py @@ -145,7 +145,8 @@ async def create_new_scrape_item(self, link: URL, old_scrape_item: ScrapeItem, u if self.manager.config_manager.settings_data['Download_Options']['include_album_id_in_folder_name']: post_title = post_id + " - " + post_title - new_scrape_item = await self.create_scrape_item(old_scrape_item, link, f"{user} ({self.folder_domain})", True, await self.parse_datetime(date)) + new_title = await self.create_title(user, None, None) + new_scrape_item = await self.create_scrape_item(old_scrape_item, link, new_title, True, await self.parse_datetime(date)) await new_scrape_item.add_to_parent_title(post_title) await self.scraper_queue.put(new_scrape_item) diff --git a/cyberdrop_dl/utils/args/args.py b/cyberdrop_dl/utils/args/args.py index 59c203f9c..603761bc7 100644 --- a/cyberdrop_dl/utils/args/args.py +++ b/cyberdrop_dl/utils/args/args.py @@ -28,6 +28,7 @@ def parse_args() -> argparse.Namespace: download_options.add_argument("--disable-file-timestamps", action="store_true", help="disable file timestamps", default=False) download_options.add_argument("--include-album-id-in-folder-name", action="store_true", help="include album id in folder name", default=False) download_options.add_argument("--include-thread-id-in-folder-name", action="store_true", help="include thread id in folder name", default=False) + download_options.add_argument("--remove-domains-from-folder-names", action="store_true", help="remove website domains from folder names", default=False) download_options.add_argument("--remove-generated-id-from-filenames", action="store_true", help="remove site generated id from filenames", default=False) download_options.add_argument("--skip-download-mark-completed", action="store_true", help="skip download and mark as completed in history", default=False) diff --git a/cyberdrop_dl/utils/args/config_definitions.py b/cyberdrop_dl/utils/args/config_definitions.py index 18da1c503..b6b8c1f8a 100644 --- a/cyberdrop_dl/utils/args/config_definitions.py +++ b/cyberdrop_dl/utils/args/config_definitions.py @@ -64,6 +64,7 @@ "disable_file_timestamps": False, "include_album_id_in_folder_name": False, "include_thread_id_in_folder_name": False, + "remove_domains_from_folder_names": False, "remove_generated_id_from_filenames": False, "scrape_single_forum_post": False, "separate_posts": False, diff --git a/pyproject.toml b/pyproject.toml index b1c7fba79..87ed2eabc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "cyberdrop-dl" -version = "5.0.44" +version = "5.0.45" description = "Bulk downloader for multiple file hosts" authors = ["Jules Winnfield "] readme = "README.md"