Skip to content

Commit

Permalink
fix: dont remove documentary from title
Browse files Browse the repository at this point in the history
  • Loading branch information
dreulavelle committed Nov 10, 2024
1 parent 5ef9300 commit 9222dfe
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
4 changes: 2 additions & 2 deletions PTT/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ def add_defaults(parser: Parser):

# Scene
parser.add_handler("scene", regex.compile(r"^(?=.*(\b\d{3,4}p\b).*([_. ]WEB[_. ])(?!DL)\b)|\b(-CAKES|-GGEZ|-GGWP|-GLHF|-GOSSIP|-NAISU|-KOGI|-PECULATE|-SLOT|-EDITH|-ETHEL|-ELEANOR|-B2B|-SPAMnEGGS|-FTP|-DiRT|-SYNCOPY|-BAE|-SuccessfulCrab|-NHTFS|-SURCODE|-B0MBARDIERS)"), boolean, {"remove": False})
parser.add_handler("scene", regex.compile(r"\b(INFLATE|DEFLATE)\b", regex.IGNORECASE), boolean, {"remove": False, "skipIfAlreadyFound": True})

# Extras (This stuff can be trashed)
parser.add_handler("extras", regex.compile(r"\bNCED\b", regex.IGNORECASE), uniq_concat(value("NCED")), {"remove": True})
Expand Down Expand Up @@ -153,7 +152,7 @@ def add_defaults(parser: Parser):
parser.add_handler("remastered", regex.compile(r"\bRemaster(?:ed)?\b", regex.IGNORECASE), boolean)

# Documentary
parser.add_handler("documentary", regex.compile(r"\bDOCU(?:menta?ry)?\b", regex.IGNORECASE), boolean)
parser.add_handler("documentary", regex.compile(r"\bDOCU(?:menta?ry)?\b", regex.IGNORECASE), boolean, {"skipFromTitle": True})

# Unrated
parser.add_handler("unrated", regex.compile(r"\bunrated|uncensored\b", regex.IGNORECASE), boolean)
Expand Down Expand Up @@ -586,6 +585,7 @@ def handle_group(context):

# Group
parser.add_handler("group", regex.compile(r"\(([\w-]+)\)(?:$|\.\w{2,4}$)"))
parser.add_handler("group", regex.compile(r"\b(INFLATE|DEFLATE)\b", ), value("$1"), {"remove": True})
parser.add_handler("group", regex.compile(r"\b(?:Erai-raws|Erai-raws\.com)\b", regex.IGNORECASE), value("Erai-raws"), {"remove": True})
parser.add_handler("group", regex.compile(r"^\[([^[\]]+)]"))

Expand Down
33 changes: 33 additions & 0 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -992,6 +992,39 @@ def parser():
"audio": ["Dolby Digital"],
"channels": ["5.1"],
"container": "mp4"
}),
("The Lockerbie Bombing (2013) Documentary HDTVRIP", {
"title": "The Lockerbie Bombing",
"year": 2013,
"documentary": True,
"seasons": [],
"episodes": [],
"languages": [],
"quality": "HDTVRip"
}),
("STEVE.martin.a.documentary.in.2.pieces.S01.COMPLETE.1080p.WEB.H264-SuccessfulCrab[TGx]", {
"title": "STEVE martin a documentary in 2 pieces",
"seasons": [1],
"episodes": [],
"languages": [],
"quality": "WEB",
"codec": "avc",
"group": "SuccessfulCrab",
"resolution": "1080p",
"documentary": True,
"scene": True
}),
("The New Frontier S01E10 720p WEB H264-INFLATE[eztv] mkv", {
"title": "The New Frontier",
"seasons": [1],
"episodes": [10],
"languages": [],
"quality": "WEB",
"container": "mkv",
"codec": "avc",
"group": "INFLATE",
"resolution": "720p",
"scene": True
})
])
def test_random_releases_parse(parser, release_name, expected_output):
Expand Down
2 changes: 2 additions & 0 deletions tests/test_title.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ def parser():
("S.W.A.T.2017.S08E01.720p.HDTV.x264-SYNCOPY[TGx]", "S W A T"),
("Grimm.INTEGRAL.MULTI.COMPLETE.BLURAY-BMTH", "Grimm"),
("Friends.1994.INTEGRALE.MULTI.1080p.WEB-DL.H265-FTMVHD", "Friends"),
("STEVE.martin.a.documentary.in.2.pieces.S01.COMPLETE.1080p.WEB.H264-SuccessfulCrab[TGx]", "STEVE martin a documentary in 2 pieces"),
("The Lockerbie Bombing (2013) Documentary HDTVRIP", "The Lockerbie Bombing"),
],
)
def test_title_detection(parser, release_name, expected_title):
Expand Down

0 comments on commit 9222dfe

Please sign in to comment.