'''
This file is part of tmdb-bot.
tmdb-bot is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License version 3 as published by
the Free Software Foundation.
tmdb-bot is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with tmdb-bot. If not, see
{escape(movie.title)}
{escape(movie.overview)[:overview_length]}{three_dotts}
{cast}
taken from www.themoviedb.org
""" return html_message async def send_movie_info(self, evt: MessageEvent, movie) -> None: html_message = self.construct_html_message(movie) await self.send_html_message(f'{movie.title}', html_message) await self.send_image(movie.title, movie.get_image_binary()) @command.new("movie-id", help="Movie lookup by id") @command.argument("message", pass_raw=True, required=True) async def movie_id(self, evt: MessageEvent, message: str = "") -> None: movie = Movie() language = self.db.get_language(evt.sender) if language: movie.set_language(language) movie.query_details(message) await self.send_movie_info(evt, movie) @command.new("movie-search", help="Movie lookup by Title") @command.argument("message", pass_raw=True, required=True) async def movie_search(self, evt: MessageEvent, message: str = "") -> None: movie = Movie() language = self.db.get_language(evt.sender) if language: movie.set_language(language) movie.search_title(message) if movie.valid: await self.send_movie_info(evt, movie) else: content = TextMessageEventContent( msgtype=MessageType.NOTICE, format=Format.HTML, body=f"No movie found!") await evt.respond(content) @command.new("movie-language", help="Set language for lookup") @command.argument("message", pass_raw=True, required=True) async def movie_language(self, evt: MessageEvent, message: str = "") -> None: self.db.set_language(evt.sender, message) content = TextMessageEventContent( msgtype=MessageType.NOTICE, format=Format.HTML, body=f"Language set to {message}!") await evt.respond(content)