From 6e53bdf790cd93a06e98f01236356836a3ce4299 Mon Sep 17 00:00:00 2001 From: feederbox826 <144178721+feederbox826@users.noreply.github.com> Date: Fri, 1 Dec 2023 18:56:44 -0500 Subject: [PATCH] 1.3.2 beta for disable_NKFD and trailer detection --- SHALookup.py | 10 +++++++--- config.py.example | 3 ++- oftitle.py | 43 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 4 deletions(-) create mode 100644 oftitle.py diff --git a/SHALookup.py b/SHALookup.py index f3b0882..2ea7c9f 100644 --- a/SHALookup.py +++ b/SHALookup.py @@ -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: @@ -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() @@ -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): diff --git a/config.py.example b/config.py.example index c515325..4747df7 100644 --- a/config.py.example +++ b/config.py.example @@ -5,4 +5,5 @@ stashconfig = { "ApiKey": "", } success_tag = "[SHA: Scraped]" -failure_tag = "[SHA: No Match]" \ No newline at end of file +failure_tag = "[SHA: No Match]" +disable_nfkd = false \ No newline at end of file diff --git a/oftitle.py b/oftitle.py new file mode 100644 index 0000000..71c9922 --- /dev/null +++ b/oftitle.py @@ -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 \ No newline at end of file