move sources to src/
parent
6df26b1e7c
commit
310d236390
|
|
@ -1,6 +1,6 @@
|
||||||
FROM python:3.6-alpine3.7
|
FROM python:3.6-alpine3.7
|
||||||
|
|
||||||
ADD [".", "/app"]
|
ADD ["src", "requirements.txt", "/app/"]
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
RUN apk add --update g++ gfortran openblas-dev libpng-dev musl-dev freetype-dev libpng openblas libstdc++ && \
|
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 && \
|
pip install -r requirements.txt --no-cache-dir && \
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,6 @@ version: "2"
|
||||||
services:
|
services:
|
||||||
doorbot:
|
doorbot:
|
||||||
build: .
|
build: .
|
||||||
image: fswiai/doorbot:0.3.2
|
image: fswiai/doorbot:0.4
|
||||||
volumes:
|
volumes:
|
||||||
- ./settings.json:/app/settings.json
|
- ./settings.json:/app/settings.json
|
||||||
|
|
@ -10,7 +10,7 @@ class Source:
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
def is_recent(self, status, **kwargs):
|
def is_recent(self, status, **kwargs):
|
||||||
raise NotImplementedError()
|
return status.timestamp + datetime.timedelta(days=1) < datetime.datetime.today()
|
||||||
|
|
||||||
class IsFsWIAIopen(Source):
|
class IsFsWIAIopen(Source):
|
||||||
url = "https://isfswiaiopen.wiai.de?json"
|
url = "https://isfswiaiopen.wiai.de?json"
|
||||||
|
|
@ -29,7 +29,4 @@ class IsFsWIAIopen(Source):
|
||||||
return Status(
|
return Status(
|
||||||
doorstate=str(status['doorstate']),
|
doorstate=str(status['doorstate']),
|
||||||
timestamp=self._parse_time(status['timestamp']),
|
timestamp=self._parse_time(status['timestamp']),
|
||||||
text=self._get_text(str(status['doorstate'])))
|
text=self._get_text(str(status['doorstate'])))
|
||||||
|
|
||||||
def is_recent(self, status, **kwargs):
|
|
||||||
return status.timestamp + datetime.timedelta(days=1) < datetime.datetime.today()
|
|
||||||
|
|
@ -7,17 +7,19 @@ from matrix_client.errors import MatrixError
|
||||||
|
|
||||||
|
|
||||||
class Client:
|
class Client:
|
||||||
|
def __init__(self):
|
||||||
|
raise NotImplementedError()
|
||||||
|
|
||||||
def post_image(self, file, name, content_type="image/png", targets=None):
|
def post_image(self, file, name, content_type="image/png", targets=None):
|
||||||
"""Push to all targets"""
|
"""Push to all targets"""
|
||||||
self.post_image(file, name, content_type, targets)
|
self.post_image(file, name, content_type, targets)
|
||||||
#raise NotImplementedError()
|
|
||||||
|
|
||||||
def send_image(self, target, file, name, content_type="image/png"):
|
def send_image(self, target, file, name, content_type="image/png"):
|
||||||
"""Send an image to a room
|
"""Send an image to a room
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
target (str): The internal room id to post into
|
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
|
name (str): The name for the file in the room
|
||||||
content_type (str): Content-type of the image
|
content_type (str): Content-type of the image
|
||||||
"""
|
"""
|
||||||
|
|
@ -26,7 +28,6 @@ class Client:
|
||||||
def post_text(self, text, targets=None):
|
def post_text(self, text, targets=None):
|
||||||
"""Push to all targets"""
|
"""Push to all targets"""
|
||||||
self.post_text(text, targets)
|
self.post_text(text, targets)
|
||||||
#raise NotImplementedError()
|
|
||||||
|
|
||||||
def send_text(self, target, text):
|
def send_text(self, target, text):
|
||||||
"""Send a text to a room
|
"""Send a text to a room
|
||||||
Loading…
Reference in New Issue