~radio: Cleanup, but still needs more
parent
feeb861b66
commit
36204229b9
|
@ -99,11 +99,11 @@ def on_load():
|
||||||
@p.command("&np", help_text="Show the current song on tilderadio")
|
@p.command("&np", help_text="Show the current song on tilderadio")
|
||||||
def nowplaying(event):
|
def nowplaying(event):
|
||||||
save_nowplaying("")
|
save_nowplaying("")
|
||||||
event["stdout"].write(format_nowplaying())
|
return p.message(format_nowplaying());
|
||||||
|
|
||||||
# &schedule [Show a link to the tilderadio schedule]
|
# &schedule [Show a link to the tilderadio schedule]
|
||||||
def schedule(event):
|
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)]
|
# &un [Show who's up next to stream (schedule)]
|
||||||
|
@ -113,14 +113,14 @@ def upnext(event):
|
||||||
AZURACAST_API_BASE + "/station/1/schedule"
|
AZURACAST_API_BASE + "/station/1/schedule"
|
||||||
).json()
|
).json()
|
||||||
if len(js) < 1:
|
if len(js) < 1:
|
||||||
event["stdout"].write("nothing scheduled")
|
return p.message("Nothing scheduled")
|
||||||
else:
|
else:
|
||||||
data = js[0]
|
data = js[0]
|
||||||
print(data["start"]);
|
#print(data["start"]);
|
||||||
start = iso8601(data["start"])
|
start = iso8601(data["start"])
|
||||||
now = utcnow()
|
now = utcnow()
|
||||||
total_secs = (start - now).total_seconds()
|
total_secs = (start - now).total_seconds()
|
||||||
event["stdout"].write(
|
return p.message(
|
||||||
"{} is up next at {} UTC in {}!".format(
|
"{} is up next at {} UTC in {}!".format(
|
||||||
data["name"],
|
data["name"],
|
||||||
datetime_human(start),
|
datetime_human(start),
|
||||||
|
@ -134,13 +134,13 @@ def upnextnext(event):
|
||||||
AZURACAST_API_BASE + "/station/1/schedule"
|
AZURACAST_API_BASE + "/station/1/schedule"
|
||||||
).json()
|
).json()
|
||||||
if len(js) < 1:
|
if len(js) < 1:
|
||||||
event["stdout"].write("nothing scheduled")
|
return p.message("Nothing scheduled")
|
||||||
else:
|
else:
|
||||||
data = js[1]
|
data = js[1]
|
||||||
start = iso8601(data["start"])
|
start = iso8601(data["start"])
|
||||||
now = utils.datetime.utcnow()
|
now = utils.datetime.utcnow()
|
||||||
total_secs = (start - now).total_seconds()
|
total_secs = (start - now).total_seconds()
|
||||||
event["stdout"].write(
|
return p.message(
|
||||||
"{} is up next next at {} UTC in {}!".format(
|
"{} is up next next at {} UTC in {}!".format(
|
||||||
data["name"],
|
data["name"],
|
||||||
datetime_human(start),
|
datetime_human(start),
|
||||||
|
@ -160,7 +160,7 @@ def showdj(event):
|
||||||
message += " (for {})".format(
|
message += " (for {})".format(
|
||||||
to_pretty_time(total_seconds)
|
to_pretty_time(total_seconds)
|
||||||
)
|
)
|
||||||
event["stdout"].write(message)
|
return p.message(message)
|
||||||
|
|
||||||
|
|
||||||
# Funtions for this to work
|
# Funtions for this to work
|
||||||
|
|
Loading…
Reference in New Issue