From f1d818cfe2e88a08c620f032cf1abd1457e81bcb Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Thu, 30 May 2024 17:04:13 +0200 Subject: [PATCH] Enable Filepart2EpisodeTitle rule with absolute episodes --- guessit/rules/properties/episode_title.py | 6 +++++- guessit/test/episodes.yml | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/guessit/rules/properties/episode_title.py b/guessit/rules/properties/episode_title.py index 40e7531..53d54b5 100644 --- a/guessit/rules/properties/episode_title.py +++ b/guessit/rules/properties/episode_title.py @@ -7,6 +7,7 @@ from collections import defaultdict from copy import copy from rebulk import Rebulk, Rule, AppendMatch, RemoveMatch, RenameMatch, POST_PROCESS +from rebulk.rebulk import Matches from ..common import seps, title_seps from ..common.formatters import cleanup @@ -274,6 +275,9 @@ class Filepart2EpisodeTitle(Rule): If BBBB contains season and episode and AAA contains a hole then title is to be found in AAAA. + + If BBBB contais the episode and no season is found (absolute numbering) + then title is to be found in AAAA. """ consequence = AppendMatch('title') @@ -292,7 +296,7 @@ class Filepart2EpisodeTitle(Rule): if episode_number: season = (matches.range(directory.start, directory.end, lambda match: match.name == 'season', 0) or matches.range(filename.start, filename.end, lambda match: match.name == 'season', 0)) - if season: + if season or not matches.named("season"): hole = matches.holes(directory.start, directory.end, ignore=or_(lambda match: 'weak-episode' in match.tags, TitleBaseRule.is_ignored), formatter=cleanup, seps=title_seps, diff --git a/guessit/test/episodes.yml b/guessit/test/episodes.yml index af1fcde..78c7188 100644 --- a/guessit/test/episodes.yml +++ b/guessit/test/episodes.yml @@ -4776,3 +4776,10 @@ title: "Youkoso Jitsuryoku Shijou Shugi no Kyoushitsu e" season: 3 episode: 5 + +? video/zettai karen children/01 - Absolutely Lovely! Their Name Is The Children.mkv +: title: "zettai karen children" + episode: 1 + episode_title: "Absolutely Lovely! Their Name Is The Children" + container: mkv + type: episode