summaryrefslogtreecommitdiffstats
path: root/skripti
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2024-01-14 21:53:42 +0100
committerAnton Luka Šijanec <anton@sijanec.eu>2024-01-14 21:53:42 +0100
commita5ea9c9d8de2b97c3f92a1f63b79e85401084574 (patch)
treec5a78a39dfff014dc02ff92fe3b0c38d28e73fed /skripti
parentretroaktiven izbris neuporabljene datoteke DN09 p1 (diff)
downloadr-a5ea9c9d8de2b97c3f92a1f63b79e85401084574.tar
r-a5ea9c9d8de2b97c3f92a1f63b79e85401084574.tar.gz
r-a5ea9c9d8de2b97c3f92a1f63b79e85401084574.tar.bz2
r-a5ea9c9d8de2b97c3f92a1f63b79e85401084574.tar.lz
r-a5ea9c9d8de2b97c3f92a1f63b79e85401084574.tar.xz
r-a5ea9c9d8de2b97c3f92a1f63b79e85401084574.tar.zst
r-a5ea9c9d8de2b97c3f92a1f63b79e85401084574.zip
Diffstat (limited to 'skripti')
-rwxr-xr-xskripti/mgl_obvesti_ob_dogodku.py20
-rwxr-xr-xskripti/mgl_obvesti_ob_dogodku.sh20
2 files changed, 40 insertions, 0 deletions
diff --git a/skripti/mgl_obvesti_ob_dogodku.py b/skripti/mgl_obvesti_ob_dogodku.py
new file mode 100755
index 0000000..47d63c6
--- /dev/null
+++ b/skripti/mgl_obvesti_ob_dogodku.py
@@ -0,0 +1,20 @@
+#!/usr/bin/python3
+import feedparser ### NOTE: TOLE JE BROKEN SKRIPT, KER KULTURNIK NE KAŽE VSEH DOGODKOV!!!!!!!!
+import sys
+import datetime
+import time
+import smtplib
+already = []
+while True:
+ for event in feedparser.parse("https://dogodki.ljudmila.net/?what=gledalisce&where=MGL%20-%20Mestno%20gledali%C5%A1%C4%8De%20ljubljansko&format=rss")["entries"]:
+ if event["title"] != sys.argv[1]:
+ continue
+ if datetime.datetime.fromisoformat(event["ical_dtstart"].split("+")[0]) > datetime.datetime.fromisoformat(sys.argv[2]):
+ if event["ical_dtstart"] in already:
+ continue
+ already.append(event["ical_dtstart"])
+ server = smtplib.SMTP("localhost", 25)
+ server.ehlo()
+ server.sendmail("r-skripti-mgl@sijanec.eu", "anton@sijanec.eu", f"Subject: mgl razpisana predstava\r\n\r\n{sys.argv[1]} {event['ical_dtstart']}")
+ server.close()
+ time.sleep(60)
diff --git a/skripti/mgl_obvesti_ob_dogodku.sh b/skripti/mgl_obvesti_ob_dogodku.sh
new file mode 100755
index 0000000..3714513
--- /dev/null
+++ b/skripti/mgl_obvesti_ob_dogodku.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+set -xeuo pipefail
+olds=""
+while :
+do
+ news=`curl -H "User-Agent: $0 kontakt anton@sijanec.eu" "https://www.mgl.si/sl/spored/?location=1&event=1072&subs=" | grep "big-date" | cut -d\> -f2 | cut -d\< -f1`
+ if [ "$news" = "$olds" ]
+ then
+ continue
+ fi
+sendmail anton@sijanec.eu <<EOF
+From: projects-r-skripti-mgl.sh@sijanec.eu
+To: anton@sijanec.eu
+Subject: novi datumi iskane predstave v mgl
+
+datumi so: $news
+EOF
+ olds=$news
+ sleep 60
+done