Improvement/Upscaling(#71)

- New CF for upscales
- Upscales banned in all quality profiles

---------

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-22 01:02:34 +01:00
committed by GitHub
parent a0c1f1969f
commit 9830031ae8
17 changed files with 246 additions and 0 deletions

View File

@@ -15270,5 +15270,32 @@
] ]
} }
] ]
},
{
"name": "Upscaled",
"includeCustomFormatWhenRenaming": false,
"specifications": [
{
"name": "Upscaled",
"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": "(Up[-\\.\\s]?scale|Re[-\\.\\s]?Grade|\\bAIUS\\b|AI[-\\.\\s]?enhanced)",
"type": "textbox",
"advanced": false,
"privacy": "normal",
"isFloat": false
}
]
}
]
} }
] ]

View File

@@ -12597,5 +12597,32 @@
] ]
} }
] ]
},
{
"name": "Upscaled",
"includeCustomFormatWhenRenaming": false,
"specifications": [
{
"name": "Upscaled",
"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": "(Up[-\\.\\s]?scale|Re[-\\.\\s]?Grade|\\bAIUS\\b|AI[-\\.\\s]?enhanced)",
"type": "textbox",
"advanced": false,
"privacy": "normal",
"isFloat": false
}
]
}
]
} }
] ]

View File

@@ -1100,6 +1100,11 @@
"format": 191, "format": 191,
"name": "D-Z0N3", "name": "D-Z0N3",
"score": 80 "score": 80
},
{
"format": 340,
"name": "Upscaled",
"score": -9999
} }
], ],
"language": { "language": {

View File

@@ -1093,6 +1093,11 @@
"format": 191, "format": 191,
"name": "D-Z0N3", "name": "D-Z0N3",
"score": 0 "score": 0
},
{
"format": 340,
"name": "Upscaled",
"score": -9999
} }
], ],
"language": { "language": {

View File

@@ -1100,6 +1100,11 @@
"format": 191, "format": 191,
"name": "D-Z0N3", "name": "D-Z0N3",
"score": 120 "score": 120
},
{
"format": 340,
"name": "Upscaled",
"score": -9999
} }
], ],
"language": { "language": {

View File

@@ -1100,6 +1100,11 @@
"format": 191, "format": 191,
"name": "D-Z0N3", "name": "D-Z0N3",
"score": 120 "score": 120
},
{
"format": 340,
"name": "Upscaled",
"score": -9999
} }
], ],
"language": { "language": {

View File

@@ -1100,6 +1100,11 @@
"format": 191, "format": 191,
"name": "D-Z0N3", "name": "D-Z0N3",
"score": 120 "score": 120
},
{
"format": 340,
"name": "Upscaled",
"score": -9999
} }
], ],
"language": { "language": {

View File

@@ -1086,6 +1086,11 @@
"format": 191, "format": 191,
"name": "D-Z0N3", "name": "D-Z0N3",
"score": 0 "score": 0
},
{
"format": 340,
"name": "Upscaled",
"score": -9999
} }
], ],
"language": { "language": {

View File

@@ -1200,6 +1200,11 @@
"format": 191, "format": 191,
"name": "D-Z0N3", "name": "D-Z0N3",
"score": 80 "score": 80
},
{
"format": 340,
"name": "Upscaled",
"score": -9999
} }
], ],
"language": { "language": {

View File

@@ -921,6 +921,11 @@
"format": 223, "format": 223,
"name": "LiNG", "name": "LiNG",
"score": 0 "score": 0
},
{
"format": 224,
"name": "Upscaled",
"score": -9999
} }
] ]
} }

View File

@@ -907,6 +907,11 @@
"format": 223, "format": 223,
"name": "LiNG", "name": "LiNG",
"score": 0 "score": 0
},
{
"format": 224,
"name": "Upscaled",
"score": -9999
} }
] ]
} }

View File

@@ -928,6 +928,11 @@
"format": 91, "format": 91,
"name": "D-Z0N3", "name": "D-Z0N3",
"score": 120 "score": 120
},
{
"format": 92,
"name": "Upscaled",
"score": -9999
} }
] ]
} }

View File

