diff --git a/main.py b/main.py index c090db3..b9fbd34 100644 --- a/main.py +++ b/main.py @@ -167,6 +167,19 @@ if __name__ == '__main__': else: load_dotenv() + sp_scopes = 'user-read-currently-playing user-read-playback-state streaming user-read-email user-read-private user-read-currently-playing user-read-playback-position user-read-playback-state' + global sp + sp = spotipy.Spotify(auth_manager=SpotifyOAuth(scope=sp_scopes)) + one_device_is_active = False + for x in sp.devices()['devices']: + if x['is_active'] == True: + try: + sp.start_playback(x['id']) + except: + pass + one_device_is_active = True + break + strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS, LED_CHANNEL) strip.begin()