diff --git a/tmdb/tmdb.py b/tmdb/tmdb.py index 5819753..a85f6c6 100644 --- a/tmdb/tmdb.py +++ b/tmdb/tmdb.py @@ -161,11 +161,15 @@ class TmdbBot(Plugin): async def movie_popular(self, evt: MessageEvent, message: str = "") -> None: popular = MoviePopular() + await popular.load_parameters() language = self.db.get_language(evt.sender) if language: popular.set_language(language) length = 5 - await self.send_html_message(evt, popular.getListText(length), popular.getListHtml(length)) + await popular.query() + text = popular.getListText(length) + html = popular.getListHtml(length) + await self.send_html_message(evt, text, html) @command.new("movie-search", help="Movie lookup by Title") @command.argument("message", pass_raw=True, required=True) diff --git a/tmdb/tmdb_api.py b/tmdb/tmdb_api.py index 491fb8a..fe79364 100644 --- a/tmdb/tmdb_api.py +++ b/tmdb/tmdb_api.py @@ -88,14 +88,13 @@ class MoviePopular(TmdbApi): self.list = [] self.length = 0 - def query(self) -> int: - result = self.request('/movie/popular') + async def query(self) -> int: + result = await self.request('/movie/popular') self.length = result['total_results'] self.list = result['results'] return self.length def getListHtml(self, length: int = None) -> str: - self.query() html = "" if length: loop = length @@ -106,7 +105,6 @@ class MoviePopular(TmdbApi): return html def getListText(self, length: int = None) -> str: - self.query() text = "" if length: loop = length