From 2d40cd9444b110b126ac6077d34ff3d4b78328ea Mon Sep 17 00:00:00 2001 From: lomion Date: Sat, 6 Mar 2021 21:28:55 +0100 Subject: [PATCH 1/2] Removed mime type from upload_media call for better preview compatibility. Works better in Android Web and Fluffy Chat. --- test_tmdb.py | 4 ++-- tmdb/tmdb.py | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/test_tmdb.py b/test_tmdb.py index 6d9079d..54c026a 100644 --- a/test_tmdb.py +++ b/test_tmdb.py @@ -95,7 +95,7 @@ class TestTmdbMethods(unittest.TestCase): def test_search_tvshow(self): movie = TvShow() id = movie.search_title('The Flash') - self.assertEqual(id, 236) + self.assertEqual(id, 60735) def test_tv_title(self): movie = TvShow() @@ -106,7 +106,7 @@ class TestTmdbMethods(unittest.TestCase): movie = TvShow() movie.search_title('The Flash') #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): movie = Movie() diff --git a/tmdb/tmdb.py b/tmdb/tmdb.py index 4ec16c9..3ca766d 100644 --- a/tmdb/tmdb.py +++ b/tmdb/tmdb.py @@ -101,14 +101,13 @@ class TmdbBot(Plugin): async def send_image(self, evt: MessageEvent, title, image) -> None: if image: - mxc_uri = await self.client.upload_media(image, mime_type='image/jpg') + mxc_uri = await self.client.upload_media(image) content = MediaMessageEventContent( msgtype=MessageType.IMAGE, body=f"Image {title}", url=f"{mxc_uri}", info=ImageInfo(mimetype='image/jpg')) 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): m = re.search(r'^(.*) (y:\d\d\d\d)', message) From 3c4a313970c780ddb7452039a6c85a92c506b640 Mon Sep 17 00:00:00 2001 From: lomion Date: Fri, 12 Mar 2021 20:23:52 +0100 Subject: [PATCH 2/2] Added Concourse CI files --- concourse.yml | 31 +++++++++++++++++++++++++++++++ runtests.sh | 3 +++ 2 files changed, 34 insertions(+) create mode 100644 concourse.yml create mode 100755 runtests.sh diff --git a/concourse.yml b/concourse.yml new file mode 100644 index 0000000..6b56e94 --- /dev/null +++ b/concourse.yml @@ -0,0 +1,31 @@ +--- +resources: +- name: git-repo + type: git + source: + uri: https://codeberg.org/lomion/tmdb-bot + branch: develop + +- name: python-image + type: registry-image + icon: docker + source: + repository: python + tag: 3 + +jobs: +- name: unittests + public: true + plan: + - get: git-repo + trigger: true + - get: python-image + - task: run_tests + image: python-image + config: + platform: linux + inputs: + - name: git-repo + run: + dir: git-repo + path: ./runtests.sh diff --git a/runtests.sh b/runtests.sh new file mode 100755 index 0000000..811a057 --- /dev/null +++ b/runtests.sh @@ -0,0 +1,3 @@ +#!/bin/bash +pip3 install -r requirements.txt +python3 test_tmdb.py