mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-24 02:02:36 -04:00
chg: refactor: remove repetitive code
This commit is contained in:
parent
6b751e11f3
commit
50e18ee99d
@ -193,7 +193,7 @@ class TheMovieDatabase(Provider):
|
|||||||
reverse=True,
|
reverse=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
return localized_images
|
return self.get_image(localized_images)
|
||||||
|
|
||||||
async def search_movie(self, name: str, year: Optional[int]) -> Movie:
|
async def search_movie(self, name: str, year: Optional[int]) -> Movie:
|
||||||
search_results = (
|
search_results = (
|
||||||
@ -268,13 +268,9 @@ class TheMovieDatabase(Provider):
|
|||||||
tagline=movie["tagline"] if movie["tagline"] else None,
|
tagline=movie["tagline"] if movie["tagline"] else None,
|
||||||
tags=list(map(lambda x: x["name"], movie["keywords"]["keywords"])),
|
tags=list(map(lambda x: x["name"], movie["keywords"]["keywords"])),
|
||||||
overview=movie["overview"],
|
overview=movie["overview"],
|
||||||
posters=self.get_image(
|
posters=(await self.get_best_image(movie, lng, "posters")),
|
||||||
await self.get_best_image(movie, lng, "posters")
|
logos=(await self.get_best_image(movie, lng, "logos")),
|
||||||
),
|
thumbnails=(await self.get_best_image(movie, lng, "backdrops")),
|
||||||
logos=self.get_image(await self.get_best_image(movie, lng, "logos")),
|
|
||||||
thumbnails=self.get_image(
|
|
||||||
await self.get_best_image(movie, lng, "backdrops")
|
|
||||||
),
|
|
||||||
trailers=[
|
trailers=[
|
||||||
f"https://www.youtube.com/watch?v={x['key']}"
|
f"https://www.youtube.com/watch?v={x['key']}"
|
||||||
for x in movie["videos"]["results"]
|
for x in movie["videos"]["results"]
|
||||||
@ -361,13 +357,9 @@ class TheMovieDatabase(Provider):
|
|||||||
tagline=show["tagline"] if show["tagline"] else None,
|
tagline=show["tagline"] if show["tagline"] else None,
|
||||||
tags=list(map(lambda x: x["name"], show["keywords"]["results"])),
|
tags=list(map(lambda x: x["name"], show["keywords"]["results"])),
|
||||||
overview=show["overview"],
|
overview=show["overview"],
|
||||||
posters=self.get_image(
|
posters=(await self.get_best_image(show, lng, "posters")),
|
||||||
await self.get_best_image(show, lng, "posters")
|
logos=(await self.get_best_image(show, lng, "logos")),
|
||||||
),
|
thumbnails=(await self.get_best_image(show, lng, "backdrops")),
|
||||||
logos=self.get_image(await self.get_best_image(show, lng, "logos")),
|
|
||||||
thumbnails=self.get_image(
|
|
||||||
await self.get_best_image(show, lng, "backdrops")
|
|
||||||
),
|
|
||||||
trailers=[
|
trailers=[
|
||||||
f"https://www.youtube.com/watch?v={x['key']}"
|
f"https://www.youtube.com/watch?v={x['key']}"
|
||||||
for x in show["videos"]["results"]
|
for x in show["videos"]["results"]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user