From f8d8b8e60a382d6056564dbace3fd8378b67c633 Mon Sep 17 00:00:00 2001 From: thezoggy <500882+thezoggy@users.noreply.github.com> Date: Thu, 30 May 2024 01:19:28 -0500 Subject: [PATCH] fix(guide): Update Clean.py for py3.12 and apply updates (#1953) Fixes SyntaxWarning thrown by python 3.12, update sync up nzbget from updates from sab version --- .../Downloaders/NZBGet/scripts/Clean/Clean.py | 51 +++++++++-------- .../SABnzbd/scripts/Clean/Clean.py | 55 +++++++++---------- 2 files changed, 55 insertions(+), 51 deletions(-) diff --git a/docs/Downloaders/NZBGet/scripts/Clean/Clean.py b/docs/Downloaders/NZBGet/scripts/Clean/Clean.py index d5ea3242b..5adb955fd 100644 --- a/docs/Downloaders/NZBGet/scripts/Clean/Clean.py +++ b/docs/Downloaders/NZBGet/scripts/Clean/Clean.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# ############################################################################## ### NZBGET SCAN SCRIPT ### @@ -33,28 +32,34 @@ if not "NZBNP_NZBNAME" in os.environ: sys.exit(POSTPROCESS_ERROR) fwp = os.environ["NZBNP_NZBNAME"] -fwp = re.sub("(?i)-4P\.nzb$", ".nzb", fwp) -fwp = re.sub("(?i)-4Planet\.nzb$", ".nzb", fwp) -fwp = re.sub("(?i)-AsRequested\.nzb$", ".nzb", fwp) -fwp = re.sub("(?i)-AsRequested-xpost\.nzb$", ".nzb", fwp) -fwp = re.sub("(?i)-BUYMORE\.nzb$", ".nzb", fwp) -fwp = re.sub("(?i)-Chamele0n\.nzb$", ".nzb", fwp) -fwp = re.sub("(?i)-GEROV\.nzb$", ".nzb", fwp) -fwp = re.sub("(?i)-iNC0GNiTO\.nzb$", ".nzb", fwp) -fwp = re.sub("(?i)-NZBGeek\.nzb$", ".nzb", fwp) -fwp = re.sub("(?i)-Obfuscated\.nzb$", ".nzb", fwp) -fwp = re.sub("(?i)-postbot\.nzb$", ".nzb", fwp) -fwp = re.sub("(?i)-Rakuv\.nzb$", ".nzb", fwp) -fwp = re.sub("(?i)-Scrambled\.nzb$", ".nzb", fwp) -fwp = re.sub("(?i)-WhiteRev\.nzb$", ".nzb", fwp) -fwp = re.sub("(?i)-xpost\.nzb$", ".nzb", fwp) -fwp = re.sub("(?i)\[eztv([ ._-]re)?\]\.nzb$", ".nzb", fwp) -fwp = re.sub("(?i)\[TGx\]\.nzb$", ".nzb", fwp) -fwp = re.sub("(?i)\[TGx\]-xpost\.nzb$", ".nzb", fwp) -fwp = re.sub("(?i)\[ettv\]\.nzb$", ".nzb", fwp) -fwp = re.sub("(?i)-WRTEAM\.nzb$", ".nzb", fwp) -fwp = re.sub("(?i)-CAPTCHA\.nzb$", ".nzb", fwp) -fwp = re.sub(r"(\-[^-.\n]*)(\-.{4})?\.nzb$", r"\1.nzb", fwp) +fwp = re.sub(r"(?i)-4P\.nzb$", ".nzb", fwp) +fwp = re.sub(r"(?i)-4Planet\.nzb$", ".nzb", fwp) +fwp = re.sub(r"(?i)-AlternativeToRequested\.nzb$", ".nzb", fwp) +fwp = re.sub(r"(?i)-AlteZachen\.nzb$", ".nzb", fwp) +fwp = re.sub(r"(?i)-AsRequested\.nzb$", ".nzb", fwp) +fwp = re.sub(r"(?i)-AsRequested-xpost\.nzb$", ".nzb", fwp) +fwp = re.sub(r"(?i)-BUYMORE\.nzb$", ".nzb", fwp) +fwp = re.sub(r"(?i)-Chamele0n\.nzb$", ".nzb", fwp) +fwp = re.sub(r"(?i)-GEROV\.nzb$", ".nzb", fwp) +fwp = re.sub(r"(?i)-iNC0GNiTO\.nzb$", ".nzb", fwp) +fwp = re.sub(r"(?i)-NZBGeek\.nzb$", ".nzb", fwp) +fwp = re.sub(r"(?i)-Obfuscated\.nzb$", ".nzb", fwp) +fwp = re.sub(r"(?i)-Obfuscation\.nzb$", ".nzb", fwp) +fwp = re.sub(r"(?i)-postbot\.nzb$", ".nzb", fwp) +fwp = re.sub(r"(?i)-Rakuv[a-z0-9]*\.nzb$", ".nzb", fwp) +fwp = re.sub(r"(?i)-RePACKPOST\.nzb$", ".nzb", fwp) +fwp = re.sub(r"(?i)-Scrambled\.nzb$", ".nzb", fwp) +fwp = re.sub(r"(?i)-WhiteRev\.nzb$", ".nzb", fwp) +fwp = re.sub(r"(?i)-WRTEAM\.nzb$", ".nzb", fwp) +fwp = re.sub(r"(?i)-CAPTCHA\.nzb$", ".nzb", fwp) +fwp = re.sub(r"(?i)-Z0iDS3N\.nzb$", ".nzb", fwp) +fwp = re.sub(r"(?i)\[eztv([ ._-]re)?\]\.nzb$", ".nzb", fwp) +fwp = re.sub(r"(?i)\[TGx\]\.nzb$", ".nzb", fwp) +fwp = re.sub(r"(?i)\[ettv\]\.nzb$", ".nzb", fwp) +fwp = re.sub(r"(?i)\[TGx\]-xpost\.nzb$", ".nzb", fwp) +fwp = re.sub(r"(?i).mkv-xpost\.nzb$", ".nzb", fwp) +fwp = re.sub(r"(?i)-xpost\.nzb$", ".nzb", fwp) +fwp = re.sub(r"(?i)(-D-Z0N3|\-[^-.\n]*)(\-.{4})?\.nzb$", r"\1.nzb", fwp) if fwp: print("[NZB] NZBNAME=", fwp, sep="") diff --git a/docs/Downloaders/SABnzbd/scripts/Clean/Clean.py b/docs/Downloaders/SABnzbd/scripts/Clean/Clean.py index 4916162ec..eccb70c1e 100644 --- a/docs/Downloaders/SABnzbd/scripts/Clean/Clean.py +++ b/docs/Downloaders/SABnzbd/scripts/Clean/Clean.py @@ -3,7 +3,6 @@ ################################################################## ### SABnzbd - Clean NZB Renamer ## ################################################################## -## NOTE: This script is considered ALPHA! ## ## ## ## Removes the suffixes from NZB name used by bots: ## ## examples: NZBgeek / Obfuscated / BUYMORE / Scrambled, etc.. ## @@ -38,33 +37,33 @@ except: sys.exit(1) # exit with 1 causes SABnzbd to ignore the output of this script fwp = nzbname -fwp = re.sub("(?i)-4P$", "", fwp) -fwp = re.sub("(?i)-4Planet$", "", fwp) -fwp = re.sub("(?i)-AlternativeToRequested$", "", fwp) -fwp = re.sub("(?i)-AlteZachen$", "", fwp) -fwp = re.sub("(?i)-AsRequested$", "", fwp) -fwp = re.sub("(?i)-AsRequested-xpost$", "", fwp) -fwp = re.sub("(?i)-BUYMORE$", "", fwp) -fwp = re.sub("(?i)-Chamele0n$", "", fwp) -fwp = re.sub("(?i)-GEROV$", "", fwp) -fwp = re.sub("(?i)-iNC0GNiTO$", "", fwp) -fwp = re.sub("(?i)-NZBGeek$", "", fwp) -fwp = re.sub("(?i)-Obfuscated$", "", fwp) -fwp = re.sub("(?i)-Obfuscation$", "", fwp) -fwp = re.sub("(?i)-postbot$", "", fwp) -fwp = re.sub("(?i)-Rakuv[a-z0-9]*$", "", fwp) -fwp = re.sub("(?i)-RePACKPOST$", "", fwp) -fwp = re.sub("(?i)-Scrambled$", "", fwp) -fwp = re.sub("(?i)-WhiteRev$", "", fwp) -fwp = re.sub("(?i)-WRTEAM$", "", fwp) -fwp = re.sub("(?i)-CAPTCHA$", "", fwp) -fwp = re.sub("(?i)-Z0iDS3N$", "", fwp) -fwp = re.sub("(?i)\[eztv([ ._-]re)?\]$", "", fwp) -fwp = re.sub("(?i)\[TGx\]$", "", fwp) -fwp = re.sub("(?i)\[ettv\]$", "", fwp) -fwp = re.sub("(?i)\[TGx\]-xpost$", "", fwp) -fwp = re.sub("(?i).mkv-xpost$", "", fwp) -fwp = re.sub("(?i)-xpost$", "", fwp) +fwp = re.sub(r"(?i)-4P$", "", fwp) +fwp = re.sub(r"(?i)-4Planet$", "", fwp) +fwp = re.sub(r"(?i)-AlternativeToRequested$", "", fwp) +fwp = re.sub(r"(?i)-AlteZachen$", "", fwp) +fwp = re.sub(r"(?i)-AsRequested$", "", fwp) +fwp = re.sub(r"(?i)-AsRequested-xpost$", "", fwp) +fwp = re.sub(r"(?i)-BUYMORE$", "", fwp) +fwp = re.sub(r"(?i)-Chamele0n$", "", fwp) +fwp = re.sub(r"(?i)-GEROV$", "", fwp) +fwp = re.sub(r"(?i)-iNC0GNiTO$", "", fwp) +fwp = re.sub(r"(?i)-NZBGeek$", "", fwp) +fwp = re.sub(r"(?i)-Obfuscated$", "", fwp) +fwp = re.sub(r"(?i)-Obfuscation$", "", fwp) +fwp = re.sub(r"(?i)-postbot$", "", fwp) +fwp = re.sub(r"(?i)-Rakuv[a-z0-9]*$", "", fwp) +fwp = re.sub(r"(?i)-RePACKPOST$", "", fwp) +fwp = re.sub(r"(?i)-Scrambled$", "", fwp) +fwp = re.sub(r"(?i)-WhiteRev$", "", fwp) +fwp = re.sub(r"(?i)-WRTEAM$", "", fwp) +fwp = re.sub(r"(?i)-CAPTCHA$", "", fwp) +fwp = re.sub(r"(?i)-Z0iDS3N$", "", fwp) +fwp = re.sub(r"(?i)\[eztv([ ._-]re)?\]$", "", fwp) +fwp = re.sub(r"(?i)\[TGx\]$", "", fwp) +fwp = re.sub(r"(?i)\[ettv\]$", "", fwp) +fwp = re.sub(r"(?i)\[TGx\]-xpost$", "", fwp) +fwp = re.sub(r"(?i).mkv-xpost$", "", fwp) +fwp = re.sub(r"(?i)-xpost$", "", fwp) fwp = re.sub(r"(?i)(-D-Z0N3|\-[^-.\n]*)(\-.{4})?$", r"\1", fwp) print("1") # Accept