diff --git a/imports/custom_formats/radarr/custom formats (radarr - master).json b/imports/custom_formats/radarr/custom formats (radarr - master).json index dd47dde..5437ffd 100644 --- a/imports/custom_formats/radarr/custom formats (radarr - master).json +++ b/imports/custom_formats/radarr/custom formats (radarr - master).json @@ -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 + } + ] + } + ] } ] \ No newline at end of file diff --git a/imports/custom_formats/sonarr/custom formats (sonarr - master).json b/imports/custom_formats/sonarr/custom formats (sonarr - master).json index 28c8888..9947e2d 100644 --- a/imports/custom_formats/sonarr/custom formats (sonarr - master).json +++ b/imports/custom_formats/sonarr/custom formats (sonarr - master).json @@ -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 + } + ] + } + ] } ] \ No newline at end of file diff --git a/imports/quality_profiles/radarr/1080p Balanced (radarr - master).json b/imports/quality_profiles/radarr/1080p Balanced (radarr - master).json index 3387672..8fb9ea9 100644 --- a/imports/quality_profiles/radarr/1080p Balanced (radarr - master).json +++ b/imports/quality_profiles/radarr/1080p Balanced (radarr - master).json @@ -1100,6 +1100,11 @@ "format": 191, "name": "D-Z0N3", "score": 80 + }, + { + "format": 340, + "name": "Upscaled", + "score": -9999 } ], "language": { diff --git a/imports/quality_profiles/radarr/1080p Optimal (radarr - master).json b/imports/quality_profiles/radarr/1080p Optimal (radarr - master).json index a53a6c4..0c7cd21 100644 --- a/imports/quality_profiles/radarr/1080p Optimal (radarr - master).json +++ b/imports/quality_profiles/radarr/1080p Optimal (radarr - master).json @@ -1093,6 +1093,11 @@ "format": 191, "name": "D-Z0N3", "score": 0 + }, + { + "format": 340, + "name": "Upscaled", + "score": -9999 } ], "language": { diff --git a/imports/quality_profiles/radarr/1080p Transparent (Double Grab) (radarr - master).json b/imports/quality_profiles/radarr/1080p Transparent (Double Grab) (radarr - master).json index df09be0..466639a 100644 --- a/imports/quality_profiles/radarr/1080p Transparent (Double Grab) (radarr - master).json +++ b/imports/quality_profiles/radarr/1080p Transparent (Double Grab) (radarr - master).json @@ -1100,6 +1100,11 @@ "format": 191, "name": "D-Z0N3", "score": 120 + }, + { + "format": 340, + "name": "Upscaled", + "score": -9999 } ], "language": { diff --git a/imports/quality_profiles/radarr/1080p Transparent (radarr - master).json b/imports/quality_profiles/radarr/1080p Transparent (radarr - master).json index 771541d..8f8ca34 100644 --- a/imports/quality_profiles/radarr/1080p Transparent (radarr - master).json +++ b/imports/quality_profiles/radarr/1080p Transparent (radarr - master).json @@ -1100,6 +1100,11 @@ "format": 191, "name": "D-Z0N3", "score": 120 + }, + { + "format": 340, + "name": "Upscaled", + "score": -9999 } ], "language": { diff --git a/imports/quality_profiles/radarr/1080p x265 HDR Transparent (radarr - master).json b/imports/quality_profiles/radarr/1080p x265 HDR Transparent (radarr - master).json index f507c8e..2dac1f0 100644 --- a/imports/quality_profiles/radarr/1080p x265 HDR Transparent (radarr - master).json +++ b/imports/quality_profiles/radarr/1080p x265 HDR Transparent (radarr - master).json @@ -1100,6 +1100,11 @@ "format": 191, "name": "D-Z0N3", "score": 120 + }, + { + "format": 340, + "name": "Upscaled", + "score": -9999 } ], "language": { diff --git a/imports/quality_profiles/radarr/2160p Optimal (radarr - master).json b/imports/quality_profiles/radarr/2160p Optimal (radarr - master).json index 5aa4fa7..79816f3 100644 --- a/imports/quality_profiles/radarr/2160p Optimal (radarr - master).json +++ b/imports/quality_profiles/radarr/2160p Optimal (radarr - master).json @@ -1086,6 +1086,11 @@ "format": 191, "name": "D-Z0N3", "score": 0 + }, + { + "format": 340, + "name": "Upscaled", + "score": -9999 } ], "language": { diff --git a/imports/quality_profiles/radarr/Balanced (HEVC) [Beta] (radarr - master).json b/imports/quality_profiles/radarr/Balanced (HEVC) [Beta] (radarr - master).json index 14a6d3a..6d7fdb6 100644 --- a/imports/quality_profiles/radarr/Balanced (HEVC) [Beta] (radarr - master).json +++ b/imports/quality_profiles/radarr/Balanced (HEVC) [Beta] (radarr - master).json @@ -1200,6 +1200,11 @@ "format": 191, "name": "D-Z0N3", "score": 80 + }, + { + "format": 340, + "name": "Upscaled", + "score": -9999 } ], "language": { diff --git a/imports/quality_profiles/sonarr/1080p Balanced (sonarr - master).json b/imports/quality_profiles/sonarr/1080p Balanced (sonarr - master).json index f9ffe71..3a613fd 100644 --- a/imports/quality_profiles/sonarr/1080p Balanced (sonarr - master).json +++ b/imports/quality_profiles/sonarr/1080p Balanced (sonarr - master).json @@ -921,6 +921,11 @@ "format": 223, "name": "LiNG", "score": 0 + }, + { + "format": 224, + "name": "Upscaled", + "score": -9999 } ] } diff --git a/imports/quality_profiles/sonarr/1080p Optimal (sonarr - master).json b/imports/quality_profiles/sonarr/1080p Optimal (sonarr - master).json index 2112f68..1a27563 100644 --- a/imports/quality_profiles/sonarr/1080p Optimal (sonarr - master).json +++ b/imports/quality_profiles/sonarr/1080p Optimal (sonarr - master).json @@ -907,6 +907,11 @@ "format": 223, "name": "LiNG", "score": 0 + }, + { + "format": 224, + "name": "Upscaled", + "score": -9999 } ] } diff --git a/imports/quality_profiles/sonarr/1080p Transparent (Double Grab) (sonarr - master).json b/imports/quality_profiles/sonarr/1080p Transparent (Double Grab) (sonarr - master).json index cf1f553..dad97f5 100644 --- a/imports/quality_profiles/sonarr/1080p Transparent (Double Grab) (sonarr - master).json +++ b/imports/quality_profiles/sonarr/1080p Transparent (Double Grab) (sonarr - master).json @@ -928,6 +928,11 @@ "format": 91, "name": "D-Z0N3", "score": 120 + }, + { + "format": 92, + "name": "Upscaled", + "score": -9999 } ] } diff --git a/imports/quality_profiles/sonarr/1080p Transparent (sonarr - master).json b/imports/quality_profiles/sonarr/1080p Transparent (sonarr - master).json index d9734b4..e1ad7a2 100644 --- a/imports/quality_profiles/sonarr/1080p Transparent (sonarr - master).json +++ b/imports/quality_profiles/sonarr/1080p Transparent (sonarr - master).json @@ -928,6 +928,11 @@ "format": 91, "name": "D-Z0N3", "score": 120 + }, + { + "format": 92, + "name": "Upscaled", + "score": -9999 } ] } diff --git a/imports/quality_profiles/sonarr/2160p Optimal (sonarr - master).json b/imports/quality_profiles/sonarr/2160p Optimal (sonarr - master).json index 7a99976..4bbb112 100644 --- a/imports/quality_profiles/sonarr/2160p Optimal (sonarr - master).json +++ b/imports/quality_profiles/sonarr/2160p Optimal (sonarr - master).json @@ -928,6 +928,11 @@ "format": 221, "name": "hdalx", "score": 0 + }, + { + "format": 222, + "name": "Upscaled", + "score": -9999 } ] } diff --git a/imports/quality_profiles/sonarr/Balanced (HEVC) (sonarr - master).json b/imports/quality_profiles/sonarr/Balanced (HEVC) (sonarr - master).json index 71c90d9..256d22d 100644 --- a/imports/quality_profiles/sonarr/Balanced (HEVC) (sonarr - master).json +++ b/imports/quality_profiles/sonarr/Balanced (HEVC) (sonarr - master).json @@ -1021,6 +1021,11 @@ "format": 223, "name": "LiNG", "score": 0 + }, + { + "format": 224, + "name": "Upscaled", + "score": -9999 } ] } diff --git a/tests/regex.py b/tests/regex.py index 8f1adff..5d332ae 100644 --- a/tests/regex.py +++ b/tests/regex.py @@ -7,6 +7,7 @@ from taoe import taoe from ralphy import Ralphy from av1 import AV1 from sev import sev +from upscale import Upscaled # ... import other test functions # ANSI escape codes for colors @@ -26,6 +27,8 @@ def run_tests(): ("Ralphy", Ralphy), ("AV1", AV1), ("SEV", sev), + ("Upscaled", Upscaled), + # ... add other test functions ] diff --git a/tests/upscale.py b/tests/upscale.py new file mode 100644 index 0000000..dc90429 --- /dev/null +++ b/tests/upscale.py @@ -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