Exemplo n.º 1
0
def queue(update, context):
    """Lists upcoming songs."""
    args = util.parse_command_args(update.message, int)
    limit = args[0] if len(args) else 5

    with mpdclient() as c:
        items = c.playlistinfo(f'0:{limit}')

    upcoming = r'Queue is empty\.'
    if len(items) > 0:
        try:
            upcoming = '\n'.join(
                util.format_song_for_queue(*x) for x in enumerate(items, 1))
        except Exception as e:
            print(e)
    # upcoming = '\n'.join(upcoming.splitlines()[:1])
    print(upcoming)
    update.message.reply_text(upcoming, parse_mode='MarkdownV2')
Exemplo n.º 2
0
def skip(update, context):
    """Skips the current song."""
    with mpdclient() as c:
        c.next()
    update.message.reply_text('Skipping.')
Exemplo n.º 3
0
def clear(update, context):
    """Clears the queue."""
    with mpdclient() as c:
        c.clear()
    update.message.reply_text('Queue cleared!')
Exemplo n.º 4
0
def stop(update, context):
    """Stops playing."""
    with mpdclient() as c:
        c.stop()
    update.message.reply_text('Stopping music.')
Exemplo n.º 5
0
def status(update, context):
    """Current player status"""
    with mpdclient() as c:
        # TODO(shoeffner): Handle properly
        update.message.reply_text(c.status())
Exemplo n.º 6
0
def now_playing(update, context):
    """Information about the current song."""
    with mpdclient() as c:
        song = c.currentsong()
    # TODO(shoeffner): Handle properly
    update.message.reply_text(song)
Exemplo n.º 7
0
def play(update, context):
    """Starts playing."""
    with mpdclient() as c:
        c.consume(1)
        c.play()
    update.message.reply_text('Playing music.')