mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-07-09 03:04:20 -04:00
Fix titles join in path (#457)
This commit is contained in:
commit
cd18ec1747
@ -54,10 +54,15 @@ class UnlistTitles(Rule):
|
|||||||
consequence = [RemoveMatch, AppendMatch]
|
consequence = [RemoveMatch, AppendMatch]
|
||||||
|
|
||||||
def when(self, matches: Matches, context) -> Any:
|
def when(self, matches: Matches, context) -> Any:
|
||||||
titles: List[Match] = matches.named("title", lambda x: x.tagged("title")) # type: ignore
|
fileparts: List[Match] = matches.markers.named("path") # type: ignore
|
||||||
|
|
||||||
|
for part in fileparts:
|
||||||
|
titles: List[Match] = matches.range(
|
||||||
|
part.start, part.end, lambda x: x.name == "title"
|
||||||
|
) # type: ignore
|
||||||
|
|
||||||
if not titles or len(titles) <= 1:
|
if not titles or len(titles) <= 1:
|
||||||
return
|
continue
|
||||||
|
|
||||||
title = copy(titles[0])
|
title = copy(titles[0])
|
||||||
for nmatch in titles[1:]:
|
for nmatch in titles[1:]:
|
||||||
@ -103,6 +108,11 @@ class EpisodeTitlePromotion(Rule):
|
|||||||
if not ep_title:
|
if not ep_title:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# Do not promote an episode title if there is already a know episode number
|
||||||
|
ep_nbr: List[Match] = matches.named("episode") # type: ignore
|
||||||
|
if ep_nbr and len(ep_nbr) > 0:
|
||||||
|
return
|
||||||
|
|
||||||
to_remove = [match for match in ep_title if str(match.value).isdecimal()]
|
to_remove = [match for match in ep_title if str(match.value).isdecimal()]
|
||||||
to_add = []
|
to_add = []
|
||||||
for tmatch in to_remove:
|
for tmatch in to_remove:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user