Exemplo n.º 1
0
def replacep(args):
    songs = list(parser.parse(args.collection))
    if songs:
        mpd.replace(songs)
        mpd.play()
    else:
        mpd.clear()
Exemplo n.º 2
0
def play(args):
    songs = parser.parse(args.collection)
    if songs:
        positions = mpd.get_playlist_positions()
        try:
            first_matched_song = next(s for s in positions if s in songs)
        except StopIteration:
            pass
        else:
            mpd.play(positions[first_matched_song][0])