Skip to content

Commit

Permalink
Added {first_letter} format
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
UltimaHoarder committed Mar 2, 2021
1 parent c2f0ed1 commit 04882f6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 3 additions & 1 deletion classes/prepare_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions helpers/main_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 04882f6

Please sign in to comment.