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

Commit

Permalink
--remove-domains-from-folder-names
Browse files Browse the repository at this point in the history
  • Loading branch information
Jules-WinnfieldX committed Dec 5, 2023
1 parent e7e0df2 commit 5f078f7
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 11 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.44"
__version__ = "5.0.45"
16 changes: 9 additions & 7 deletions cyberdrop_dl/scraper/crawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion cyberdrop_dl/scraper/crawlers/coomer_crawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
3 changes: 2 additions & 1 deletion cyberdrop_dl/scraper/crawlers/kemono_crawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
1 change: 1 addition & 0 deletions cyberdrop_dl/utils/args/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
1 change: 1 addition & 0 deletions cyberdrop_dl/utils/args/config_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
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.44"
version = "5.0.45"
description = "Bulk downloader for multiple file hosts"
authors = ["Jules Winnfield <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit 5f078f7

Please sign in to comment.