mirror of
https://github.com/Dictionarry-Hub/profilarr.git
synced 2026-01-28 05:20:57 +01:00
Imrpovement/Sev Overhaul (#67)
- Overhauled SEV CF. Included member names, and negated UTR. - Included SEV Tests --------- Co-authored-by: wheat4714.usedwhensimpleloginisbanned@gmail.com <wheat4714.usedwhensimpleloginisbanned@gmail.com> Co-authored-by: santiagosayshey <sayheysantiago@proton.me>
This commit is contained in:
@@ -14671,10 +14671,10 @@
|
||||
"includeCustomFormatWhenRenaming": false,
|
||||
"specifications": [
|
||||
{
|
||||
"name": "SEV",
|
||||
"implementation": "ReleaseGroupSpecification",
|
||||
"implementationName": "Release Group",
|
||||
"infoLink": "https://wiki.servarr.com/radarr/settings#custom-formats-2",
|
||||
"name": "x265",
|
||||
"implementation": "ReleaseTitleSpecification",
|
||||
"implementationName": "Release Title",
|
||||
"infoLink": "https://wiki.servarr.com/sonarr/settings#custom-formats-2",
|
||||
"negate": false,
|
||||
"required": true,
|
||||
"fields": [
|
||||
@@ -14683,7 +14683,91 @@
|
||||
"name": "value",
|
||||
"label": "Regular Expression",
|
||||
"helpText": "Custom Format RegEx is Case Insensitive",
|
||||
"value": "(?<=^|[\\s.-])SEV\\b",
|
||||
"value": "^(?!.*(?i:remux))(?=.*(\\b[x]\\s?(\\.?265)\\b|HEVC)).*$",
|
||||
"type": "textbox",
|
||||
"advanced": false,
|
||||
"privacy": "normal",
|
||||
"isFloat": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Goki",
|
||||
"implementation": "ReleaseTitleSpecification",
|
||||
"implementationName": "Release Title",
|
||||
"infoLink": "https://wiki.servarr.com/sonarr/settings#custom-formats-2",
|
||||
"negate": true,
|
||||
"required": true,
|
||||
"fields": [
|
||||
{
|
||||
"order": 0,
|
||||
"name": "value",
|
||||
"label": "Regular Expression",
|
||||
"helpText": "Custom Format RegEx is Case Insensitive",
|
||||
"value": "\\b(goki)\\b",
|
||||
"type": "textbox",
|
||||
"advanced": false,
|
||||
"privacy": "normal",
|
||||
"isFloat": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "UTR",
|
||||
"implementation": "ReleaseTitleSpecification",
|
||||
"implementationName": "Release Title",
|
||||
"infoLink": "https://wiki.servarr.com/sonarr/settings#custom-formats-2",
|
||||
"negate": true,
|
||||
"required": true,
|
||||
"fields": [
|
||||
{
|
||||
"order": 0,
|
||||
"name": "value",
|
||||
"label": "Regular Expression",
|
||||
"helpText": "Custom Format RegEx is Case Insensitive",
|
||||
"value": "(?:^|[\\s.-])(UTR)(?![.\\d])\\b",
|
||||
"type": "textbox",
|
||||
"advanced": false,
|
||||
"privacy": "normal",
|
||||
"isFloat": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "UTR",
|
||||
"implementation": "ReleaseGroupSpecification",
|
||||
"implementationName": "Release Group",
|
||||
"infoLink": "https://wiki.servarr.com/sonarr/settings#custom-formats-2",
|
||||
"negate": true,
|
||||
"required": true,
|
||||
"fields": [
|
||||
{
|
||||
"order": 0,
|
||||
"name": "value",
|
||||
"label": "Regular Expression",
|
||||
"helpText": "Custom Format RegEx is Case Insensitive",
|
||||
"value": "UTR",
|
||||
"type": "textbox",
|
||||
"advanced": false,
|
||||
"privacy": "normal",
|
||||
"isFloat": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "SEV",
|
||||
"implementation": "ReleaseTitleSpecification",
|
||||
"implementationName": "Release Title",
|
||||
"infoLink": "https://wiki.servarr.com/sonarr/settings#custom-formats-2",
|
||||
"negate": false,
|
||||
"required": true,
|
||||
"fields": [
|
||||
{
|
||||
"order": 0,
|
||||
"name": "value",
|
||||
"label": "Regular Expression",
|
||||
"helpText": "Custom Format RegEx is Case Insensitive",
|
||||
"value": "\\bSEV\\b|\\b(Kira|D0ct0rLew)\\W*([A-Z]|(SEV)?(mkv)?)$",
|
||||
"type": "textbox",
|
||||
"advanced": false,
|
||||
"privacy": "normal",
|
||||
|
||||
@@ -12285,9 +12285,9 @@
|
||||
"includeCustomFormatWhenRenaming": false,
|
||||
"specifications": [
|
||||
{
|
||||
"name": "SEV",
|
||||
"implementation": "ReleaseGroupSpecification",
|
||||
"implementationName": "Release Group",
|
||||
"name": "x265",
|
||||
"implementation": "ReleaseTitleSpecification",
|
||||
"implementationName": "Release Title",
|
||||
"infoLink": "https://wiki.servarr.com/sonarr/settings#custom-formats-2",
|
||||
"negate": false,
|
||||
"required": true,
|
||||
@@ -12297,7 +12297,91 @@
|
||||
"name": "value",
|
||||
"label": "Regular Expression",
|
||||
"helpText": "Custom Format RegEx is Case Insensitive",
|
||||
"value": "(?<=^|[\\s.-])SEV\\b",
|
||||
"value": "^(?!.*(?i:remux))(?=.*(\\b[x]\\s?(\\.?265)\\b|HEVC)).*$",
|
||||
"type": "textbox",
|
||||
"advanced": false,
|
||||
"privacy": "normal",
|
||||
"isFloat": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Goki",
|
||||
"implementation": "ReleaseTitleSpecification",
|
||||
"implementationName": "Release Title",
|
||||
"infoLink": "https://wiki.servarr.com/sonarr/settings#custom-formats-2",
|
||||
"negate": true,
|
||||
"required": true,
|
||||
"fields": [
|
||||
{
|
||||
"order": 0,
|
||||
"name": "value",
|
||||
"label": "Regular Expression",
|
||||
"helpText": "Custom Format RegEx is Case Insensitive",
|
||||
"value": "\\b(goki)\\b",
|
||||
"type": "textbox",
|
||||
"advanced": false,
|
||||
"privacy": "normal",
|
||||
"isFloat": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "UTR",
|
||||
"implementation": "ReleaseTitleSpecification",
|
||||
"implementationName": "Release Title",
|
||||
"infoLink": "https://wiki.servarr.com/sonarr/settings#custom-formats-2",
|
||||
"negate": true,
|
||||
"required": true,
|
||||
"fields": [
|
||||
{
|
||||
"order": 0,
|
||||
"name": "value",
|
||||
"label": "Regular Expression",
|
||||
"helpText": "Custom Format RegEx is Case Insensitive",
|
||||
"value": "(?:^|[\\s.-])(UTR)(?![.\\d])\\b",
|
||||
"type": "textbox",
|
||||
"advanced": false,
|
||||
"privacy": "normal",
|
||||
"isFloat": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "UTR",
|
||||
"implementation": "ReleaseGroupSpecification",
|
||||
"implementationName": "Release Group",
|
||||
"infoLink": "https://wiki.servarr.com/sonarr/settings#custom-formats-2",
|
||||
"negate": true,
|
||||
"required": true,
|
||||
"fields": [
|
||||
{
|
||||
"order": 0,
|
||||
"name": "value",
|
||||
"label": "Regular Expression",
|
||||
"helpText": "Custom Format RegEx is Case Insensitive",
|
||||
"value": "UTR",
|
||||
"type": "textbox",
|
||||
"advanced": false,
|
||||
"privacy": "normal",
|
||||
"isFloat": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "SEV",
|
||||
"implementation": "ReleaseTitleSpecification",
|
||||
"implementationName": "Release Title",
|
||||
"infoLink": "https://wiki.servarr.com/sonarr/settings#custom-formats-2",
|
||||
"negate": false,
|
||||
"required": true,
|
||||
"fields": [
|
||||
{
|
||||
"order": 0,
|
||||
"name": "value",
|
||||
"label": "Regular Expression",
|
||||
"helpText": "Custom Format RegEx is Case Insensitive",
|
||||
"value": "\\bSEV\\b|\\b(Kira|D0ct0rLew)\\W*([A-Z]|(SEV)?(mkv)?)$",
|
||||
"type": "textbox",
|
||||
"advanced": false,
|
||||
"privacy": "normal",
|
||||
|
||||
@@ -6,6 +6,7 @@ from x265web import x265WEB
|
||||
from taoe import taoe
|
||||
from ralphy import Ralphy
|
||||
from av1 import AV1
|
||||
from sev import sev
|
||||
# ... import other test functions
|
||||
|
||||
# ANSI escape codes for colors
|
||||
@@ -24,6 +25,7 @@ def run_tests():
|
||||
("TAoE Groups", taoe),
|
||||
("Ralphy", Ralphy),
|
||||
("AV1", AV1),
|
||||
("SEV", sev),
|
||||
|
||||
# ... add other test functions
|
||||
]
|
||||
|
||||
108
tests/sev.py
Normal file
108
tests/sev.py
Normal file
@@ -0,0 +1,108 @@
|
||||
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 = [
|
||||
"Narcos - S03.E02 - The Cali KGB 1080p BDRip x265 DTS-HD MA 5.1 Kira [SEV]",
|
||||
"Invincible - Season - 02 [2023-2024] 1080p AMZN WebRip x265 DD+ 5.1 Kira [SEV]",
|
||||
"The Hangover Part III 2013 1080p BluRay DTS-HD MA 5.1 x265-Kira",
|
||||
"Aliens (1986) Special Edition Open Matte (1080p BluRay x265 SDR DTS-HD MA 5.1 English - Kira SEV)",
|
||||
"Convicting A Murderer [2023] S01 1080p DW+ WebRip x265 AAC 2.0 Kira [SEV]",
|
||||
"Titans S04 1080p BluRay AAC 5.1 x265-Kira SEV",
|
||||
"Captain America : The First Avenger 2011 1080p BluRay TrueHD 7.1 Atmos x265-D0ct0rLew",
|
||||
"Moon Knight S01 1080p UHD BluRay x265 10bit TrueHD Atmos 7.1 - D0ct0rLew SEV"
|
||||
]
|
||||
|
||||
bad_matches = [
|
||||
"Asp-Heavens_Seven-(AVCD-61385)-JP-CD-2024-DARKAUDiO",
|
||||
"Sevana-Keep Going Chosen-Single-WEB-2024-PaB",
|
||||
"Spencer.Ellsworth-Starfire.Shadow.Sun.Seven.The.Starfire.Trilogy.2.2017.RETAIL.EPUB.eBook-CTO"
|
||||
]
|
||||
|
||||
def sev(debug_level=0):
|
||||
# Get the custom formats for "sev" from both Radarr and Sonarr
|
||||
sev_radarr = get_custom_format("sev", "radarr", debug_level)
|
||||
sev_sonarr = get_custom_format("sev", "sonarr", debug_level)
|
||||
|
||||
# Extract the regex values for both Radarr and Sonarr using get_regex
|
||||
sev_value_radarr = get_regex(sev_radarr, "sev", debug_level)
|
||||
sev_value_sonarr = get_regex(sev_sonarr, "sev", debug_level)
|
||||
|
||||
# Extract the regex values for both Radarr and Sonarr using get_regex
|
||||
UTR_value_radarr = get_regex(sev_radarr, "UTR", debug_level)
|
||||
UTR_value_sonarr = get_regex(sev_sonarr, "UTR", debug_level)
|
||||
|
||||
# Replace the negative lookbehind with a negative lookahead
|
||||
sev_value_radarr = sev_value_radarr.replace(r"(?<=^|[\s.-])", r"(?:^|[\s.-])")
|
||||
sev_value_sonarr = sev_value_sonarr.replace(r"(?<=^|[\s.-])", r"(?:^|[\s.-])")
|
||||
|
||||
|
||||
if debug_level > 0:
|
||||
print(f"Testing with SEV regex: {ORANGE}{sev_value_radarr}{RESET}\n")
|
||||
print(f"Testing with UTR regex: {ORANGE}{UTR_value_radarr}{RESET}\n")
|
||||
|
||||
# Compare Radarr and Sonarr sev regex values
|
||||
if sev_value_radarr != sev_value_sonarr:
|
||||
print("Test Failed: regex value not same.")
|
||||
print(f"Radarr regex: {sev_value_radarr}")
|
||||
print(f"Sonarr regex: {sev_value_sonarr}")
|
||||
|
||||
# Compare Radarr and Sonarr UTR 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}")
|
||||
|
||||
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(sev_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(sev_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
|
||||
Reference in New Issue
Block a user