Skip to content

Commit

Permalink
fix: ESub and separation of HDTVRip and HDTV. Other minor tweaks.
Browse files Browse the repository at this point in the history
  • Loading branch information
dreulavelle committed Sep 18, 2024
1 parent 7321454 commit 22eecf9
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 14 deletions.
10 changes: 6 additions & 4 deletions PTT/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ def add_defaults(parser: Parser):
parser.add_handler("quality", regex.compile(r"\bDVD(?:R\d?|.*Mux)?\b", regex.IGNORECASE), value("DVD"), {"remove": True})
parser.add_handler("quality", regex.compile(r"\bVHS\b", regex.IGNORECASE), value("VHS"), {"remove": True})
parser.add_handler("quality", regex.compile(r"\bPPVRip\b", regex.IGNORECASE), value("PPVRip"), {"remove": True})
parser.add_handler("quality", regex.compile(r"\bHD[ .-]*TV(?:Rip)?\b", regex.IGNORECASE), value("HDTV"), {"remove": True})
parser.add_handler("quality", regex.compile(r"\bHD.?TV.?Rip\b", regex.IGNORECASE), value("HDTVRip"), {"remove": True})
parser.add_handler("quality", regex.compile(r"\bHD.?TV\b", regex.IGNORECASE), value("HDTV"), {"remove": True})
parser.add_handler("quality", regex.compile(r"\bDVB[ .-]*(?:Rip)?\b", regex.IGNORECASE), value("HDTV"), {"remove": True})
parser.add_handler("quality", regex.compile(r"\bSAT[ .-]*Rips?\b", regex.IGNORECASE), value("SATRip"), {"remove": True})
parser.add_handler("quality", regex.compile(r"\bTVRips?\b", regex.IGNORECASE), value("TVRip"), {"remove": True})
Expand Down Expand Up @@ -383,6 +384,7 @@ def handle_episodes(context):
parser.add_handler("languages", regex.compile(r"\bengl?(?:sub[A-Z]*)?\b", regex.IGNORECASE), uniq_concat(value("en")), {"skipIfAlreadyFound": False})
parser.add_handler("languages", regex.compile(r"\beng?sub[A-Z]*\b", regex.IGNORECASE), uniq_concat(value("en")), {"skipIfAlreadyFound": False})
parser.add_handler("languages", regex.compile(r"\bing(?:l[eéê]s)?\b", regex.IGNORECASE), uniq_concat(value("en")), {"skipIfAlreadyFound": False})
parser.add_handler("languages", regex.compile(r"\besub\b", regex.IGNORECASE), uniq_concat(value("en")), {"remove": True, "skipIfAlreadyFound": False})
parser.add_handler("languages", regex.compile(r"\benglish\W+(?:subs?|sdh|hi)\b", regex.IGNORECASE), uniq_concat(value("en")), {"skipIfAlreadyFound": False})
parser.add_handler("languages", regex.compile(r"\beng?\b", regex.IGNORECASE), uniq_concat(value("en")), {"skipFromTitle": True, "skipIfAlreadyFound": False})
parser.add_handler("languages", regex.compile(r"\benglish?\b", regex.IGNORECASE), uniq_concat(value("en")), {"skipIfFirst": True, "skipIfAlreadyFound": False})
Expand Down Expand Up @@ -543,13 +545,13 @@ def handle_group(context):
parser.add_handler("3d", regex.compile(r"\b((Half.)?SBS|HSBS)\b", regex.IGNORECASE), boolean, {"remove": False, "skipIfFirst": True})
parser.add_handler("3d", regex.compile(r"\b3D\b", regex.IGNORECASE), boolean, {"remove": False, "skipIfFirst": True})

# Size
parser.add_handler("size", regex.compile(r"\b(\d+(\.\d+)?\s?(MB|GB|TB))\b", regex.IGNORECASE), none, {"remove": True})

# Site
parser.add_handler("site", regex.compile(r"\[([^\]]+\.[^\]]+)\](?=\.\w{2,4}$|\s)", regex.IGNORECASE), value("$1"), {"remove": True})
parser.add_handler("site", regex.compile(r"\bwww\.\w*\.\w+\b", regex.IGNORECASE), value("$1"), {"remove": True})

# Size
parser.add_handler("size", regex.compile(r"\b(\d+(\.\d+)?\s?(MB|GB|TB))\b", regex.IGNORECASE), none, {"remove": True})

