summaryrefslogblamecommitdiffstats
path: root/skripti/mgl_obvesti_ob_dogodku.py
blob: 47d63c6e8b013b0f215dcfd6f5c4dda668531266 (plain) (tree)



















                                                                                                                                                                         
#!/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)