@@ -928,6 +928,11 @@
"format": 91, "format": 91,
"name": "D-Z0N3", "name": "D-Z0N3",
"score": 120 "score": 120
},
{
"format": 92,
"name": "Upscaled",
"score": -9999
} }
] ]
} }

View File

@@ -928,6 +928,11 @@
"format": 221, "format": 221,
"name": "hdalx", "name": "hdalx",
"score": 0 "score": 0
},
{
"format": 222,
"name": "Upscaled",
"score": -9999
} }
] ]
} }

View File

@@ -1021,6 +1021,11 @@
"format": 223, "format": 223,
"name": "LiNG", "name": "LiNG",
"score": 0 "score": 0
},
{
"format": 224,
"name": "Upscaled",
"score": -9999
} }
] ]
} }

View File

@@ -7,6 +7,7 @@ from taoe import taoe
from ralphy import Ralphy from ralphy import Ralphy
from av1 import AV1 from av1 import AV1
from sev import sev from sev import sev
from upscale import Upscaled
# ... import other test functions # ... import other test functions
# ANSI escape codes for colors # ANSI escape codes for colors
@@ -26,6 +27,8 @@ def run_tests():
("Ralphy", Ralphy), ("Ralphy", Ralphy),
("AV1", AV1), ("AV1", AV1),
("SEV", sev), ("SEV", sev),
("Upscaled", Upscaled),
# ... add other test functions # ... add other test functions
] ]

124
tests/upscale.py Normal file
View File

