Bugfix/AV1 (#68)

- AV1 CF now correctly parses releases encoded in AV1
- Tests added to verify

---------

Co-authored-by: wheat4714.usedwhensimpleloginisbanned@gmail.com <wheat4714.usedwhensimpleloginisbanned@gmail.com>
Co-authored-by: santiagosayshey <sayheysantiago@proton.me>
This commit is contained in:
wheat4714
2024-05-19 03:45:39 +01:00
committed by GitHub
parent 4cb1b2b7cd
commit c9c2bd4e8e
18 changed files with 143 additions and 128 deletions

View File

@@ -9225,14 +9225,14 @@
]
},
{
"name": "AV-1",
"name": "AV1",
"includeCustomFormatWhenRenaming": false,
"specifications": [
{
"name": "AV-1",
"implementation": "ReleaseGroupSpecification",
"implementationName": "Release Group",
"infoLink": "https://wiki.servarr.com/radarr/settings#custom-formats-2",
"name": "AV1",
"implementation": "ReleaseTitleSpecification",
"implementationName": "Release Title",
"infoLink": "https://wiki.servarr.com/sonarr/settings#custom-formats-2",
"negate": false,
"required": true,
"fields": [
@@ -9241,7 +9241,7 @@
"name": "value",
"label": "Regular Expression",
"helpText": "Custom Format RegEx is Case Insensitive",
"value": "(?<=^|[\\s.-])AV-1\\b",
"value": "\\bAV1\\b",
"type": "textbox",
"advanced": false,
"privacy": "normal",

View File

@@ -6922,13 +6922,13 @@
]
},
{
"name": "AV-1",
"name": "AV1",
"includeCustomFormatWhenRenaming": false,
"specifications": [
{
"name": "AV-1",
"implementation": "ReleaseGroupSpecification",
"implementationName": "Release Group",
"name": "AV1",
"implementation": "ReleaseTitleSpecification",
"implementationName": "Release Title",
"infoLink": "https://wiki.servarr.com/sonarr/settings#custom-formats-2",
"negate": false,
"required": true,
@@ -6938,7 +6938,7 @@
"name": "value",
"label": "Regular Expression",
"helpText": "Custom Format RegEx is Case Insensitive",
"value": "(?<=^|[\\s.-])AV-1\\b",
"value": "\\bAV1\\b",
"type": "textbox",
"advanced": false,
"privacy": "normal",

View File

@@ -568,7 +568,7 @@
},
{
"format": 302,
"name": "AV-1",
"name": "AV1",
"score": -9999
},
{

View File

@@ -561,7 +561,7 @@
},
{
"format": 302,
"name": "AV-1",
"name": "AV1",
"score": -9999
},
{

View File

@@ -568,7 +568,7 @@
},
{
"format": 302,
"name": "AV-1",
"name": "AV1",
"score": -9999
},
{

View File

@@ -568,7 +568,7 @@
},
{
"format": 302,
"name": "AV-1",
"name": "AV1",
"score": -9999
},
{

View File

@@ -568,7 +568,7 @@
},
{
"format": 302,
"name": "AV-1",
"name": "AV1",
"score": -9999
},
{

View File

@@ -554,7 +554,7 @@
},
{
"format": 302,
"name": "AV-1",
"name": "AV1",
"score": -9999
},
{

View File

@@ -668,7 +668,7 @@
},
{
"format": 302,
"name": "AV-1",
"name": "AV1",
"score": -9999
},
{

View File

@@ -364,7 +364,7 @@
},
{
"format": 194,
"name": "AV-1",
"name": "AV1",
"score": -9999
},
{

View File

@@ -350,7 +350,7 @@
},
{
"format": 194,
"name": "AV-1",
"name": "AV1",
"score": -9999
},
{

View File

@@ -411,7 +411,7 @@
},
{
"format": 194,
"name": "AV-1",
"name": "AV1",
"score": -9999
},
{

View File

@@ -411,7 +411,7 @@
},
{
"format": 194,
"name": "AV-1",
"name": "AV1",
"score": -9999
},
{

View File

@@ -376,7 +376,7 @@
},
{
"format": 194,
"name": "AV-1",
"name": "AV1",
"score": -9999
},
{

View File

@@ -464,7 +464,7 @@
},
{
"format": 194,
"name": "AV-1",
"name": "AV1",
"score": -9999
},
{

116
tests/av1.py Normal file
View File

@@ -0,0 +1,116 @@
from extract import get_custom_format, get_regex
import re
import sys
# ANSI escape codes for colors
GREEN = '\033[92m'
RED = '\033[91m'
BLUE = '\033[94m'
ORANGE = '\033[38;5;208m'
RESET = '\033[0m'
good_matches = [
"HobyBuchanon.Rebecca.Vanguard.Sailor.Luna.Extreme.Sloppy.Gagging.Throat.Fuck.and.Throat.Pie.2019.12.20.1080p.AV1",
"TushyRaw.Emma.Rosie.Petite.Tight.Emma.Gets.Her.Tiny.Ass.Stretched.Out.TushyRaw.Emma.Rosie.Petite.Tight.Emma.Gets.Her.Tiny.Ass.Stretched.Out.2023.12.06.2160p.AV1.mp4",
"MILFY 24 05 15 Nikki Benz Ultimate MILF Nikki Cums Hard while Riding His Cock XXX 720p AV1 XLeech.mkv",
"MILFY 24 05 08 Medusa Fit Yoga MILF Medusa Rides Young Studs Cock All Day XXX 720p AV1 XLeech.mkv",
"Vixen 24 05 17 Blake Blossom Giselle Blanco Double Take XXX 720p AV1 XLeech.mkv",
"TouchMyWife 24 05 17 Addison Vodka Wife Wants the Younger Version XXX 720p AV1 XLeech.mkv",
"LoveHerAss 24 05 08 Clea Gaultier Big Tits Hot Ass Absolute Babe XXX 720p AV1 XLeech.mkv",
"Deeper 24 05 09 Lulu Chu Cop Shop XXX 720p AV1 XLeech.mkv",
"BreedMe 24 05 14 Payton Preslee Busty Brunette Payton Preslee XXX 720p AV1 XLeech.mkv",
"Freeze 24 05 03 Lia Lin When Shaman Calls XXX 720p AV1 XLeech.mkv",
"Oppenheimer 2023 BluRay 2160p UHD AV1 HDR10 DTS-HD MA 5.1 - PRL Waldek",
"Casino.Royale.2006.1080p.Bluray.OPUS.5.1.AV1-WhiskeyJack.mkv",
"Interstellar 2014 BluRay 2160p DTS HDMA5 1 AV1 10bit-CHD",
"Dune.Part.Two.2024.REPACK.1080p.BluRay.AV1.Opus.7.1.MULTi4-dAV1nci",
"Oppenheimer 2023 BluRay 2160p UHD AV1 HDR10 DTS-HD MA 5.1 - PRL Waldek",
"Guardians of the Galaxy Vol 3 2023 BluRay 2160p UHD AV1 HDR10 TrueHD 7.1 Atmos - PRL Waldek",
"Dune.Part.Two.2024.2160p.DV.HDR.BluRay.AV1.Opus.7.1.MULTi4-dAV1nci",
"AVATAR: THE WAY OF WATER [2022]1080p WEB DL[AV1][10 BIT][Atmos/E-AC3][RoB]",
"Godzilla.X.Kong.The.New.Empire.2024.Web-Dl.2160P.AV1",
"GREEN LANTERN EXTENDED CUT [2011]1080p BDRRip[10 BIT AV1][DTS-HD MA][RoB]",
"Resident Evil Death Island 2023 1080p English AAC AV1",
"Bird Box (2018) 1080p DS4K NF WEBRip AV1 Opus 5.1 [Retr0]",
"The Banshees of Inisherin (2022) 1080p DS4K MA WEBRip AV1 Opus 5.1 [Retr0]",
"Once Upon a Studio (2023) DS4K 1080p DSNP WEBRip AV1 Opus 5.1 [RAV1NE]",
"24 Jam Bersama Gaspar (2024) INDONESIAN DS4K 1080p NF WEBRip AV1 Opus 5.1 [RAV1NE]",
"THE HUNGER GAMES QUADRILOGY [4K UHD BDRip][10 BIT AV1][HDR][ATMOS/TrueHD][RoB]",
"AVATAR: THE WAY OF WATER [2022]1080p WEB DL[AV1][10 BIT][Atmos/E-AC3][RoB]",
"Rebel Moon Part One-A Child of Fire 2023 720p AV1-Zero00",
"[Copernicus] Chainsaw Man - S01E02 [BDRip][1080p][AV1-10bit]",
"Scavengers.Reign.S01e05.The.Demeter.Opus.AV1"
]
bad_matches = [
]
def AV1(debug_level=0):
# Get the custom formats for "AV1" from both Radarr and Sonarr
AV1_radarr = get_custom_format("AV1", "radarr", debug_level)
AV1_sonarr = get_custom_format("AV1", "sonarr", debug_level)
# Extract the regex values for both Radarr and Sonarr using get_regex
AV1_value_radarr = get_regex(AV1_radarr, "AV1", debug_level)
AV1_value_sonarr = get_regex(AV1_sonarr, "AV1", debug_level)
# Replace the negative lookbehind with a negative lookahead
AV1_value_radarr = AV1_value_radarr.replace(r"(?<=^|[\s.-])", r"(?:^|[\s.-])")
AV1_value_sonarr = AV1_value_sonarr.replace(r"(?<=^|[\s.-])", r"(?:^|[\s.-])")
if debug_level > 0:
print(f"Testing with regex: {ORANGE}{AV1_value_radarr}{RESET}\n")
# Compare Radarr and Sonarr AV1 regex values
if AV1_value_radarr != AV1_value_sonarr:
print("Test Failed: regex value not same.")
print(f"Radarr regex: {AV1_value_radarr}")
print(f"Sonarr regex: {AV1_value_sonarr}")
good_matches_passed = []
good_matches_failed = []
bad_matches_passed = []
bad_matches_failed = []
print("Checking good matches:")
# Test good matches
for release in good_matches:
if re.search(AV1_value_radarr, release, re.IGNORECASE):
good_matches_passed.append(release)
print(f" - {release}: {GREEN}Passed{RESET}")
else:
good_matches_failed.append(release)
print(f" - {release}: {RED}Failed{RESET}")
print("\nChecking bad matches:")
# Test bad matches
for release in bad_matches:
if re.search(AV1_value_radarr, release, re.IGNORECASE):
bad_matches_passed.append(release)
print(f" - {release}: {RED}Failed{RESET}")
else:
bad_matches_failed.append(release)
print(f" - {release}: {GREEN}Passed{RESET}")
print("\nFailed matches:")
if good_matches_failed or bad_matches_passed:
for release in good_matches_failed + bad_matches_passed:
print(f" - {release}")
else:
print(f"{GREEN}None, Great Job! :){RESET}")
total_matches = len(good_matches) + len(bad_matches)
passed_matches = len(good_matches_passed) + len(bad_matches_failed)
success_rate = (passed_matches / total_matches) * 100
print("\nStats:")
print(f"Total: {total_matches}")
print(f"Bad: {len(bad_matches_passed) + len(good_matches_failed)}")
print(f"Rate: {success_rate:.2f}%")
if success_rate >= 99.8:
return True
else:
return False

View File

@@ -2,9 +2,9 @@ import sys
from roku import roku
from h265verify import h265
from qxr import qxr
from utr import utr
from taoe import taoe
from ralphy import Ralphy
from av1 import AV1
# ... import other test functions
# ANSI escape codes for colors
@@ -19,9 +19,9 @@ def run_tests():
("ROKU", roku),
("h265 Verified Groups", h265),
("QxR Groups", qxr),
("UTR Groups", utr),
("TAoE Groups", taoe),
("Ralphy", Ralphy)
("Ralphy", Ralphy),
("AV1", AV1),
# ... add other test functions
]

View File

@@ -1,101 +0,0 @@
from extract import get_custom_format, get_regex
import re
import sys
# ANSI escape codes for colors
GREEN = '\033[92m'
RED = '\033[91m'
RESET = '\033[0m'
def utr(debug_level=0):
# Define good and bad matches for Radarr and Sonarr
radarr_good_matches = [
"Brigsby Bear (2017) (1080p BluRay x265 SDR AAC 5.1 English - Tigole UTR)",
"Risky Business (1983) (1080p BluRay x265 SDR AAC 5.1 English - FreetheFish UTR)",
"Labyrinth (1986) 30th Anniversary (1080p BluRay x265 SDR AAC 7.1 English - Tigole UTR)",
"Love Actually (2003) (1080p BluRay x265 SDR AAC 5.1 English - Tigole UTR)"
]
radarr_bad_matches = [
"Eva.Soda.Utroskab.med.den.første.kvinde.i.bilen.Sex.i.bilen.6462a7a8a5d9e.",
"Outrage.1950.1080p.BluRay.Flac.2.0.x265.HEVC-Nb8.mkv",
"Utro 1966 DANiSH 720p WEB-DL H 264 AAC2 0-TWA"
]
sonarr_good_matches = [
"The Simpsons (1989) S07 (480p DVD x265 SDR AAC 5.1 English - ImE UTR)",
"The Simpsons (1989) S14 (1080p BluRay x265 SDR AAC 5.1 English - ImE UTR)"
]
sonarr_bad_matches = [
"The.Outreau.Case.A.French.Nightmare.S01E01.The.Renard.Block.1080p.NF.WEB-DL.DDP5.1.H.264-NTb.mkv",
"The.Outreau.Case.A.French.Nightmare.S01.1080p.NF.WEB-DL.DDP5.1.H.264-NTb"
]
# Get the custom formats for "qxr" from both Radarr and Sonarr
qxr_radarr = get_custom_format("qxr", "radarr", debug_level)
qxr_sonarr = get_custom_format("qxr", "sonarr", debug_level)
# Extract the regex values for both Radarr and Sonarr using get_regex
UTR_value_radarr = get_regex(qxr_radarr, "UTR (Title)", debug_level)
UTR_value_sonarr = get_regex(qxr_sonarr, "UTR (Title)", debug_level)
# Replace the negative lookbehind with a negative lookahead if necessary
UTR_value_radarr = UTR_value_radarr.replace("(?<=^|[\\s.-])", "(?:^|[\\s.-])")
UTR_value_sonarr = UTR_value_sonarr.replace("(?<=^|[\\s.-])", "(?:^|[\\s.-])")
if debug_level > 0:
print(f"Testing with regex: {UTR_value_radarr}")
# Compare Radarr and Sonarr qxr regex values
if UTR_value_radarr != UTR_value_sonarr:
print("Test Failed: regex value not same.")
print(f"Radarr regex: {UTR_value_radarr}")
print(f"Sonarr regex: {UTR_value_sonarr}")
sys.exit(1)
failed_good_matches = []
failed_bad_matches = []
# Print Radarr Good Matches
print("\nRadarr Releases:")
print("----------------")
print("Should Match:")
for term in radarr_good_matches:
if re.search(UTR_value_radarr, term, re.IGNORECASE):
print(f" - {term}: {GREEN}Passed{RESET}")
else:
failed_good_matches.append(("Radarr", term))
print(f" - {term}: {RED}Failed{RESET}")
# Print Radarr Bad Matches
print("\nShould NOT Match:")
for term in radarr_bad_matches:
if not re.search(UTR_value_radarr, term, re.IGNORECASE):
print(f" - {term}: {GREEN}Passed{RESET}")
else:
failed_bad_matches.append(("Radarr", term))
print(f" - {term}: {RED}Failed{RESET}")
# Print Sonarr Good Matches
print("\nSonarr Releases:")
print("----------------")
print("Should Match:")
for term in sonarr_good_matches:
if re.search(UTR_value_sonarr, term, re.IGNORECASE):
print(f" - {term}: {GREEN}Passed{RESET}")
else:
failed_good_matches.append(("Sonarr", term))
print(f" - {term}: {RED}Failed{RESET}")
# Print Sonarr Bad Matches
print("\nShould NOT Match:")
for term in sonarr_bad_matches:
if not re.search(UTR_value_sonarr, term, re.IGNORECASE):
print(f" - {term}: {GREEN}Passed{RESET}")
else:
failed_bad_matches.append(("Sonarr", term))
print(f" - {term}: {RED}Failed{RESET}")
# Determine and print overall test result
if not failed_good_matches and not failed_bad_matches:
return True
else:
return False