added shuffle and next to alarm, next and shuffle to network
This commit is contained in:
parent
08a07800dc
commit
deb35fe160
3
alarm.py
3
alarm.py
@ -7,3 +7,6 @@ if __name__ == '__main__':
|
||||
network = networkclass.network(userclass.User())
|
||||
|
||||
network.play(os.environ['SPOTALARMURI'], network.getDeviceID(os.environ['SPOTALARMDEVICENAME']))
|
||||
|
||||
network.setShuffle(True)
|
||||
network.next()
|
||||
|
@ -134,3 +134,32 @@ class network:
|
||||
|
||||
print(req.status_code)
|
||||
print(req.text)
|
||||
|
||||
def next(self, deviceid=None):
|
||||
|
||||
headers = {'Authorization': 'Bearer ' + self.user.access_token}
|
||||
|
||||
if deviceid is not None:
|
||||
params = {'device_id': deviceid}
|
||||
else:
|
||||
params = None
|
||||
|
||||
req = requests.post(const.api_url + 'me/player/next', params=params, headers=headers)
|
||||
|
||||
print(req.status_code)
|
||||
print(req.text)
|
||||
|
||||
|
||||
def setShuffle(self, state, deviceid=None):
|
||||
|
||||
headers = {'Authorization': 'Bearer ' + self.user.access_token}
|
||||
|
||||
params = {'state': str(state).lower()}
|
||||
|
||||
if deviceid is not None:
|
||||
params['device_id'] = deviceid
|
||||
|
||||
req = requests.put(const.api_url + 'me/player/shuffle', params=params, headers=headers)
|
||||
|
||||
print(req.status_code)
|
||||
print(req.text)
|
||||
|
Loading…
Reference in New Issue
Block a user