Clean up
Removes search for id
This commit is contained in:
parent
16336d61f3
commit
81ce86fc60
46
tmdb/tmdb.py
46
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"""<p><b>{escape(movie.title)}</b></p>
|
||||
# <p>{escape(movie.overview)[:200]}{three_dotts}</p>
|
||||
# <p>{cast}</p>
|
||||
# <p>taken from www.themoviedb.org</p>"""
|
||||
|
||||
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 = """<p>Use <b>!tmdb id movie {tmdb id}</b> to get movie detail for tmdb-id.</p>
|
||||
<p>Use <b>!tmdb movie {title} [y:{release year}]</b> to get movie detail based on the given title.</p>
|
||||
html = """<p>Use <b>!tmdb movie {title} [y:{release year}]</b> to get movie detail based on the given title.</p>
|
||||
<p>Use <b>!tmdb popular</b> to get most popular movies.</p>
|
||||
<p>Use <b>!tmdb language {language}</b> to set your prefered language.</p>
|
||||
<p>Use <b>!tmdb poster_size [{size}]</b> to set your prefered poster size. With empty {size} all available sizes are listed.</p>
|
||||
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue