Removed mime type from upload_media call for better preview compatibility. Works better in Android Web and Fluffy Chat.

This commit is contained in:
lomion 2021-03-06 21:28:55 +01:00
parent 2c520ac3e9
commit 2d40cd9444
2 changed files with 3 additions and 4 deletions

View file

@ -95,7 +95,7 @@ class TestTmdbMethods(unittest.TestCase):
def test_search_tvshow(self): def test_search_tvshow(self):
movie = TvShow() movie = TvShow()
id = movie.search_title('The Flash') id = movie.search_title('The Flash')
self.assertEqual(id, 236) self.assertEqual(id, 60735)
def test_tv_title(self): def test_tv_title(self):
movie = TvShow() movie = TvShow()
@ -106,7 +106,7 @@ class TestTmdbMethods(unittest.TestCase):
movie = TvShow() movie = TvShow()
movie.search_title('The Flash') movie.search_title('The Flash')
#self.assertEqual('Tom Cavanagh', movie.cast[0]) #self.assertEqual('Tom Cavanagh', movie.cast[0])
self.assertEqual('Alex Désert', movie.cast[2]) self.assertEqual('Danielle Panabaker', movie.cast[2])
def test_poster_path(self): def test_poster_path(self):
movie = Movie() movie = Movie()

View file

@ -101,14 +101,13 @@ class TmdbBot(Plugin):
async def send_image(self, evt: MessageEvent, title, image) -> None: async def send_image(self, evt: MessageEvent, title, image) -> None:
if image: if image:
mxc_uri = await self.client.upload_media(image, mime_type='image/jpg') mxc_uri = await self.client.upload_media(image)
content = MediaMessageEventContent( content = MediaMessageEventContent(
msgtype=MessageType.IMAGE, msgtype=MessageType.IMAGE,
body=f"Image {title}", body=f"Image {title}",
url=f"{mxc_uri}", url=f"{mxc_uri}",
info=ImageInfo(mimetype='image/jpg')) info=ImageInfo(mimetype='image/jpg'))
await evt.respond(content) await evt.respond(content)
#await self.client.send_image(evt.room_id, url=mxc_uri, info=ImageInfo(mimetype='image/jpg'))
def split_title_year(self, message : str) -> (str, int): def split_title_year(self, message : str) -> (str, int):
m = re.search(r'^(.*) (y:\d\d\d\d)', message) m = re.search(r'^(.*) (y:\d\d\d\d)', message)