Exemplo n.º 1
0
def playback_notify(self, type):
    if type == lib.kSpPlaybackNotifyPlay:
        print("kSpPlaybackNotifyPlay")
        device.acquire()
        lastfm.play()
        playback_led.on()
        play_pause_button.when_pressed = lambda: lib.SpPlaybackPause()
    elif type == lib.kSpPlaybackNotifyPause:
        print("kSpPlaybackNotifyPause")
        lastfm.pause()
        playback_led.off()
        play_pause_button.when_pressed = lambda: lib.SpPlaybackPlay()
        device.release()
    elif type == lib.kSpPlaybackNotifyTrackChanged:
        print("kSpPlaybackNotifyTrackChanged")
        lastfm.track_changed()
    elif type == lib.kSpPlaybackNotifyNext:
        print("kSpPlaybackNotifyNext")
    elif type == lib.kSpPlaybackNotifyPrev:
        print("kSpPlaybackNotifyPrev")
    elif type == lib.kSpPlaybackNotifyShuffleEnabled:
        print("kSpPlaybackNotifyShuffleEnabled")
    elif type == lib.kSpPlaybackNotifyShuffleDisabled:
        print("kSpPlaybackNotifyShuffleDisabled")
    elif type == lib.kSpPlaybackNotifyRepeatEnabled:
        print("kSpPlaybackNotifyRepeatEnabled")
    elif type == lib.kSpPlaybackNotifyRepeatDisabled:
        print("kSpPlaybackNotifyRepeatDisabled")
    elif type == lib.kSpPlaybackNotifyBecameActive:
        print("kSpPlaybackNotifyBecameActive")
        session.activate()
    elif type == lib.kSpPlaybackNotifyBecameInactive:
        print("kSpPlaybackNotifyBecameInactive")
        device.release()
        session.deactivate()
    elif type == lib.kSpPlaybackNotifyPlayTokenLost:
        print("kSpPlaybackNotifyPlayTokenLost")
    elif type == lib.kSpPlaybackEventAudioFlush:
        print("kSpPlaybackEventAudioFlush")
        # audio_flush();
    else:
        print("UNKNOWN PlaybackNotify {}".format(type))
Exemplo n.º 2
0
def playback_play():
    lib.SpPlaybackPlay()
    return '', 204
Exemplo n.º 3
0
def playback_play():
    lib.SpPlaybackPlay()