From 81ce86fc60dcd9db999adf8e178323c993caebf7 Mon Sep 17 00:00:00 2001 From: lomion Date: Mon, 8 Nov 2021 22:33:30 +0100 Subject: [PATCH] Clean up Removes search for id --- tmdb/tmdb.py | 46 +--------------------------------------------- 1 file changed, 1 insertion(+), 45 deletions(-) diff --git a/tmdb/tmdb.py b/tmdb/tmdb.py index a85f6c6..e3dfa41 100644 --- a/tmdb/tmdb.py +++ b/tmdb/tmdb.py @@ -58,22 +58,6 @@ class TmdbBot(Plugin): await super().start() self.db = Database(self.database) -# async def send_movie_info(self, evt: MessageEvent, movie) -> None: -# mxc_uri = await self.client.upload_media(data=movie.get_image_binary()) -# text_message = f'{movie.title}' -# if len(movie.overview) > 200: -# three_dotts = " [...]" -# else: -# three_dotts = "" -# cast = "Acting: " -# for actor in movie.cast[:3]: -# cast += f'{actor}, ' -# cast = cast[:-2] -# html_message = f"""

{escape(movie.title)}

-#

{escape(movie.overview)[:200]}{three_dotts}

-#

{cast}

-#

taken from www.themoviedb.org

""" - async def send_html_message(self, evt: MessageEvent, text_message: str, html_message: str) -> None: content = TextMessageEventContent( msgtype=MessageType.TEXT, format=Format.HTML, @@ -88,8 +72,7 @@ class TmdbBot(Plugin): await evt.respond(content) async def send_help(self, evt: MessageEvent) -> None: - html = """

Use !tmdb id movie {tmdb id} to get movie detail for tmdb-id.

-

Use !tmdb movie {title} [y:{release year}] to get movie detail based on the given title.

+ html = """

Use !tmdb movie {title} [y:{release year}] to get movie detail based on the given title.

Use !tmdb popular to get most popular movies.

Use !tmdb language {language} to set your prefered language.

Use !tmdb poster_size [{size}] to set your prefered poster size. With empty {size} all available sizes are listed.

@@ -145,20 +128,6 @@ class TmdbBot(Plugin): await show.load_parameters() return show - async def movie_id(self, evt: MessageEvent, message: str = "") -> None: - movie = await self.init_movie() - self.poster_size(evt, movie) - language = self.db.get_language(evt.sender) - if language: - movie.set_language(language) - await movie.query_details(message) - await self.send_movie_info(evt, movie) - - @command.new("movie-id", help="Movie lookup by id") - @command.argument("message", pass_raw=True, required=True) - async def command_movie_id(self, evt: MessageEvent, message: str = "") -> None: - await self.movie_id(evt, message) - async def movie_popular(self, evt: MessageEvent, message: str = "") -> None: popular = MoviePopular() await popular.load_parameters() @@ -263,19 +232,6 @@ class TmdbBot(Plugin): await self.set_poster_size(evt, parameters) elif command.lower() == 'tvshow': await self.tvshow_search(evt, parameters) - elif command.lower() == 'id': - m = re.search(r'^(movie|tvshow) (\d*)', parameters) - if m: - type = m.group(1) - id = m.group(2) - if type.lower() == 'movie': - await self.movie_id(evt, id) - elif type.lower() == 'tvshow': - await self.send_notice(evt, 'Not yet implemented. Search TV shows by title for now (!tmdb tvshow {title})') - else: - await self.send_notice(evt, 'Syntax wrong: !tmdb id {movie|tvshow} {tmdb id}') - else: - await self.send_notice(evt, 'Syntax wrong: !tmdb id {movie|tvshow} {tmdb id}') else: await self.send_help(evt) else: