2 changed files with 60 additions and 0 deletions
@ -0,0 +1,53 @@
@@ -0,0 +1,53 @@
|
||||
import mystic_bbs as bbs |
||||
import random |
||||
import json |
||||
|
||||
tdihJSON = '/mystic/tdih.json' |
||||
|
||||
############################ |
||||
# Custom function to pause # |
||||
############################ |
||||
|
||||
def pause(): |
||||
bbs.writeln("|PA") |
||||
|
||||
################################## |
||||
# Custom fuction to clear screen # |
||||
################################## |
||||
|
||||
def clear(): |
||||
bbs.write('|CL') |
||||
|
||||
############# |
||||
# Line Feed # |
||||
############# |
||||
|
||||
def linefeed(): |
||||
bbs.writeln('|CR') |
||||
|
||||
################### |
||||
# Show Title ANSI # |
||||
################### |
||||
|
||||
def showTitle(): |
||||
bbs.showfile("tdih.ans", 57600, 0, 0, 0) |
||||
|
||||
# Import the JSON File with today's history |
||||
with open("tdih.json", "r") as f: |
||||
tdih = json.load(f) |
||||
|
||||
# Count the events and generate 5 random numbers within that range |
||||
rEventNums = random.sample(range(0,len(tdih["data"]["Events"])-1), 5) |
||||
|
||||
clear() |
||||
showTitle() |
||||
linefeed() |
||||
|
||||
# Sort the random event numbers in numerical order and print each one. |
||||
for rEventNum in sorted(rEventNums): |
||||
event = tdih["data"]["Events"][rEventNum] |
||||
bbs.writeln('|15' + event["year"] + ' |08- |07' + event["text"]) |
||||
|
||||
linefeed() |
||||
pause() |
||||
|
Loading…
Reference in new issue