Merge branch 'develop' of codeberg.org:lomion/tmdb-bot into develop

This commit is contained in:
lomion 2021-03-15 16:04:39 +01:00
commit 1ae2bbf230
3 changed files with 35 additions and 2 deletions

31
concourse.yml Normal file
View file

@ -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

3
runtests.sh Executable file
View file

@ -0,0 +1,3 @@
#!/bin/bash
pip3 install -r requirements.txt
python3 test_tmdb.py

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)