mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-30 19:54:16 -04:00
Fix titles join in path
This commit is contained in:
parent
f67a7b4fd4
commit
e0923807c6
@ -54,21 +54,24 @@ 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
|
||||||
|
|
||||||
if not titles or len(titles) <= 1:
|
for part in fileparts:
|
||||||
return
|
titles: List[Match] = matches.range(part.start, part.end, lambda x: x.name == "title") # type: ignore
|
||||||
|
|
||||||
title = copy(titles[0])
|
if not titles or len(titles) <= 1:
|
||||||
for nmatch in titles[1:]:
|
|
||||||
# Check if titles are next to each other, if they are not ignore it.
|
|
||||||
next: List[Match] = matches.next(title) # type: ignore
|
|
||||||
if not next or next[0] != nmatch:
|
|
||||||
logger.warn(f"Ignoring potential part of title: {nmatch.value}")
|
|
||||||
continue
|
continue
|
||||||
title.end = nmatch.end
|
|
||||||
|
|
||||||
return [titles, [title]]
|
title = copy(titles[0])
|
||||||
|
for nmatch in titles[1:]:
|
||||||
|
# Check if titles are next to each other, if they are not ignore it.
|
||||||
|
next: List[Match] = matches.next(title) # type: ignore
|
||||||
|
if not next or next[0] != nmatch:
|
||||||
|
logger.warn(f"Ignoring potential part of title: {nmatch.value}")
|
||||||
|
continue
|
||||||
|
title.end = nmatch.end
|
||||||
|
|
||||||
|
return [titles, [title]]
|
||||||
|
|
||||||
|
|
||||||
class EpisodeTitlePromotion(Rule):
|
class EpisodeTitlePromotion(Rule):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user