Exemple #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)
Exemple #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))
Exemple #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)
Exemple #4
0
 def _(event):
     emitter.emit("RADIO_STOP")
Exemple #5
0
 def _(event):
     event.app.exit()
     emitter.emit("KILLALL")
Exemple #6
0
def stop(event, **kwargs):
    display_buffer = event.app.layout.get_buffer_by_name(DISPLAY_BUFFER)
    display_buffer.clear()
    emitter.emit("RADIO_STOP")
Exemple #7
0
def exit(event, **kwargs):
    """ exit Ctrl + Q"""
    emitter.emit("KILLALL")
    event.app.exit()
Exemple #8
0
def pause(event, **kwargs):
    emitter.emit("RADIO_PAUSE")