Enable Filepart2EpisodeTitle rule with absolute episodes

This commit is contained in:
2024-05-30 17:04:13 +02:00
parent 82a36aa00c
commit f1d818cfe2
2 changed files with 12 additions and 1 deletions

View File

@@ -7,6 +7,7 @@ from collections import defaultdict
from copy import copy from copy import copy
from rebulk import Rebulk, Rule, AppendMatch, RemoveMatch, RenameMatch, POST_PROCESS from rebulk import Rebulk, Rule, AppendMatch, RemoveMatch, RenameMatch, POST_PROCESS
from rebulk.rebulk import Matches
from ..common import seps, title_seps from ..common import seps, title_seps
from ..common.formatters import cleanup from ..common.formatters import cleanup
@@ -274,6 +275,9 @@ class Filepart2EpisodeTitle(Rule):
If BBBB contains season and episode and AAA contains a hole If BBBB contains season and episode and AAA contains a hole
then title is to be found in AAAA. 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') consequence = AppendMatch('title')
@@ -292,7 +296,7 @@ class Filepart2EpisodeTitle(Rule):
if episode_number: if episode_number:
season = (matches.range(directory.start, directory.end, lambda match: match.name == 'season', 0) or 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)) 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, hole = matches.holes(directory.start, directory.end,
ignore=or_(lambda match: 'weak-episode' in match.tags, TitleBaseRule.is_ignored), ignore=or_(lambda match: 'weak-episode' in match.tags, TitleBaseRule.is_ignored),
formatter=cleanup, seps=title_seps, formatter=cleanup, seps=title_seps,

View File

@@ -4776,3 +4776,10 @@
title: "Youkoso Jitsuryoku Shijou Shugi no Kyoushitsu e" title: "Youkoso Jitsuryoku Shijou Shugi no Kyoushitsu e"
season: 3 season: 3
episode: 5 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