def resume(device_name):
	_auth=authenticate(read_config())
	dev_id=""
	spdevices=list_devices(_auth)
	#print(spdevices)
	for dev in spdevices['devices']:
		if device_name == dev['name']:
			dev_id=dev['id']
	
	#Set device_name as player
	print("Set Player: "+device_name)
	playdev(dev_id,False,_auth)
def play_uri(spotifyuri,device_name):

	print("SporitfyConnect")
	_auth=authenticate(read_config())
	
	#get device id from device name
	dev_id=""
	spdevices=list_devices(_auth)
	#print(spdevices)
	for dev in spdevices['devices']:
		if device_name == dev['name']:
			dev_id=dev['id']
	
	#Set device_name as player
	print("Set Player: "+device_name)
	playdev(dev_id,True,_auth)
	
	#Track or Album
	print("Track: "+spotifyuri)
	tracklist=[]
	if "album" in spotifyuri:
		print('is Album')
		split=spotifyuri.split(':')
		results=get_album_tracks(split[2],_auth)
		tracks=results['items']
		for track in tracks:
			tracklist.append(track['uri'])
	elif "track" in spotifyuri:
		print('is Track')
		tracklist.append(spotifyuri)
	else:
		print('Notsupportedjet!')
	
	#Play
	print("Start playing!")
	play(tracklist,_auth)
示例#3
0
 def __init__(self): 
     self._conf = read_config() 
     self._auth = authenticate(self._conf) 
示例#4
0
 def __init__(self):
     self._config = read_config()
     self._authentication = authenticate(self._config)