2024-03-04 17:56:32 -08:00
|
|
|
import logging
|
2024-03-01 01:00:17 -08:00
|
|
|
|
2024-03-04 17:56:32 -08:00
|
|
|
from bottle import route, abort
|
|
|
|
|
|
|
|
from croaker import streamer
|
2024-03-01 01:00:17 -08:00
|
|
|
|
|
|
|
|
|
|
|
@route("/play/<playlist_name>")
|
|
|
|
def play(playlist_name=None):
|
2024-03-04 17:56:32 -08:00
|
|
|
if not streamer.load(playlist_name):
|
2024-03-01 01:00:17 -08:00
|
|
|
return
|
|
|
|
return "OK"
|
|
|
|
|
|
|
|
|
|
|
|
@route("/skip")
|
|
|
|
def skip():
|
2024-03-04 17:56:32 -08:00
|
|
|
if not streamer.play_next():
|
2024-03-01 01:00:17 -08:00
|
|
|
return
|
|
|
|
return "OK"
|
2024-03-04 17:56:32 -08:00
|
|
|
|
|
|
|
|
|
|
|
@route("/next_in_queue")
|
|
|
|
def next_in_queue():
|
|
|
|
pl = controller.now_playing()
|
|
|
|
logging.debug(pl)
|
|
|
|
if not pl:
|
|
|
|
abort()
|
|
|
|
track1 = pl.current
|
|
|
|
controller.play_next()
|
|
|
|
tracke2 = controller.now_playing().current
|
|
|
|
return '\n'.join([str(track1), str(track2)])
|