# Networks
parser.add_handler("network", regex.compile(r"\bATVP?\b", regex.IGNORECASE), value("Apple TV"), {"remove": True})
parser.add_handler("network", regex.compile(r"\bAMZN\b", regex.IGNORECASE), value("Amazon"), {"remove": True})
Expand Down
4 changes: 2 additions & 2 deletions tests/test_language.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,9 @@ def parser():
("Dan Browns The Lost Symbol S01E03 1080p WEB H264-GLHF", []),
("Ben.Ara.2015.1080p.WEBRip.x265-RARBG.mp4", []),
("Ara.(A.Break).2008.DVDRip", []),
("www.1TamilMV.cz - Mirzapur (2020) S02 EP (01-10) - HQ HDRip - [Tam+ Tel] - x264 - AAC - 1GB - ESub", ["te", "ta"]),
("www.1TamilMV.cz - Mirzapur (2020) S02 EP (01-10) - HQ HDRip - [Tam+ Tel] - x264 - AAC - 1GB - ESub", ["en", "te", "ta"]),
("www.1TamilMV.cz - The Game of Chathurangam (2023) WEB-DL - 1080p - AVC - (AAC 2.0) [Tamil + Malayalam] - 1.2GB.mkv", ["ta", "ml"]),
("www.1TamilMV.yt - Anchakkallakokkan (2024) Malayalam HQ HDRip - 720p - HEVC - (DD+5.1 - 192Kbps & AAC) - 750MB - ESub.mkv", ["ml"]),
("www.1TamilMV.yt - Anchakkallakokkan (2024) Malayalam HQ HDRip - 720p - HEVC - (DD+5.1 - 192Kbps & AAC) - 750MB - ESub.mkv", ["en", "ml"]),
("Anatomia De Grey - Temporada 19 [HDTV][Cap.1905][Castellano][www.AtomoHD.nu].avi", ["es"]),
("Godzilla.x.Kong.The.New.Empire.2024.2160p.BluRay.REMUX.DV.P7.HDR.ENG.LATINO.GER.ITA.FRE.HINDI.CHINESE.TrueHD.Atmos.7.1.H265-BEN.THE.MEN", ["en", "zh", "fr", "la", "it", "de", "hi"]),
("Sampurna.2023.Bengali.S02.1080p.AMZN.WEB-DL.DD+2.0.H.265-TheBiscuitMan", ["bn"]),
Expand Down
34 changes: 27 additions & 7 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ def parser():
("[www.1TamilMV.pics]_The.Great.Indian.Suicide.2023.Tamil.TRUE.WEB-DL.4K.SDR.HEVC.(DD+5.1.384Kbps.&.AAC).3.2GB.ESub.mkv", {
"title": "The Great Indian Suicide",
"year": 2023,
"languages": ["ta"],
"languages": ["en", "ta"],
"seasons": [],
"episodes": [],
"quality": "WEB-DL",
Expand Down Expand Up @@ -958,19 +958,39 @@ def parser():
"languages": [],
"complete": True,
"group": "CAPTAiN"
}),
("Adbhut (2024) Hindi 1080p HDTVRip x264 AAC 5.1 [2.2GB] - QRips", {
"title": "Adbhut",
"year": 2024,
"seasons": [],
"episodes": [],
"languages": ["hi"],
"resolution": "1080p",
"quality": "HDTVRip",
"codec": "avc",
"audio": ["AC3", "AAC"],
"channels": ["5.1"],
"group": "QRips",
"size": "2.2GB"
})
])
def test_random_releases_parse(parser, release_name, expected):
assert parser.parse(release_name) == expected

# @pytest.mark.parametrize("release_name, expected", [
# ("Trailer Park Boys S01-S10 + Movies + Specials + Extras [Ultimate Collection]-CAPTAiN", {
# "title": "Trailer Park Boys",
# "seasons": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
# ("Adbhut (2024) Hindi 1080p HDTVRip x264 AAC 5.1 [2.2GB] - QRips", {
# "title": "Adbhut",
# "year": 2024,
# "seasons": [],
# "episodes": [],
# "languages": [],
# "complete": True,
# "group": "CAPTAiN"
# "languages": ["hi"],
# "resolution": "1080p",
# "quality": "HDTVRip",
# "codec": "avc",
# "audio": ["AC3", "AAC"],
# "channels": ["5.1"],
# "group": "QRips",
# "size": "2.2GB"
# })
# ])
# def test_debug_releases_parse(parser, release_name, expected):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_quality.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def parser():
@pytest.mark.parametrize("release_name, expected_quality", [
("Nocturnal Animals 2016 VFF 1080p BluRay DTS HEVC-HD2", "BluRay"),
("doctor_who_2005.8x12.death_in_heaven.720p_hdtv_x264-fov", "HDTV"),
("Rebecca.1940.720p.HDTVRip.HDCLUB", "HDTV"),
("Rebecca.1940.720p.HDTVRip.HDCLUB", "HDTVRip"),
("Gossip Girl - 1ª Temporada. (SAT-Rip)", "SATRip"),
("A Stable Life S01E01 DVDRip x264-Ltu", "DVDRip"),
("The Vet Life S02E01 Dunk-A-Doctor 1080p ANPL WEB-DL AAC2 0 H 264-RTN", "WEB-DL"),
Expand Down

0 comments on commit 22eecf9

Please sign in to comment.