~radio: Cleanup, but still needs more

master
jmjl 2021-10-24 06:45:05 +00:00
parent feeb861b66
commit 36204229b9
1 changed files with 8 additions and 8 deletions

View File

@ -99,11 +99,11 @@ def on_load():
@p.command("&np", help_text="Show the current song on tilderadio")
def nowplaying(event):
save_nowplaying("")
event["stdout"].write(format_nowplaying())
return p.message(format_nowplaying());
# &schedule [Show a link to the tilderadio schedule]
def schedule(event):
event["stdout"].write(f"You can find the schedule here: {SCHEDULE_URL}")
return p.message(f"You can find the schedule here: {SCHEDULE_URL}")
# &un [Show who's up next to stream (schedule)]
@ -113,14 +113,14 @@ def upnext(event):
AZURACAST_API_BASE + "/station/1/schedule"
).json()
if len(js) < 1:
event["stdout"].write("nothing scheduled")
return p.message("Nothing scheduled")
else:
data = js[0]
print(data["start"]);
#print(data["start"]);
start = iso8601(data["start"])
now = utcnow()
total_secs = (start - now).total_seconds()
event["stdout"].write(
return p.message(
"{} is up next at {} UTC in {}!".format(
data["name"],
datetime_human(start),
@ -134,13 +134,13 @@ def upnextnext(event):
AZURACAST_API_BASE + "/station/1/schedule"
).json()
if len(js) < 1:
event["stdout"].write("nothing scheduled")
return p.message("Nothing scheduled")
else:
data = js[1]
start = iso8601(data["start"])
now = utils.datetime.utcnow()
total_secs = (start - now).total_seconds()
event["stdout"].write(
return p.message(
"{} is up next next at {} UTC in {}!".format(
data["name"],
datetime_human(start),
@ -160,7 +160,7 @@ def showdj(event):
message += " (for {})".format(
to_pretty_time(total_seconds)
)
event["stdout"].write(message)
return p.message(message)
# Funtions for this to work