fix tv season title for mini series
This commit is contained in:
parent
a789f25505
commit
340dfd9dff
1 changed files with 25 additions and 19 deletions
|
@ -44,6 +44,7 @@ from catalog.common import (
|
|||
)
|
||||
from catalog.common.models import LANGUAGE_CHOICES_JSONFORM, LanguageListField
|
||||
from common.models.lang import RE_LOCALIZED_SEASON_NUMBERS, localize_number
|
||||
from common.models.misc import uniq
|
||||
|
||||
|
||||
class TVShowInSchema(ItemInSchema):
|
||||
|
@ -414,7 +415,8 @@ class TVSeason(Item):
|
|||
- "Show Title Season X" with some localization
|
||||
"""
|
||||
s = super().display_title
|
||||
if self.parent_item and (
|
||||
if self.parent_item:
|
||||
if (
|
||||
RE_LOCALIZED_SEASON_NUMBERS.sub("", s) == ""
|
||||
or s == self.parent_item.display_title
|
||||
):
|
||||
|
@ -427,17 +429,21 @@ class TVSeason(Item):
|
|||
)
|
||||
else:
|
||||
return f"{self.parent_item.display_title} {s}"
|
||||
elif self.parent_item.display_title not in s:
|
||||
return f"{self.parent_item.display_title} ({s})"
|
||||
return s
|
||||
|
||||
@cached_property
|
||||
def additional_title(self) -> list[str]:
|
||||
title = self.display_title
|
||||
return [
|
||||
return uniq(
|
||||
[
|
||||
t["text"]
|
||||
for t in self.localized_title
|
||||
if t["text"] != title
|
||||
and RE_LOCALIZED_SEASON_NUMBERS.sub("", t["text"]) != ""
|
||||
]
|
||||
)
|
||||
|
||||
def to_indexable_titles(self) -> list[str]:
|
||||
titles = [t["text"] for t in self.localized_title if t["text"]]
|
||||
|
|
Loading…
Add table
Reference in a new issue