alarm play this month's playlist, removed compulsory track retrieval from playlist loading
This commit is contained in:
parent
707404a248
commit
06535cdb84
11
alarm.py
11
alarm.py
@ -1,7 +1,7 @@
|
||||
import spotframework.net.user as userclass
|
||||
import spotframework.net.network as networkclass
|
||||
|
||||
import os
|
||||
import os, datetime
|
||||
|
||||
def checkPhone():
|
||||
|
||||
@ -23,7 +23,14 @@ if __name__ == '__main__':
|
||||
break
|
||||
|
||||
if found:
|
||||
network.play(os.environ['SPOTALARMURI'], network.getDeviceID(os.environ['SPOTALARMDEVICENAME']))
|
||||
|
||||
date = datetime.datetime.now()
|
||||
|
||||
playlists = network.getUserPlaylists()
|
||||
|
||||
playlisturi = next((i.uri for i in playlists if i.name == date.strftime("%B %-y").lower()), os.environ['SPOTALARMURI'])
|
||||
|
||||
network.play(playlisturi, network.getDeviceID(os.environ['SPOTALARMDEVICENAME']))
|
||||
|
||||
network.setShuffle(True)
|
||||
network.setVolume(os.environ['SPOTALARMVOLUME'])
|
||||
|
@ -8,6 +8,9 @@ if __name__ == '__main__':
|
||||
|
||||
network = networkclass.network(userclass.User())
|
||||
playlists = network.getUserPlaylists()
|
||||
|
||||
for playlist in playlists:
|
||||
playlist.tracks = network.getPlaylistTracks(playlist.playlistid)
|
||||
|
||||
path = sys.argv[1]
|
||||
|
||||
|
4
main.py
4
main.py
@ -11,4 +11,6 @@ if __name__ == '__main__':
|
||||
|
||||
#network.getPlayer()
|
||||
|
||||
network.setVolume(30)
|
||||
playlists = network.getUserPlaylists()
|
||||
for playlist in playlists:
|
||||
print(playlist.name + ' ' + playlist.playlistid)
|
@ -2,8 +2,9 @@
|
||||
|
||||
class playlist:
|
||||
|
||||
def __init__(self, playlistid, name=None, userid=None):
|
||||
def __init__(self, playlistid, uri, name=None, userid=None):
|
||||
self.tracks = []
|
||||
self.name = name
|
||||
self.playlistid = playlistid
|
||||
self.userid = userid
|
||||
self.uri = uri
|
||||
|
@ -43,7 +43,7 @@ class network:
|
||||
|
||||
for responseplaylist in resp['items']:
|
||||
|
||||
playlist = self.getPlaylist(responseplaylist['id'], tracksonly=True)
|
||||
playlist = playlistclass(responseplaylist['id'], responseplaylist['uri'])
|
||||
playlist.name = responseplaylist['name']
|
||||
playlist.userid = responseplaylist['owner']['id']
|
||||
|
||||
@ -69,6 +69,8 @@ class network:
|
||||
|
||||
headers = {'Authorization': 'Bearer ' + self.user.access_token}
|
||||
|
||||
print('getting playlist tracks {} {]'.format(playlistid, offset))
|
||||
|
||||
tracks = []
|
||||
|
||||
params = {'offset': offset, 'limit': limit}
|
||||
|
Loading…
Reference in New Issue
Block a user