From ecaf23b2ae501bac4a8f4762d3a46068366a6d01 Mon Sep 17 00:00:00 2001 From: televex Date: Sun, 21 Feb 2021 18:23:23 +0000 Subject: [PATCH] first commit, wooo! --- .gitignore | 1 + requirements.txt | 4 ++ televex.py | 112 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 117 insertions(+) create mode 100644 .gitignore create mode 100644 requirements.txt create mode 100644 televex.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9e3d04c --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +venv* diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..4a444d5 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +feedparser +icalendar +requests +pypandoc diff --git a/televex.py b/televex.py new file mode 100644 index 0000000..767dbc8 --- /dev/null +++ b/televex.py @@ -0,0 +1,112 @@ +import feedparser +import os +from icalendar import Calendar +import datetime +from requests import get +import urllib +import json +import pypandoc +import time + +ics = get("https://varia.zone/events.ics").text +gcal = Calendar.from_ical(ics) +now = datetime.datetime.now() + +while True: + + os.system("toilet --gay -w 125 -W --filter border:gay \ \ \ VARIA\ \ \ ") + + print("") + time.sleep(3) + + abouts = [""" + [NL] +--- +Varia is een collectieve ruimte1 in Rotterdam die zich richt op alledaagse technologie. +--- +Wij zijn van mening dat technologie niet het exclusieve domein van specialisten moet zijn. +Technologie beinvloedt iedereen en zou verschillende manieren van leven mogelijk moeten +maken, in plaats van deze uit te sluiten. We vatten alledaagse technologie breed op; +niet alleen computers, standaarden of protocollen horen daarbij, maar bijvoorbeeld ook +kookgereedschappen of muziekinstrumenten. +--- +Vanuit onze achtergrond in kunst, ontwerp, software & hardware, onderwijs en theoretische +praktijk, voelen we de behoefte om een plek te vormen waar technologie en sociale vragen +met elkaar verbonden zijn; een plek waar samenwerking, continuteit, ontwikkeling, +collectief leren, nieuwsgierigheid en experiment voorop staan. +--- +""", +""" + [EN] +--- │·················································································· + Varia is a collective-space in Rotterdam focused on everyday technologies. │·················································································· +--- │·················································································· +We believe technology should not be the exclusive domain of specialists. │·················································································· +It affects everyone and should enable, rather than preclude, diverse ways of living. │·················································································· +We understand everyday technology broadly; not just as computers, standards, or │·················································································· +protocols, but also, for example, as cooking tools or musical instruments. │·················································································· +--- │·················································································· +Being involved in the fields of art, design, software & hardware, education │·················································································· +and theoretical practices, we felt the need for a place where technology and │·················································································· +social questions are linked; a place where collaboration, continuity, development, │·················································································· +collective learning, curiosity and experiments are foregrounded. │·················································································· +--- │·················································································· + """ + ] +# for lang in abouts: +# for line in lang.split('\n'): +# os.system(f"echo '{ line }' | lolcat -a") +# +# print("") +# time.sleep(10) + + for c in gcal.walk(): + + if c.name == "VEVENT": + + date = c.get("dtstart").dt + title = c.get("summary") + + if date > now: + + os.system("toilet --gay -w 125 -W --filter border:gay \ COMING UP\ \ ") + + print("") + time.sleep(3) + + url = 'https://multi.vvvvvvaria.org/API/latest/25' + response = urllib.request.urlopen(url).read() + multifeeder = json.loads(response) + + for post in multifeeder: + + # Clean up the title of the RSS & Calendar + title = title.lower().strip().replace('\n','') + rss_title = post["title"].lower().strip().replace('\n','') + + if title == rss_title: + + description = pypandoc.convert_text(post["summary"], 'plain', format='html') + + # Send the event to the terminal· + os.system(f"toilet -f mono12 --gay -w 125 -W --filter border:gay '{ title }'") + print("") + time.sleep(1) + + print(date.strftime("%A %d %B %Y (%H:%M:%S)")) + print("") + time.sleep(1) + + #print(description) + lines = [line for line in description.split('\n')] + for line in lines: + # HACKY!!! + line = line.replace('&', '\&') + line = line.replace('(', '\(') + line = line.replace(')', '\)') + line = line.replace(';', '\;') + line = line.replace('"', '\"') + line = line.replace("'", "\'") + os.system(f"echo { line } | lolcat -a") + print("") + time.sleep(10)