Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# Wait for connection to the chromecast
cast.wait()
spotify_device_id = None
# Create a spotify token
data = st.start_session(args.user, args.password)
access_token = data[0]
expires = data[1] - int(time.time())
# Create a spotify client
client = spotipy.Spotify(auth=access_token)
if args.show_debug:
spotipy.trace = True
spotipy.trace_out = True
# Launch the spotify app on the cast we want to cast to
sp = SpotifyController(access_token, expires)
cast.register_handler(sp)
sp.launch_app()
if not sp.is_launched and not sp.credential_error:
print('Failed to launch spotify controller due to timeout')
sys.exit(1)
if not sp.is_launched and sp.credential_error:
print('Failed to launch spotify controller due to credential error')
sys.exit(1)
# Query spotify for active devices
devices_available = client.devices()
# Wait for connection to the chromecast
cast.wait()
spotify_device_id = None
# Create a spotify token
data = st.start_session(args.user, args.password)
access_token = data[0]
expires = data[1] - int(time.time())
# Create a spotify client
client = spotipy.Spotify(auth=access_token)
if args.show_debug:
spotipy.trace = True
spotipy.trace_out = True
# Launch the spotify app on the cast we want to cast to
sp = SpotifyController(access_token, expires)
cast.register_handler(sp)
sp.launch_app()
if not sp.is_launched and not sp.credential_error:
print('Failed to launch spotify controller due to timeout')
sys.exit(1)
if not sp.is_launched and sp.credential_error:
print('Failed to launch spotify controller due to credential error')
sys.exit(1)
# Query spotify for active devices
devices_available = client.devices()