@@ -0,0 +1,124 @@
from extract import get_custom_format, get_regex
import re
import sys
# ANSI escape codes for colors
GREEN = '\033[92m'
RED = '\033[91m'
ORANGE = '\033[38;5;208m'
RESET = '\033[0m'
good_matches = [
"The.Dukes.Of.Hazzard.Unrated.2005.2160p.Ai-Upscaled.10Bit.H265.DDP.5.1.RIFE.4.15-60fps-DirtyHippie",
"Scrubs.S05E09.My.Half-Acre.Upscale.Hybrid.1080p.WEBRip.DD5.1.H.264-DEADBADUGLY",
"[EG]Mobile Suit Gundam SEED 21 BD[HEVC DualAudio AI-Upscale]",
"Death.Proof.2007.2160p.Ai-Upscaled.10Bit.H265.TrueHD.5.1-DirtyHippie RIFE.4.14v2-60fps.mkv",
"Oi.Aparadektoi.S02E03.[FullHDAIUpscaled][Upload-Ft4U]",
"Cash.Out-I.maghi.del.furto.2024.UpScaled.2160p.H265.10.bit.DV.HDR10+.ita.eng.AC3.5.1.sub.ita.eng.Licdom",
"2012 (2009) UHD 4K Upscaled x264 AC3 Soup mkv",
"The Martian 2015 4K UHD UPSCALED-ETRG",
"WWE Smackdown 1999 S04 1080p (Upscaled) PEACOCK WEB-DL H 264 AAC 2 0",
"Venom 023 (2023) (Digital) (Li'l-Empire) (HD-Upscaled)",
"Natashas.Bondage.Sex.Vol.2.Upscaled",
"Star Trek: Deep Space Nine S01 AI Upscale 2160p DVD AAC 2.0 H.263",
"Star.Trek.Raumschiff.Voyager.S05E13.Schwere.German.AC3D.DL.1080p.DVD.AI.REGRADED.x264-HQC",
"The.Marvels.(2023).[HDR.ReGrade].1080p.4K-WEBRip.[Hin-Eng].DDP.5.1.Atmos.—.PeruGuy",
"Terminator 3 Rise of the Machines 2003 2160p HDR UpsUHD x265 REGRADED REPACK-QfG",
"The Departed (2006) Regrade (2160p x265 HEVC 10bit HDR BluRay DTS-HD MA 6.1 Prof).mkv",
"The Matrix (1999) 1080p BluRay Regraded x264 TrueHD Atmos 7.1 [lvl99]",
"The.Last.Samurai.2003.2160p.x265.10bit.TrueHD.DTS.5.1[TheUpscaler].mkv",
"New.Jack.City.1991.2160p.x265.10bit.DTS HD.MA.5.1[TheUpscaler]",
"Bank Chor (2017) 720p UP SCALED DVDRip x264 AC3 ESub [DDR]",
"Transformers.2007.2160p.DV.HDR10Plus.Ai-Enhanced.H265.TrueHD.7.1.Atmos.MULTI.RIFE.4.15-60fps-DirtyHippie",
"Karakter (1997) - AI enhanced 4K",
"The.Farm-Angola,.USA.1998.480p.DVDRip.AI.Enhanced",
"Ugramm.2014.[Kannada+Hindi].1080p.Ai.Enhanced.[1",
"Soldiers Sortie 2006 AIEnhanced 1080p 50fps x265 10bit MP2-Enichi",
"No.Country.For.Old.Men.2007.2160P.Ai-Upscaled.10Bit.H265.DTS-HD.MA.5.1.RIFE.4.15-60fps-DirtyHippie",
"Oi.Aparadektoi.S01E10.91.[FullHDAIUpscaled][Upload-Ft4U]",
"Avatar.2009.Extended.UHD.Re-Grade.4000nit.2160p.HEVC.HDR.IVACHS.ENG.ExKinoRay",
"It's Always Sunny in Philadelphia (2005) S05 (1080p AIUS DVD Hybrid x265 SDR DD 5.1 English - JBENT TAoE) [REPACK] ",
"It's Always Sunny in Philadelphia (2005) S05E01 The Gang Exploits the Mortgage Crisis REPACK (1080p DVDRip AI Upscale x265 10bit AC3 5.1 - JBENT)[TAoE].mkv"
]
bad_matches = [
"The Scales of Providence [2008] KO Complete eng subs",
"Scales Mermaids Are Real 2017 WEBRip X264",
"Barrie Cassidys One Plus One S01E03 Sally Scales 720p HDTV x264-CBFM",
"The Aggression Scale 2012 10bit hevc-d3g",
"Family.by.the.Ton.S01E02.Stepping.on.the.Scale.HDTV.x264-CRiMSON",
"Upgrade.2018.1080p.Bluray.DD5.1.x264-playHD",
"The Brave S01E05 Enhanced Protection 720p AMZN WEBRip DDP5 1 X264-NTb",
"Star.Trek.The.Original.Series.Remastered.And.Enhanced.DVDRip.XviD.ROSub.FL",
"Guns N' Roses - 2016-04-08 Las Vegas, NV 1st NIGHT ENHANCED BLU RAY 1080i+LPCM AUDIO [fanfzero]",
"Enhanced.2020.1080p.Bluray.DTS-HD.MA.5.1.X264-EVO"
]
def Upscaled(debug_level=0):
# Get the custom formats for "Upscaled" from both Radarr and Sonarr
Upscaled_radarr = get_custom_format("Upscaled", "radarr", debug_level)
Upscaled_sonarr = get_custom_format("Upscaled", "sonarr", debug_level)
# Extract the regex values for both Radarr and Sonarr using get_regex
Upscaled_value_radarr = get_regex(Upscaled_radarr, "Upscaled", debug_level)
Upscaled_value_sonarr = get_regex(Upscaled_sonarr, "Upscaled", debug_level)
if debug_level > 0:
print(f"Testing with regex: {ORANGE}{Upscaled_value_radarr}{RESET}\n")
# Compare Radarr and Sonarr Upscaled regex values
if Upscaled_value_radarr != Upscaled_value_sonarr:
print("Test Failed: regex value not same.")
print(f"Radarr regex: {Upscaled_value_radarr}")
print(f"Sonarr regex: {Upscaled_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(Upscaled_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(Upscaled_value_radarr, release, re.IGNORECASE):
bad_matches_failed.append(release)
print(f" - {release}: {RED}Failed{RESET}")
else:
bad_matches_passed.append(release)
print(f" - {release}: {GREEN}Passed{RESET}")
# Reporting failed matches
print("\nFailed matches:")
if good_matches_failed or bad_matches_passed:
for release in good_matches_failed + bad_matches_failed:
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_passed)
success_rate = (passed_matches / total_matches) * 100
print("\nStats:")
print(f"Total: {total_matches}")
print(f"Bad: {len(bad_matches_failed) + len(good_matches_failed)}")
print(f"Rate: {success_rate:.2f}%")
if success_rate >= 99.8:
print("Test Passed")
return True
else:
print("Test Failed")
return False