diff --git a/fotokiste/fotokiste/controllers.py b/fotokiste/fotokiste/controllers.py index 01251a7..60781c9 100644 --- a/fotokiste/fotokiste/controllers.py +++ b/fotokiste/fotokiste/controllers.py @@ -31,7 +31,7 @@ MAIL_ADDRESS_REGEX = r"^[a-zA-Z0-9._%-]+@[a-zA-Z0-9._%-]+\.[a-zA-Z]{2,6}$" # TODO: this path is relative - to be fixed! MAIL_SIGNATURE_FILE = os.path.join(os.getcwd(), "mail_signature.txt") MAIL_FROM_ADDRESS = '"Fusion-Fotokiste" ' -MAIL_SUBJECT = "Ein überwachungskritisches Foto von der Fusion!" +MAIL_SUBJECT = "Ein überwachungskritisches Foto aus der Frieda!" MAIL_ATTACHMENT_FILENAME = "fusion" + IMAGE_SUFFIX SMTP_HOST = "localhost" SMTP_PORT = "25" @@ -141,7 +141,7 @@ def send_mail(address, text): # send the mail try: con = smtplib.SMTP(SMTP_HOST, SMTP_PORT) - con.sendmail(address, MAIL_FROM_ADDRESS, writer.getvalue()) + con.sendmail(MAIL_FROM_ADDRESS, address, writer.getvalue()) con.quit() except (smtplib.SMTPHeloError, smtplib.SMTPRecipientsRefused, smtplib.SMTPSenderRefused, smtplib.SMTPDataError), msg: @@ -181,7 +181,12 @@ class Root(controllers.RootController): def mailtext(self, mailaddress="", mailtext="", already_captured="no", already_stored="no", **kargs): # store the picture if necessary if already_captured != "yes": - urllib.urlretrieve(SNAPSHOT_URL, IMAGE_STORE) + try: + urllib.urlretrieve(SNAPSHOT_URL, IMAGE_STORE) + except: + #os.system("reboot") + flash("Achtung: dein Foto enthaelt moeglicherweise menschenverachtende Inhalte. Bitte wende dich fuer einen umfassenden Persoenlichkeitstest an der Bar. Danke fuer deine Kooperation!") + redirect("index", DEFAULT_DICT) already_captured = "no" if already_stored != "yes": already_stored = "no" @@ -226,7 +231,8 @@ class Root(controllers.RootController): if send_mail(mailaddress, mailtext): return return_dict else: - redirect("error") + flash("Fehler beim Senden der Mail! Ist die Adresse korrekt?") + redirect("mailtext", return_dict) @expose() def get_current_shot(self): diff --git a/fotokiste/fotokiste/static/javascript/mjp-streamer.js b/fotokiste/fotokiste/static/javascript/mjp-streamer.js index 3b50abe..beaa212 100644 --- a/fotokiste/fotokiste/static/javascript/mjp-streamer.js +++ b/fotokiste/fotokiste/static/javascript/mjp-streamer.js @@ -20,6 +20,8 @@ function createImageLayer() { webcam.insertBefore(img, webcam.firstChild); } + + // Two layers are always present (except at the very beginning), to avoid flicker function imageOnload() { this.style.zIndex = imageNr; // Image finished, bring to front! @@ -28,7 +30,7 @@ function imageOnload() { del.parentNode.removeChild(del); } finished.push(this); - if (!paused) createImageLayer(); + if (!paused) window.setTimeout(createImageLayer(), 1000); } function imageOnclick() { // Clicking on the image will pause the stream diff --git a/fotokiste/mail_signature.txt b/fotokiste/mail_signature.txt index 93366ba..bb24903 100644 --- a/fotokiste/mail_signature.txt +++ b/fotokiste/mail_signature.txt @@ -4,7 +4,7 @@ Hallo, -diese Mail wurde Ihnen von der panoptischen Fotokiste auf der Fusion 2008 in Lärz geschickt. +diese Mail wurde Ihnen mit der panoptischen Fotokiste vom Frieda Hoffest 2008 in Rostock geschickt. Die Personen auf dem Foto möchten damit ein Zeichen gegen zunehmend verschärfte Überwachungsbestrebungen setzen und sie mit den folgenden Punkten auf Ihre Handlungsmöglichkeiten aufmerksam machen. diff --git a/fotokiste/system-scripts/fotokiste b/fotokiste/system-scripts/fotokiste new file mode 100755 index 0000000..0c35b01 --- /dev/null +++ b/fotokiste/system-scripts/fotokiste @@ -0,0 +1,39 @@ +#!/bin/sh +set -u +FOTOKISTE_DIR="/usr/local/src/fotokiste" +FOTOKISTE_EXEC="start-fotokiste.py" +PID_FILE="/var/run/fotokiste.pid" +LOG_FILE="/var/log/fotokiste.log" +MJPG_STREAMER=/usr/local/src/mjpg-streamer/start-fotokiste.sh +LOG_FILE_MJPG=/var/log/mjpg-streamer.log +PID_FILE_MJPG=/var/run/mjpg-streamer.pid + +case "$1" in + start) + echo -n "Starting Fotokiste ... " + "$MJPG_STREAMER" &>"$LOG_FILE_MJPG" "$PID_FILE_MJPG" + cd "$FOTOKISTE_DIR"; python "$FOTOKISTE_EXEC" "$LOG_FILE" & + echo "$!" >"$PID_FILE" + echo done + X & + export DISPLAY=:0 + xhost + + sleep 30 + su glasmensch /usr/bin/iceweasel & + ;; + stop) + killall X + for pfile in "$PID_FILE" "$PID_FILE_MJPG" + do test -e "$pfile" && kill "$(cat "$pfile")" + rm -f "$pfile" + done + ;; + restart) + "$0" stop + "$0" start + ;; + esac + +exit 0 + diff --git a/fotokiste/system-scripts/mjpg-streamer.sh b/fotokiste/system-scripts/mjpg-streamer.sh new file mode 100644 index 0000000..8159dca --- /dev/null +++ b/fotokiste/system-scripts/mjpg-streamer.sh @@ -0,0 +1 @@ +LD_LIBRARY_PATH="$(pwd)" ./mjpg_streamer -i "input_uvc.so -r 320x240 -f 25" -o "output_http.so -w $(pwd)/www --port 8081"