move sources to src/

master
Clemens Klug 2018-04-16 14:04:23 +02:00
parent 6df26b1e7c
commit 310d236390
6 changed files with 8 additions and 10 deletions

View File

@ -1,6 +1,6 @@
FROM python:3.6-alpine3.7
ADD [".", "/app"]
ADD ["src", "requirements.txt", "/app/"]
WORKDIR /app
RUN apk add --update g++ gfortran openblas-dev libpng-dev musl-dev freetype-dev libpng openblas libstdc++ && \
pip install -r requirements.txt --no-cache-dir && \

View File

@ -3,6 +3,6 @@ version: "2"
services:
doorbot:
build: .
image: fswiai/doorbot:0.3.2
image: fswiai/doorbot:0.4
volumes:
- ./settings.json:/app/settings.json

View File

View File

@ -10,7 +10,7 @@ class Source:
raise NotImplementedError()
def is_recent(self, status, **kwargs):
raise NotImplementedError()
return status.timestamp + datetime.timedelta(days=1) < datetime.datetime.today()
class IsFsWIAIopen(Source):
url = "https://isfswiaiopen.wiai.de?json"
@ -29,7 +29,4 @@ class IsFsWIAIopen(Source):
return Status(
doorstate=str(status['doorstate']),
timestamp=self._parse_time(status['timestamp']),
text=self._get_text(str(status['doorstate'])))
def is_recent(self, status, **kwargs):
return status.timestamp + datetime.timedelta(days=1) < datetime.datetime.today()
text=self._get_text(str(status['doorstate'])))

View File

@ -7,17 +7,19 @@ from matrix_client.errors import MatrixError
class Client:
def __init__(self):
raise NotImplementedError()
def post_image(self, file, name, content_type="image/png", targets=None):
"""Push to all targets"""
self.post_image(file, name, content_type, targets)
#raise NotImplementedError()
def send_image(self, target, file, name, content_type="image/png"):
"""Send an image to a room
Args:
target (str): The internal room id to post into
path (file): The image file object
file (file): The image file object
name (str): The name for the file in the room
content_type (str): Content-type of the image
"""
@ -26,7 +28,6 @@ class Client:
def post_text(self, text, targets=None):
"""Push to all targets"""
self.post_text(text, targets)
#raise NotImplementedError()
def send_text(self, target, text):
"""Send a text to a room