Compare commits

...

3 Commits

1 changed files with 22 additions and 0 deletions

View File

@ -221,6 +221,28 @@ class Module(ModuleManager.BaseModule):
)
)
@utils.hook("received.command.unn", alias_of="upnextnext")
@utils.hook("received.command.upnextnext")
@utils.kwarg("help", "show who's up after the next to stream")
def upnextnext(self, event):
js = utils.http.request(
AZURACAST_API_BASE + "/station/1/schedule?rows=2"
).json()
if len(js) < 1:
event["stdout"].write("nothing scheduled")
else:
data = js[1]
start = utils.datetime.parse.iso8601(data["start"])
now = utils.datetime.utcnow()
total_secs = (start - now).total_seconds()
event["stdout"].write(
"{} is up next next at {} UTC in {}!".format(
data["name"],
utils.datetime.format.datetime_human(start),
utils.datetime.format.to_pretty_time(total_secs),
)
)
@utils.hook("received.command.subscribe")
@utils.kwarg("help", "sign up to get a direct message when a new dj goes online")
def subscribe(self, event):