mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-31 04:04:21 -04:00
Fix matcher serialization when translations are missing
This commit is contained in:
parent
e1169d1d26
commit
833775fede
@ -18,19 +18,22 @@ def format_date(date: date | int | None) -> str | None:
|
|||||||
|
|
||||||
def select_image(
|
def select_image(
|
||||||
self: Movie | Show,
|
self: Movie | Show,
|
||||||
type: Literal["posters"] | Literal["thumbnails"] | Literal["logos"],
|
kind: Literal["posters"] | Literal["thumbnails"] | Literal["logos"],
|
||||||
) -> str | None:
|
) -> str | None:
|
||||||
# For now, the API of kyoo only support one language so we remove the others.
|
# For now, the API of kyoo only support one language so we remove the others.
|
||||||
default_language = os.environ["LIBRARY_LANGUAGES"].split(",")[0]
|
default_language = os.environ["LIBRARY_LANGUAGES"].split(",")[0]
|
||||||
return next(
|
return next(
|
||||||
chain(
|
chain(
|
||||||
(
|
(
|
||||||
getattr(self.translations[self.original_language], type)
|
getattr(self.translations[self.original_language], kind)
|
||||||
if self.original_language
|
if self.original_language
|
||||||
|
and self.original_language in self.translations
|
||||||
else []
|
else []
|
||||||
),
|
),
|
||||||
getattr(self.translations[default_language], type),
|
getattr(self.translations[default_language], kind)
|
||||||
*(getattr(x, type) for x in self.translations.values()),
|
if default_language in self.translations
|
||||||
|
else [],
|
||||||
|
*(getattr(x, kind) for x in self.translations.values()),
|
||||||
),
|
),
|
||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user