added volume control
This commit is contained in:
parent
0c5729d7c5
commit
707404a248
1
alarm.py
1
alarm.py
@ -26,4 +26,5 @@ if __name__ == '__main__':
|
||||
network.play(os.environ['SPOTALARMURI'], network.getDeviceID(os.environ['SPOTALARMDEVICENAME']))
|
||||
|
||||
network.setShuffle(True)
|
||||
network.setVolume(os.environ['SPOTALARMVOLUME'])
|
||||
network.next()
|
||||
|
4
main.py
4
main.py
@ -9,4 +9,6 @@ if __name__ == '__main__':
|
||||
|
||||
#network.getPlaylist('000Eh2vXzYGgrEFlgcWZj3')
|
||||
|
||||
network.getPlayer()
|
||||
#network.getPlayer()
|
||||
|
||||
network.setVolume(30)
|
@ -149,7 +149,6 @@ class network:
|
||||
print(req.status_code)
|
||||
print(req.text)
|
||||
|
||||
|
||||
def setShuffle(self, state, deviceid=None):
|
||||
|
||||
headers = {'Authorization': 'Bearer ' + self.user.access_token}
|
||||
@ -163,3 +162,17 @@ class network:
|
||||
|
||||
print(req.status_code)
|
||||
print(req.text)
|
||||
|
||||
def setVolume(self, volume, deviceid=None):
|
||||
|
||||
headers = {'Authorization': 'Bearer ' + self.user.access_token}
|
||||
|
||||
params = {'volume_percent': volume}
|
||||
|
||||
if deviceid is not None:
|
||||
params['device_id'] = deviceid
|
||||
|
||||
req = requests.put(const.api_url + 'me/player/volume', params=params, headers=headers)
|
||||
|
||||
print(req.status_code)
|
||||
print(req.text)
|
||||
|
Loading…
Reference in New Issue
Block a user