Skip to content
Snippets Groups Projects
Verified Commit 55d45176 authored by Tilman Vatteroth's avatar Tilman Vatteroth :robot:
Browse files

fix some errors

parent 4410c570
Branches
No related tags found
No related merge requests found
FROM python:3-alpine
RUN apk upgrade --available --update
RUN apk add --no-cache msmtp tzdata
WORKDIR /usr/src/app
COPY requirements.txt ./
RUN adduser --uid 1000 --disabled-password bot bot
COPY requirements.txt /usr/src/app/requirements.txt
RUN apk add --no-cache build-base && \
pip install --no-cache-dir -r requirements.txt && \
pip install --no-cache-dir -r /usr/src/app/requirements.txt && \
apk del build-base
COPY src .
COPY src /usr/src/app
COPY run.sh /usr/local/bin/run.sh
COPY crontab /var/spool/cron/crontabs/programbot
COPY crontab /var/spool/cron/crontabs/bot
RUN chmod +x /usr/local/bin/run.sh
RUN apk add --no-cache msmtp
CMD ["crond", "-f"]
CMD ["crond", "-f", "-l", "0"]
* 9 * * * /usr/local/bin/run.sh >/dev/null 2>&1
* * * * * /usr/local/bin/run.sh 2>&1
#!/bin/bash
#!/bin/sh
cd /usr/src/app
......@@ -19,11 +19,14 @@ function preview {
echo ""
}
OUTPUT="$(preview)"
if [ ! -z "$OUTPUT" ]
then
#if [ ! -z "$OUTPUT" ]
#then
(cat << EOF
Subject:Programm-Info-Bot
Content-Type: text/plain; charset=UTF-8
$(preview)"
EOF
) | msmtp ${MSMTP_ARGUMENTS}
echo "$OUTPUT" | msmtp -a "Content-Type: text/plain; charset=UTF-8" ${MSMTP_ARGUMENTS}
fi
#fi
......@@ -85,7 +85,7 @@ class NextEvent:
link = str(next_event["id"]) + "-" + link
self.link = "https://ufc.tu-dortmund.de/vorstellung/%s" % link
if next_event["movie"]["youtube_id"] is not "":
if next_event["movie"]["youtube_id"] != "":
self.trailer = "https://youtu.be/%s" % next_event["movie"]["youtube_id"]
response = requests.get("https://ufc.tu-dortmund.de/%s"
......
......@@ -61,7 +61,7 @@ message = [
"\n",
"*", next_event.title, "*\n",
"\n",
next_event.description, "" if next_event.description is "" else "\n\n",
next_event.description, "" if next_event.description == "" else "\n\n",
next_event.movie_description, "\n",
"\n",
next_event.tags, "\n",
......@@ -70,7 +70,7 @@ message = [
]
# Trailernachricht zusammenbauen
if next_event.trailer is not "":
if next_event.trailer != "":
message.append("\n[Link zum Trailer](%s)" % next_event.trailer)
text = ''.join(message)
......
......@@ -67,9 +67,9 @@ message = [
"\n",
next_event.title,
"\n",
"" if next_event.description is "" else "\n",
"" if next_event.description == "" else "\n",
next_event.description,
"" if next_event.description is "" else "\n\n",
"" if next_event.description == "" else "\n\n",
"%s?pk_campaign=twitter" % next_event.link
]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment