added auth stuff

Signed-off-by: Ebbe Baß <ebbe@ping-mee.de>
master
Ebbe Baß 2022-07-27 15:47:50 +02:00
parent 4d2e67a29a
commit b2825bed3d
1 changed files with 13 additions and 0 deletions

13
main.py
View File

@ -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()