tweaking the screen script to avoid errors in the event descriptions
This commit is contained in:
parent
2a77ccd30e
commit
f163337313
@ -19,7 +19,6 @@ now = datetime.datetime.now()
|
|||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
|
||||||
#os.system("toilet --gay -w 125 -W --filter border:gay \ \ \ \ \ VARIA\ \ \ \ \ ")
|
|
||||||
os.system(f"{ PYTHON } tools/ascii-art-but-with-unicode/repeated_sinus_amplitude_variation.py | lolcat -a -d 1")
|
os.system(f"{ PYTHON } tools/ascii-art-but-with-unicode/repeated_sinus_amplitude_variation.py | lolcat -a -d 1")
|
||||||
print("")
|
print("")
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
@ -29,6 +28,9 @@ while True:
|
|||||||
print("")
|
print("")
|
||||||
time.sleep(10)
|
time.sleep(10)
|
||||||
|
|
||||||
|
# Avoid double posts
|
||||||
|
used = []
|
||||||
|
|
||||||
for c in gcal.walk():
|
for c in gcal.walk():
|
||||||
|
|
||||||
if c.name == "VEVENT":
|
if c.name == "VEVENT":
|
||||||
@ -40,52 +42,54 @@ while True:
|
|||||||
|
|
||||||
# An attempt to keep TeleVex running throughout the night
|
# An attempt to keep TeleVex running throughout the night
|
||||||
# (even if the Multifeeder/server is not available)
|
# (even if the Multifeeder/server is not available)
|
||||||
|
# --- works ---
|
||||||
try:
|
try:
|
||||||
url = 'https://multi.vvvvvvaria.org/API/latest/25'
|
url = 'https://multi.vvvvvvaria.org/API/latest/25'
|
||||||
response = urllib.request.urlopen(url).read()
|
response = urllib.request.urlopen(url).read()
|
||||||
multifeeder = json.loads(response)
|
multifeeder = json.loads(response)
|
||||||
|
|
||||||
except:
|
except:
|
||||||
|
|
||||||
multifeeder = []
|
multifeeder = []
|
||||||
os.system("toilet -f script -w 125 --gay Zzz... the server sleeps.")
|
os.system("toilet -f script -w 125 --gay Zzz... the server sleeps.")
|
||||||
|
|
||||||
for post in multifeeder:
|
for post in multifeeder:
|
||||||
|
|
||||||
# Clean up the title of the RSS & Calendar
|
if post["summary"] not in used:
|
||||||
title_check = title.lower().strip().replace('\n','')
|
|
||||||
rss_title_check = post["title"].lower().strip().replace('\n','')
|
|
||||||
|
|
||||||
if title_check == rss_title_check:
|
# Clean up the title of the RSS & Calendar
|
||||||
|
title_check = title.lower().strip().replace('\n','')
|
||||||
|
rss_title_check = post["title"].lower().strip().replace('\n','')
|
||||||
|
|
||||||
os.system("toilet --gay -w 125 -W --filter border:gay \ \ \ COMING UP\ \ \ \ ")
|
if title_check == rss_title_check:
|
||||||
print("")
|
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
description = pypandoc.convert_text(post["summary"], 'plain', format='html',extra_args=['--columns=64'])
|
# add this post to the "used" list above
|
||||||
|
used.append(post["summary"])
|
||||||
|
|
||||||
# Send the event to the terminal·
|
os.system("toilet --gay -w 125 -W --filter border:gay \ \ \ COMING UP\ \ \ \ ")
|
||||||
|
print("")
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
# Title
|
description = pypandoc.convert_text(post["summary"], 'plain', format='html',extra_args=['--columns=64'])
|
||||||
os.system(f"toilet -f big --gay -w 125 '{ title }'")
|
|
||||||
print("")
|
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
# Date
|
# Write description to a tmp file
|
||||||
print(date.strftime("%A %d %B %Y (%H:%M:%S)"))
|
with open("description.tmp","w") as tmp:
|
||||||
print("")
|
tmp.write(description)
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
# Description
|
# Send the event to the terminal·
|
||||||
lines = [line for line in description.split('\n')]
|
|
||||||
for line in lines:
|
# Title
|
||||||
# HACKY!!!
|
os.system(f"toilet -f big --gay -w 125 '{ title }'")
|
||||||
line = line.replace('\n', '')
|
print("")
|
||||||
#line = line.replace('(', '(')
|
time.sleep(1)
|
||||||
#line = line.replace(')', ')')
|
|
||||||
#line = line.replace(';', '\;')
|
# Date
|
||||||
#line = line.replace('"', '\"')
|
event_date = date.strftime("%A %d %B %Y (%H:%M:%S)")
|
||||||
#line = line.replace("'", "\'")
|
os.system(f"echo '{ event_date }' | lolcat -a -d 1")
|
||||||
os.system(f"echo '{ line }' | lolcat -a -d 1")
|
print("")
|
||||||
print("")
|
time.sleep(1)
|
||||||
time.sleep(3)
|
|
||||||
|
# Description
|
||||||
|
os.system("cat description.tmp | lolcat -a -d 1")
|
||||||
|
|
||||||
|
print("")
|
||||||
|
time.sleep(10)
|
||||||
|
Loading…
Reference in New Issue
Block a user