From 04882f688cd95f2119ead70cf48d9764250e5a1d Mon Sep 17 00:00:00 2001 From: CRIMINAL Date: Tue, 2 Mar 2021 07:27:31 +0000 Subject: [PATCH] Added {first_letter} format Alphabetical sorting for your model folder. model_username = belledelphine {first_letter} = B (Will always be capitalised) Useful if you have thousands of models and you'd like some sort of pagination so your drive doesn't come to complete halt. Network drives have a huge benefit as well, such as a smaller cache and load. --- README.md | 2 ++ classes/prepare_metadata.py | 4 +++- helpers/main_helper.py | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d9ae40453..d0c847aab 100644 --- a/README.md +++ b/README.md @@ -124,6 +124,8 @@ Overview for [file_directory_format](#file_directory_format), [filename_format]( {site_name} = The site you're scraping. + {first_letter} = First letter of the model you're scraping. + {post_id} = The posts' ID. {media_id} = The media's ID. diff --git a/classes/prepare_metadata.py b/classes/prepare_metadata.py index 63fdf5521..82011c975 100644 --- a/classes/prepare_metadata.py +++ b/classes/prepare_metadata.py @@ -236,6 +236,7 @@ def __iter__(self): class format_variables(object): def __init__(self): self.site_name = "{site_name}" + self.first_letter = "{first_letter}" self.post_id = "{post_id}" self.media_id = "{media_id}" self.username = "{username}" @@ -290,7 +291,8 @@ def check_rules(self): if b in self.filename_format: invalid_list.append(b) if key == "metadata_directory_format": - wl = ["{site_name}", "{model_id}", "{username}"] + wl = ["{site_name}", "{first_letter}", + "{model_id}", "{username}"] bl = format_variables().whitelist(wl) invalid_list = [] for b in bl: diff --git a/helpers/main_helper.py b/helpers/main_helper.py index 51307d9b5..1714dcec8 100644 --- a/helpers/main_helper.py +++ b/helpers/main_helper.py @@ -329,6 +329,7 @@ def reformat(prepared_format, unformatted): value = "Paid" directory = prepared_format.directory path = unformatted.replace("{site_name}", prepared_format.site_name) + path = path.replace("{first_letter}", prepared_format.username[0].capitalize()) path = path.replace("{post_id}", post_id) path = path.replace("{media_id}", media_id) path = path.replace("{username}", prepared_format.username)