Changed release to 0.1.0
Some flake8 improvements
This commit is contained in:
parent
c698cafa02
commit
2c5d3607f3
|
@ -1,6 +1,6 @@
|
||||||
maubot: 0.1.0
|
maubot: 0.1.0
|
||||||
id: lomion.tmdb
|
id: lomion.tmdb
|
||||||
version: 0.0.3
|
version: 0.1.0
|
||||||
license: AGPL 3.0
|
license: AGPL 3.0
|
||||||
modules:
|
modules:
|
||||||
- tmdb
|
- tmdb
|
||||||
|
|
12
tmdb/tmdb.py
12
tmdb/tmdb.py
|
@ -15,17 +15,18 @@ along with tmdb-bot. If not, see <https://www.gnu.org/licenses/>.
|
||||||
'''
|
'''
|
||||||
from html import escape
|
from html import escape
|
||||||
|
|
||||||
from mautrix.types import TextMessageEventContent, MediaMessageEventContent, MessageType, Format, RelatesTo, RelationType
|
from mautrix.types import TextMessageEventContent, MediaMessageEventContent, MessageType, Format
|
||||||
|
|
||||||
from maubot import Plugin, MessageEvent
|
from maubot import Plugin, MessageEvent
|
||||||
from maubot.handlers import command
|
from maubot.handlers import command
|
||||||
|
|
||||||
from tmdb.tmdb_api import Movie
|
from tmdb.tmdb_api import Movie
|
||||||
|
|
||||||
from sqlalchemy import (Column, String, Integer, ForeignKey, Table, MetaData,
|
from sqlalchemy import (Column, String, Integer, Table, MetaData,
|
||||||
select, and_)
|
select)
|
||||||
from sqlalchemy.engine.base import Engine
|
from sqlalchemy.engine.base import Engine
|
||||||
|
|
||||||
|
|
||||||
class Database:
|
class Database:
|
||||||
db: Engine
|
db: Engine
|
||||||
|
|
||||||
|
@ -51,6 +52,7 @@ class Database:
|
||||||
.where(self.language.c.user_id == user_id))
|
.where(self.language.c.user_id == user_id))
|
||||||
return rows.fetchone()
|
return rows.fetchone()
|
||||||
|
|
||||||
|
|
||||||
class TmdbBot(Plugin):
|
class TmdbBot(Plugin):
|
||||||
db: Database
|
db: Database
|
||||||
|
|
||||||
|
@ -67,7 +69,7 @@ class TmdbBot(Plugin):
|
||||||
three_dotts = ""
|
three_dotts = ""
|
||||||
cast = "Acting: "
|
cast = "Acting: "
|
||||||
for actor in movie.cast[:3]:
|
for actor in movie.cast[:3]:
|
||||||
cast+= f'{actor}, '
|
cast += f'{actor}, '
|
||||||
cast = cast[:-2]
|
cast = cast[:-2]
|
||||||
html_message = f"""<p><b>{escape(movie.title)}</b></p>
|
html_message = f"""<p><b>{escape(movie.title)}</b></p>
|
||||||
<p>{escape(movie.overview)[:200]}{three_dotts}</p>
|
<p>{escape(movie.overview)[:200]}{three_dotts}</p>
|
||||||
|
@ -84,7 +86,6 @@ class TmdbBot(Plugin):
|
||||||
url=f"{mxc_uri}")
|
url=f"{mxc_uri}")
|
||||||
await evt.respond(content)
|
await evt.respond(content)
|
||||||
|
|
||||||
|
|
||||||
@command.new("movie-id", help="Movie lookup by id")
|
@command.new("movie-id", help="Movie lookup by id")
|
||||||
@command.argument("message", pass_raw=True, required=True)
|
@command.argument("message", pass_raw=True, required=True)
|
||||||
async def movie_id(self, evt: MessageEvent, message: str = "") -> None:
|
async def movie_id(self, evt: MessageEvent, message: str = "") -> None:
|
||||||
|
@ -95,7 +96,6 @@ class TmdbBot(Plugin):
|
||||||
movie.query_details(message)
|
movie.query_details(message)
|
||||||
await self.send_movie_info(evt, movie)
|
await self.send_movie_info(evt, movie)
|
||||||
|
|
||||||
|
|
||||||
@command.new("movie-search", help="Movie lookup by Title")
|
@command.new("movie-search", help="Movie lookup by Title")
|
||||||
@command.argument("message", pass_raw=True, required=True)
|
@command.argument("message", pass_raw=True, required=True)
|
||||||
async def movie_search(self, evt: MessageEvent, message: str = "") -> None:
|
async def movie_search(self, evt: MessageEvent, message: str = "") -> None:
|
||||||
|
|
Loading…
Reference in a new issue