Example #1
0
    async def run(self):
        while True:
            emitter.emit("METADATA_GET")
            metadata = emitter.emit("METADATA_STATE")
            if metadata.play_now and metadata.name:
                emitter.emit("NOTIFICATION", metadata.play_now, metadata.name)
            log.info(metadata)
            self.update(metadata)

            await asyncio.sleep(120)
Example #2
0
def list(event, **kwargs):
    list_buffer = event.app.layout.get_buffer_by_name(LISTVIEW_BUFFER)
    subcommand = kwargs["variables"].get("subcommand")
    term = kwargs["variables"].get("term")
    resp = emitter.emit("RADIO_SEARCH", command=subcommand, term=term)
    stations.new(*resp)
    list_buffer.update(str(stations))
Example #3
0
def play(event, **kwargs):
    call_command_handler("stop", event)
    list_buffer = event.app.layout.get_buffer_by_name(LISTVIEW_BUFFER)
    index = list_buffer.get_index(**kwargs)
    station = stations[int(index)]

    emitter.emit("RADIO_PLAY", station)
    emitter.emit("METADATA_INIT", station)

    display_buffer = event.app.layout.get_buffer_by_name(DISPLAY_BUFFER)

    emitter.emit("METADATA_GET")
    metadata = emitter.emit("METADATA_STATE")
    display_buffer.update(metadata)
Example #4
0
 def _(event):
     emitter.emit("RADIO_STOP")
Example #5
0
 def _(event):
     event.app.exit()
     emitter.emit("KILLALL")
Example #6
0
def stop(event, **kwargs):
    display_buffer = event.app.layout.get_buffer_by_name(DISPLAY_BUFFER)
    display_buffer.clear()
    emitter.emit("RADIO_STOP")
Example #7
0
def exit(event, **kwargs):
    """ exit Ctrl + Q"""
    emitter.emit("KILLALL")
    event.app.exit()
Example #8
0
def pause(event, **kwargs):
    emitter.emit("RADIO_PAUSE")