Skip to content
This repository has been archived by the owner on Jan 2, 2025. It is now read-only.

Commit

Permalink
1.3.2 beta for disable_NKFD and trailer detection
Browse files Browse the repository at this point in the history
  • Loading branch information
feederbox826 committed Dec 1, 2023
1 parent 4e60e36 commit 6e53bdf
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 4 deletions.
10 changes: 7 additions & 3 deletions SHALookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
from unicodedata import normalize
from confusables import remove
from sqlite import lookup_sha, add_sha256, setup_sqlite
from oftitle import findTrailerTrigger

from config import stashconfig, success_tag, failure_tag
VERSION = "1.3.1"
from config import stashconfig, success_tag, failure_tag, disable_nfkd
VERSION = "1.3.2-beta"
MAX_TITLE_LENGTH = 64

try:
Expand Down Expand Up @@ -113,7 +114,7 @@ def truncate_title(title, max_length):
return title[:title_end]

def normalize_title(title):
normalized = normalize("NFKD", title)
normalized = title if disable_nfkd == True else normalize("NFKD", title)
unconfused = remove(normalized)
return unconfused.strip()

Expand Down Expand Up @@ -220,6 +221,9 @@ def parseOnlyFans(scene, hash):
# add studio and performer
result['Studio']['Name'] = f"{username} (OnlyFans)"
result['Performers'].append({ 'Name': getnamefromalias(username) })
# add trailer tag if contains keywords
if findTrailerTrigger(result['Details']):
result['Tags'].append({ "Name": 'Trailer' })
return result

def sql_hash_file(scene):
Expand Down
3 changes: 2 additions & 1 deletion config.py.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ stashconfig = {
"ApiKey": "",
}
success_tag = "[SHA: Scraped]"
failure_tag = "[SHA: No Match]"
failure_tag = "[SHA: No Match]"
disable_nfkd = false
43 changes: 43 additions & 0 deletions oftitle.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import re

dmRegex = "(?:^\s|[^\w])(dm)(?:s)(?:$\s|[^\w])"
triggerArray = [
# DM / in your DMs
"dm",
"dms"
"inbox",
"messages"
# sending
"sending you",
"sending this",
# partial video
"teaser",
"snippet",
"entire",
"full video"
# message prompts
"with the message",
"message me",
"send me"
# unlocking
"unlock",
"receive it",
"purchase",
# tipping
"under this post",
"tip",
# rebill
"rebills",
"rebillers",
]

def findTrailerTrigger(oftitle):
# check regex
if re.search(dmRegex, oftitle, re.IGNORECASE):
return True
# check other regex array
for trigger in triggerArray:
triggerRegex = "(?:^|\s)(" + trigger + ")(?:$|\s)"
if re.search(triggerRegex, oftitle, re.IGNORECASE):
return True
return False

0 comments on commit 6e53bdf

Please sign in to comment.