spotifywebapiPython 1.0.242__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- spotifywebapipython/__init__.py +35 -0
- spotifywebapipython/const.py +114 -0
- spotifywebapipython/docs/__init__.html +2156 -0
- spotifywebapipython/docs/codecopy.js +70 -0
- spotifywebapipython/docs/index.html +514 -0
- spotifywebapipython/docs/search.js +46 -0
- spotifywebapipython/docs/spotifywebapipython/const.html +636 -0
- spotifywebapipython/docs/spotifywebapipython/saappmessages.html +540 -0
- spotifywebapipython/docs/spotifywebapipython/sautils.html +620 -0
- spotifywebapipython/docs/spotifywebapipython/spotifyapierror.html +341 -0
- spotifywebapipython/docs/spotifywebapipython/spotifyapimessage.html +598 -0
- spotifywebapipython/docs/spotifywebapipython/spotifyauthtoken.html +612 -0
- spotifywebapipython/docs/spotifywebapipython/spotifyclient.html +16557 -0
- spotifywebapipython/docs/spotifywebapipython/spotifydiscovery.html +518 -0
- spotifywebapipython/docs/spotifywebapipython/spotifywebapiauthenticationerror.html +421 -0
- spotifywebapipython/docs/spotifywebapipython/spotifywebapierror.html +400 -0
- spotifywebapipython/docs/spotifywebapipython/spotifywebplayertoken.html +635 -0
- spotifywebapipython/docs/spotifywebapipython.ico +0 -0
- spotifywebapipython/docs/spotifywebapipython_OLD.ico +0 -0
- spotifywebapipython/models/__init__.py +121 -0
- spotifywebapipython/models/album.py +170 -0
- spotifywebapipython/models/albumpagesaved.py +85 -0
- spotifywebapipython/models/albumpagesimplified.py +88 -0
- spotifywebapipython/models/albumsaved.py +102 -0
- spotifywebapipython/models/albumsimplified.py +308 -0
- spotifywebapipython/models/artist.py +146 -0
- spotifywebapipython/models/artistinfo.py +282 -0
- spotifywebapipython/models/artistinfotourevent.py +127 -0
- spotifywebapipython/models/artistpage.py +70 -0
- spotifywebapipython/models/artistsimplified.py +163 -0
- spotifywebapipython/models/audiobook.py +87 -0
- spotifywebapipython/models/audiobookpagesimplified.py +88 -0
- spotifywebapipython/models/audiobooksimplified.py +362 -0
- spotifywebapipython/models/audiofeatures.py +333 -0
- spotifywebapipython/models/author.py +67 -0
- spotifywebapipython/models/category.py +168 -0
- spotifywebapipython/models/categorypage.py +70 -0
- spotifywebapipython/models/chapter.py +84 -0
- spotifywebapipython/models/chapterpagesimplified.py +88 -0
- spotifywebapipython/models/chaptersimplified.py +387 -0
- spotifywebapipython/models/context.py +113 -0
- spotifywebapipython/models/copyright.py +79 -0
- spotifywebapipython/models/device.py +301 -0
- spotifywebapipython/models/episode.py +84 -0
- spotifywebapipython/models/episodepagesaved.py +85 -0
- spotifywebapipython/models/episodepagesimplified.py +88 -0
- spotifywebapipython/models/episodesaved.py +99 -0
- spotifywebapipython/models/episodesimplified.py +370 -0
- spotifywebapipython/models/explicitcontent.py +80 -0
- spotifywebapipython/models/externalids.py +91 -0
- spotifywebapipython/models/externalurls.py +104 -0
- spotifywebapipython/models/followers.py +81 -0
- spotifywebapipython/models/imageobject.py +193 -0
- spotifywebapipython/models/imagevibrantcolors.py +182 -0
- spotifywebapipython/models/linkedfrom.py +165 -0
- spotifywebapipython/models/narrator.py +67 -0
- spotifywebapipython/models/owner.py +162 -0
- spotifywebapipython/models/pageobject.py +343 -0
- spotifywebapipython/models/playeractions.py +196 -0
- spotifywebapipython/models/playerlastplayedinfo.py +334 -0
- spotifywebapipython/models/playerplaystate.py +467 -0
- spotifywebapipython/models/playerqueueinfo.py +207 -0
- spotifywebapipython/models/playhistory.py +136 -0
- spotifywebapipython/models/playhistorypage.py +85 -0
- spotifywebapipython/models/playlist.py +125 -0
- spotifywebapipython/models/playlistpage.py +85 -0
- spotifywebapipython/models/playlistpagesimplified.py +107 -0
- spotifywebapipython/models/playlistsimplified.py +334 -0
- spotifywebapipython/models/playlisttrack.py +143 -0
- spotifywebapipython/models/playlisttracksummary.py +80 -0
- spotifywebapipython/models/recommendationseed.py +135 -0
- spotifywebapipython/models/restrictions.py +86 -0
- spotifywebapipython/models/resumepoint.py +79 -0
- spotifywebapipython/models/searchresponse.py +391 -0
- spotifywebapipython/models/searchresultbase.py +299 -0
- spotifywebapipython/models/show.py +87 -0
- spotifywebapipython/models/showpagesaved.py +85 -0
- spotifywebapipython/models/showpagesimplified.py +88 -0
- spotifywebapipython/models/showsaved.py +99 -0
- spotifywebapipython/models/showsimplified.py +320 -0
- spotifywebapipython/models/spotifyconnectdevice.py +321 -0
- spotifywebapipython/models/spotifyconnectdevices.py +441 -0
- spotifywebapipython/models/track.py +142 -0
- spotifywebapipython/models/trackpage.py +110 -0
- spotifywebapipython/models/trackpagesaved.py +85 -0
- spotifywebapipython/models/trackpagesimplified.py +88 -0
- spotifywebapipython/models/trackrecommendations.py +88 -0
- spotifywebapipython/models/tracksaved.py +99 -0
- spotifywebapipython/models/tracksimplified.py +398 -0
- spotifywebapipython/models/userprofile.py +184 -0
- spotifywebapipython/models/userprofilesimplified.py +206 -0
- spotifywebapipython/models/zeroconfdiscoveryresult.py +592 -0
- spotifywebapipython/models/zeroconfproperty.py +93 -0
- spotifywebapipython/oauthcli/__init__.py +7 -0
- spotifywebapipython/oauthcli/authclient.py +1229 -0
- spotifywebapipython/saappmessages.py +86 -0
- spotifywebapipython/sautils.py +285 -0
- spotifywebapipython/spotifyapierror.py +66 -0
- spotifywebapipython/spotifyapimessage.py +269 -0
- spotifywebapipython/spotifyauthtoken.py +264 -0
- spotifywebapipython/spotifyclient.py +17885 -0
- spotifywebapipython/spotifyconnect/__init__.py +19 -0
- spotifywebapipython/spotifyconnect/spotifyconnectdeviceeventargs.py +67 -0
- spotifywebapipython/spotifyconnect/spotifyconnectdirectorytask.py +2564 -0
- spotifywebapipython/spotifyconnect/spotifyconnectzeroconfcastapptask.py +467 -0
- spotifywebapipython/spotifyconnect/spotifyconnectzeroconfcastcontroller.py +701 -0
- spotifywebapipython/spotifyconnect/spotifyconnectzeroconfcastlistener.py +359 -0
- spotifywebapipython/spotifyconnect/spotifyconnectzeroconfcastmultizonelistener.py +212 -0
- spotifywebapipython/spotifyconnect/spotifyconnectzeroconfexceptions.py +20 -0
- spotifywebapipython/spotifyconnect/spotifyconnectzeroconflistener.py +335 -0
- spotifywebapipython/spotifydiscovery.py +473 -0
- spotifywebapipython/spotifymediatypes.py +53 -0
- spotifywebapipython/spotifywebapiauthenticationerror.py +122 -0
- spotifywebapipython/spotifywebapierror.py +106 -0
- spotifywebapipython/spotifywebplayertoken.py +743 -0
- spotifywebapipython/vibrant/__init__.py +17 -0
- spotifywebapipython/vibrant/generator.py +261 -0
- spotifywebapipython/vibrant/image.py +100 -0
- spotifywebapipython/vibrant/main.py +34 -0
- spotifywebapipython/vibrant/models.py +93 -0
- spotifywebapipython/vibrant/utils.py +56 -0
- spotifywebapipython/zeroconfapi/__init__.py +23 -0
- spotifywebapipython/zeroconfapi/authenticationtypes.py +38 -0
- spotifywebapipython/zeroconfapi/blobbuilder.py +370 -0
- spotifywebapipython/zeroconfapi/credentials.py +37 -0
- spotifywebapipython/zeroconfapi/cryptodiffiehellman.py +89 -0
- spotifywebapipython/zeroconfapi/helpers.py +64 -0
- spotifywebapipython/zeroconfapi/spotifyzeroconfapierror.py +108 -0
- spotifywebapipython/zeroconfapi/zeroconfconnect.py +1327 -0
- spotifywebapipython/zeroconfapi/zeroconfgetinfo.py +572 -0
- spotifywebapipython/zeroconfapi/zeroconfgetinfoalias.py +109 -0
- spotifywebapipython/zeroconfapi/zeroconfgetinfodrmmediaformat.py +90 -0
- spotifywebapipython/zeroconfapi/zeroconfresponse.py +195 -0
- spotifywebapipython-1.0.242.dist-info/LICENSE +22 -0
- spotifywebapipython-1.0.242.dist-info/METADATA +219 -0
- spotifywebapipython-1.0.242.dist-info/RECORD +138 -0
- spotifywebapipython-1.0.242.dist-info/WHEEL +5 -0
- spotifywebapipython-1.0.242.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
# our package imports.
|
|
2
|
+
from ..sautils import export
|
|
3
|
+
|
|
4
|
+
@export
|
|
5
|
+
class PageObject:
|
|
6
|
+
"""
|
|
7
|
+
Spotify Web API PageObject object.
|
|
8
|
+
|
|
9
|
+
This allows for multiple pages of objects to be navigated.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
def __init__(self, root:dict=None) -> None:
|
|
13
|
+
"""
|
|
14
|
+
Initializes a new instance of the class.
|
|
15
|
+
|
|
16
|
+
Args:
|
|
17
|
+
root (dict):
|
|
18
|
+
Spotify Web API JSON response in dictionary format, used to load object
|
|
19
|
+
attributes; otherwise, None to not load attributes.
|
|
20
|
+
"""
|
|
21
|
+
self._CursorAfter:object = None
|
|
22
|
+
self._CursorBefore:object = None
|
|
23
|
+
self._DateLastRefreshed:float = 0
|
|
24
|
+
self._Href:str = None
|
|
25
|
+
self._IsCursor:bool = False
|
|
26
|
+
self._Items:list[object] = []
|
|
27
|
+
self._Limit:int = 0
|
|
28
|
+
self._Next:str = None
|
|
29
|
+
self._Offset:int = 0
|
|
30
|
+
self._Previous:str = None
|
|
31
|
+
self._Total:int = 0
|
|
32
|
+
|
|
33
|
+
if (root is None):
|
|
34
|
+
|
|
35
|
+
pass
|
|
36
|
+
|
|
37
|
+
else:
|
|
38
|
+
|
|
39
|
+
self._Href = root.get('href', None)
|
|
40
|
+
self._Limit = root.get('limit', 0)
|
|
41
|
+
self._Next = root.get('next', None)
|
|
42
|
+
self._Offset = root.get('offset', 0)
|
|
43
|
+
self._Previous = root.get('previous', None)
|
|
44
|
+
self._Total = root.get('total', 0)
|
|
45
|
+
|
|
46
|
+
# process all collections and objects.
|
|
47
|
+
item:dict = root.get('cursors',None)
|
|
48
|
+
if item is not None:
|
|
49
|
+
self._IsCursor = True
|
|
50
|
+
self._CursorAfter = item.get('after', None)
|
|
51
|
+
self._CursorBefore = item.get('before', None)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def __repr__(self) -> str:
|
|
55
|
+
return self.ToString()
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def __str__(self) -> str:
|
|
59
|
+
return self.ToString()
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
@property
|
|
63
|
+
def CursorAfter(self) -> object:
|
|
64
|
+
"""
|
|
65
|
+
The cursor to use as key to find the next page of items.
|
|
66
|
+
This value will only be populated when cursor-based paging is used, which is infrrequent.
|
|
67
|
+
The value can be of multiple types: string, integer, etc.
|
|
68
|
+
|
|
69
|
+
Example: `3jdODvx7rIdq0UGU7BOVR3`
|
|
70
|
+
Example: 1708495520273
|
|
71
|
+
|
|
72
|
+
"""
|
|
73
|
+
return self._CursorAfter
|
|
74
|
+
|
|
75
|
+
@CursorAfter.setter
|
|
76
|
+
def CursorAfter(self, value:object):
|
|
77
|
+
"""
|
|
78
|
+
Sets the CursorAfter property value.
|
|
79
|
+
"""
|
|
80
|
+
self._IsCursor = True
|
|
81
|
+
self._CursorAfter = value
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
@property
|
|
85
|
+
def CursorBefore(self) -> object:
|
|
86
|
+
"""
|
|
87
|
+
The cursor to use as key to find the previous page of items.
|
|
88
|
+
This value will only be populated when cursor-based paging is used, which is infrrequent.
|
|
89
|
+
The value can be of multiple types: string, integer, etc.
|
|
90
|
+
|
|
91
|
+
Example: `3jdODvx7rIdq0UGU7BOVR3`
|
|
92
|
+
Example: 1708495520273
|
|
93
|
+
"""
|
|
94
|
+
return self._CursorBefore
|
|
95
|
+
|
|
96
|
+
@CursorBefore.setter
|
|
97
|
+
def CursorBefore(self, value:object):
|
|
98
|
+
"""
|
|
99
|
+
Sets the CursorBefore property value.
|
|
100
|
+
"""
|
|
101
|
+
self._IsCursor = True
|
|
102
|
+
self._CursorBefore = value
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
@property
|
|
106
|
+
def DateLastRefreshed(self) -> float:
|
|
107
|
+
"""
|
|
108
|
+
Date and time items were was last refreshed, in unix epoch format (e.g. 1669123919.331225).
|
|
109
|
+
A value of zero indicates the date was unknown.
|
|
110
|
+
|
|
111
|
+
Note that this attribute does not exist in the Spotify Web API;
|
|
112
|
+
it was added here for convenience.
|
|
113
|
+
"""
|
|
114
|
+
return self._DateLastRefreshed
|
|
115
|
+
|
|
116
|
+
@DateLastRefreshed.setter
|
|
117
|
+
def DateLastRefreshed(self, value:float):
|
|
118
|
+
"""
|
|
119
|
+
Sets the DateLastRefreshed property value.
|
|
120
|
+
"""
|
|
121
|
+
if (value is None):
|
|
122
|
+
self._DateLastRefreshed = 0
|
|
123
|
+
elif isinstance(value, float):
|
|
124
|
+
self._DateLastRefreshed = value
|
|
125
|
+
elif isinstance(value, int):
|
|
126
|
+
self._DateLastRefreshed = float(value)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
@property
|
|
130
|
+
def Href(self) -> str:
|
|
131
|
+
"""
|
|
132
|
+
A link to the Web API endpoint returning the full result of the request.
|
|
133
|
+
|
|
134
|
+
Example: `https://api.spotify.com/v1/me/shows?offset=0&limit=20`
|
|
135
|
+
"""
|
|
136
|
+
return self._Href
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
@property
|
|
140
|
+
def IsCursor(self) -> bool:
|
|
141
|
+
"""
|
|
142
|
+
True if cursors were returned at some point during the life of this paging object.
|
|
143
|
+
"""
|
|
144
|
+
return self._IsCursor
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
@property
|
|
148
|
+
def Items(self) -> list[object]:
|
|
149
|
+
"""
|
|
150
|
+
Array of objects.
|
|
151
|
+
|
|
152
|
+
This property will be overrriden by inheriting classes.
|
|
153
|
+
"""
|
|
154
|
+
return self._Items
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
@property
|
|
158
|
+
def ItemsCount(self) -> int:
|
|
159
|
+
"""
|
|
160
|
+
Number of objects in the `Items` property array.
|
|
161
|
+
"""
|
|
162
|
+
if self._Items is not None:
|
|
163
|
+
return len(self._Items)
|
|
164
|
+
return 0
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
@property
|
|
168
|
+
def Limit(self) -> int:
|
|
169
|
+
"""
|
|
170
|
+
The maximum number of items in the response (as set in the query or by default).
|
|
171
|
+
|
|
172
|
+
This property can be modified in case the paging request needs to be adjusted
|
|
173
|
+
based upon overall request limits.
|
|
174
|
+
"""
|
|
175
|
+
return self._Limit
|
|
176
|
+
|
|
177
|
+
@Limit.setter
|
|
178
|
+
def Limit(self, value:int):
|
|
179
|
+
"""
|
|
180
|
+
Sets the Limit property value.
|
|
181
|
+
"""
|
|
182
|
+
if value is not None:
|
|
183
|
+
if isinstance(value, int):
|
|
184
|
+
self._Limit = value
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
@property
|
|
188
|
+
def Next(self) -> str:
|
|
189
|
+
"""
|
|
190
|
+
URL to the next page of items; null if none.
|
|
191
|
+
|
|
192
|
+
Example: `https://api.spotify.com/v1/me/shows?offset=1&limit=1`
|
|
193
|
+
"""
|
|
194
|
+
return self._Next
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
@property
|
|
198
|
+
def Offset(self) -> int:
|
|
199
|
+
"""
|
|
200
|
+
The offset of the items returned (as set in the query or by default).
|
|
201
|
+
|
|
202
|
+
This property can be modified in case the paging request needs to be adjusted
|
|
203
|
+
based upon overall request limits.
|
|
204
|
+
"""
|
|
205
|
+
return self._Offset
|
|
206
|
+
|
|
207
|
+
@Offset.setter
|
|
208
|
+
def Offset(self, value:int):
|
|
209
|
+
"""
|
|
210
|
+
Sets the Offset property value.
|
|
211
|
+
"""
|
|
212
|
+
if value is not None:
|
|
213
|
+
if isinstance(value, int):
|
|
214
|
+
self._Offset = value
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
@property
|
|
218
|
+
def PagingInfo(self) -> str:
|
|
219
|
+
"""
|
|
220
|
+
Returns a displayable string of paging parameters.
|
|
221
|
+
|
|
222
|
+
The return value will vary, based upon if a cursor is used to navigate the results.
|
|
223
|
+
Most methods don't use cursors, but there are a few that do (e.g. `GetArtistsFollowed`).
|
|
224
|
+
|
|
225
|
+
For a "(items {start} to {end} of {total} total)" message, the `start` value is the
|
|
226
|
+
offset value of the last page of items retrieved.
|
|
227
|
+
"""
|
|
228
|
+
endValue:int = (self._Limit + self._Offset)
|
|
229
|
+
if endValue > self._Total:
|
|
230
|
+
endValue = self._Total
|
|
231
|
+
|
|
232
|
+
# is page using cursor results?
|
|
233
|
+
if self._IsCursor:
|
|
234
|
+
|
|
235
|
+
msgAfter:str = ''
|
|
236
|
+
msgBefore:str = ''
|
|
237
|
+
msgComma = ''
|
|
238
|
+
|
|
239
|
+
if self._CursorAfter is not None:
|
|
240
|
+
msgAfter = 'after cursor "%s"' % str(self._CursorAfter)
|
|
241
|
+
if self._CursorBefore is not None:
|
|
242
|
+
msgBefore = 'before cursor "%s"' % str(self._CursorBefore)
|
|
243
|
+
if len(msgAfter) > 0:
|
|
244
|
+
msgComma = ', '
|
|
245
|
+
if self._CursorAfter is None and self._CursorBefore is None:
|
|
246
|
+
msgComma = 'last page'
|
|
247
|
+
|
|
248
|
+
msg:str = '(%s%s%s)' % (msgBefore, msgComma, msgAfter)
|
|
249
|
+
|
|
250
|
+
# is this the last page of cursor results?
|
|
251
|
+
elif self._Total == 0 and endValue == 0:
|
|
252
|
+
|
|
253
|
+
msg:str = '(last page)'
|
|
254
|
+
|
|
255
|
+
else:
|
|
256
|
+
|
|
257
|
+
msg:str = '(items {start} to {end} of {total} total)'.format(start=str(self._Offset + 1),
|
|
258
|
+
end=str(endValue),
|
|
259
|
+
total=str(self._Total))
|
|
260
|
+
|
|
261
|
+
return msg
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
@property
|
|
265
|
+
def Previous(self) -> str:
|
|
266
|
+
"""
|
|
267
|
+
URL to the previous page of items; null if none.
|
|
268
|
+
|
|
269
|
+
Example: `https://api.spotify.com/v1/me/shows?offset=1&limit=1`
|
|
270
|
+
"""
|
|
271
|
+
return self._Previous
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
@property
|
|
275
|
+
def Total(self) -> int:
|
|
276
|
+
"""
|
|
277
|
+
The total number of items available from the Spotify Web API to return.
|
|
278
|
+
|
|
279
|
+
Note that sometimes the Spotify Web API returns a larger total than the actual number
|
|
280
|
+
of items available. Not sure why this is, but it may not match the `ItemsCount` value.
|
|
281
|
+
"""
|
|
282
|
+
return self._Total
|
|
283
|
+
|
|
284
|
+
@Total.setter
|
|
285
|
+
def Total(self, value:int):
|
|
286
|
+
"""
|
|
287
|
+
Sets the Total property value.
|
|
288
|
+
"""
|
|
289
|
+
if value is not None:
|
|
290
|
+
if isinstance(value, int):
|
|
291
|
+
self._Total = value
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
def ToDictionary(self) -> dict:
|
|
295
|
+
"""
|
|
296
|
+
Returns a dictionary representation of the class.
|
|
297
|
+
"""
|
|
298
|
+
result:dict = \
|
|
299
|
+
{
|
|
300
|
+
'date_last_refreshed': self._DateLastRefreshed,
|
|
301
|
+
'href': self._Href,
|
|
302
|
+
'limit': self._Limit,
|
|
303
|
+
'next': self._Next,
|
|
304
|
+
'offset': self._Offset,
|
|
305
|
+
'previous': self._Previous,
|
|
306
|
+
'total': self._Total,
|
|
307
|
+
'items': [ item.ToDictionary() for item in self._Items ],
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
# only add cursors if they are populated.
|
|
311
|
+
if self._CursorAfter is not None:
|
|
312
|
+
result['cursor_after'] = self._CursorAfter
|
|
313
|
+
if self._CursorBefore is not None:
|
|
314
|
+
result['cursor_before'] = self._CursorBefore
|
|
315
|
+
|
|
316
|
+
return result
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
def ToString(self, includeItems:bool=False) -> str:
|
|
320
|
+
"""
|
|
321
|
+
Returns a displayable string representation of the class.
|
|
322
|
+
|
|
323
|
+
Args:
|
|
324
|
+
includeItems (bool):
|
|
325
|
+
True to include the Items collection of objects; otherwise, False
|
|
326
|
+
to only return base properties.
|
|
327
|
+
"""
|
|
328
|
+
msg:str = '%s' % self.PagingInfo
|
|
329
|
+
msg = '%s\n Href="%s"' % (msg, str(self._Href))
|
|
330
|
+
msg = '%s\n Limit="%s"' % (msg, str(self._Limit))
|
|
331
|
+
msg = '%s\n Next="%s"' % (msg, str(self._Next))
|
|
332
|
+
msg = '%s\n Offset="%s"' % (msg, str(self._Offset))
|
|
333
|
+
msg = '%s\n Previous="%s"' % (msg, str(self._Previous))
|
|
334
|
+
msg = '%s\n Total="%s"' % (msg, str(self._Total))
|
|
335
|
+
msg = '%s\n Items Count="%s"' % (msg, str(self.ItemsCount))
|
|
336
|
+
msg = '%s\n DateLastRefreshed=%s' % (msg, str(self._DateLastRefreshed))
|
|
337
|
+
if self._CursorAfter is not None: msg = '%s\n Cursor After="%s"' % (msg, str(self._CursorAfter))
|
|
338
|
+
if self._CursorBefore is not None: msg = '%s\n Cursor Before="%s"' % (msg, str(self._CursorBefore))
|
|
339
|
+
|
|
340
|
+
if (includeItems):
|
|
341
|
+
if self.Items is not None: msg = '%s\n\n %s' % (msg, str(self.Items))
|
|
342
|
+
|
|
343
|
+
return msg
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
# external package imports.
|
|
2
|
+
|
|
3
|
+
# our package imports.
|
|
4
|
+
from ..sautils import export
|
|
5
|
+
|
|
6
|
+
@export
|
|
7
|
+
class PlayerActions:
|
|
8
|
+
"""
|
|
9
|
+
Spotify Web API PlayerActions object.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
def __init__(self, root:dict=None) -> None:
|
|
13
|
+
"""
|
|
14
|
+
Initializes a new instance of the class.
|
|
15
|
+
|
|
16
|
+
Args:
|
|
17
|
+
root (dict):
|
|
18
|
+
Spotify Web API JSON response in dictionary format, used to load object
|
|
19
|
+
attributes; otherwise, None to not load attributes.
|
|
20
|
+
"""
|
|
21
|
+
# initialize storage.
|
|
22
|
+
self._InterruptingPlayback:bool = None
|
|
23
|
+
self._Pausing:bool = None
|
|
24
|
+
self._Resuming:bool = None
|
|
25
|
+
self._Seeking:bool = None
|
|
26
|
+
self._SkippingNext:bool = None
|
|
27
|
+
self._SkippingPrev:bool = None
|
|
28
|
+
self._TogglingRepeatContext:bool = None
|
|
29
|
+
self._TogglingRepeatTrack:bool = None
|
|
30
|
+
self._TogglingShuffle:bool = None
|
|
31
|
+
self._TransferringPlayback:bool = None
|
|
32
|
+
|
|
33
|
+
if (root is None):
|
|
34
|
+
|
|
35
|
+
pass
|
|
36
|
+
|
|
37
|
+
else:
|
|
38
|
+
|
|
39
|
+
self._InterruptingPlayback = root.get('interrupting_playback', None)
|
|
40
|
+
self._Pausing = root.get('pausing', None)
|
|
41
|
+
self._Resuming = root.get('resuming', None)
|
|
42
|
+
self._Seeking = root.get('seeking', None)
|
|
43
|
+
self._SkippingNext = root.get('skipping_next', None)
|
|
44
|
+
self._SkippingPrev = root.get('skipping_prev', None)
|
|
45
|
+
self._TogglingRepeatContext = root.get('toggling_repeat_context', None)
|
|
46
|
+
self._TogglingRepeatTrack = root.get('toggling_repeat_track', None)
|
|
47
|
+
self._TogglingShuffle = root.get('toggling_shuffle', None)
|
|
48
|
+
self._TransferringPlayback = root.get('transferring_playback', None)
|
|
49
|
+
|
|
50
|
+
# post load validations.
|
|
51
|
+
if self._InterruptingPlayback is None:
|
|
52
|
+
self._InterruptingPlayback = False
|
|
53
|
+
if self._Pausing is None:
|
|
54
|
+
self._Pausing = False
|
|
55
|
+
if self._Resuming is None:
|
|
56
|
+
self._Resuming = False
|
|
57
|
+
if self._Seeking is None:
|
|
58
|
+
self._Seeking = False
|
|
59
|
+
if self._SkippingNext is None:
|
|
60
|
+
self._SkippingNext = False
|
|
61
|
+
if self._SkippingPrev is None:
|
|
62
|
+
self._SkippingPrev = False
|
|
63
|
+
if self._TogglingRepeatContext is None:
|
|
64
|
+
self._TogglingRepeatContext = False
|
|
65
|
+
if self._TogglingRepeatTrack is None:
|
|
66
|
+
self._TogglingRepeatTrack = False
|
|
67
|
+
if self._TogglingShuffle is None:
|
|
68
|
+
self._TogglingShuffle = False
|
|
69
|
+
if self._TransferringPlayback is None:
|
|
70
|
+
self._TransferringPlayback = False
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def __repr__(self) -> str:
|
|
74
|
+
return self.ToString()
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def __str__(self) -> str:
|
|
78
|
+
return self.ToString()
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
@property
|
|
82
|
+
def InterruptingPlayback(self) -> bool:
|
|
83
|
+
"""
|
|
84
|
+
Interrupting playback. Optional field.
|
|
85
|
+
"""
|
|
86
|
+
return self._InterruptingPlayback
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
@property
|
|
90
|
+
def Pausing(self) -> bool:
|
|
91
|
+
"""
|
|
92
|
+
Pausing. Optional field.
|
|
93
|
+
"""
|
|
94
|
+
return self._Pausing
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
@property
|
|
98
|
+
def Resuming(self) -> bool:
|
|
99
|
+
"""
|
|
100
|
+
Resuming. Optional field.
|
|
101
|
+
"""
|
|
102
|
+
return self._Resuming
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
@property
|
|
106
|
+
def Seeking(self) -> bool:
|
|
107
|
+
"""
|
|
108
|
+
Seeking playback location. Optional field.
|
|
109
|
+
"""
|
|
110
|
+
return self._Seeking
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
@property
|
|
114
|
+
def SkippingNext(self) -> bool:
|
|
115
|
+
"""
|
|
116
|
+
Skipping to the next context. Optional field.
|
|
117
|
+
"""
|
|
118
|
+
return self._SkippingNext
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
@property
|
|
122
|
+
def SkippingPrev(self) -> bool:
|
|
123
|
+
"""
|
|
124
|
+
Skipping to the previous context. Optional field.
|
|
125
|
+
"""
|
|
126
|
+
return self._SkippingPrev
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
@property
|
|
130
|
+
def TogglingRepeatContext(self) -> bool:
|
|
131
|
+
"""
|
|
132
|
+
Toggling repeat context flag. Optional field.
|
|
133
|
+
"""
|
|
134
|
+
return self._TogglingRepeatContext
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
@property
|
|
138
|
+
def TogglingShuffle(self) -> bool:
|
|
139
|
+
"""
|
|
140
|
+
Toggling shuffle flag. Optional field.
|
|
141
|
+
"""
|
|
142
|
+
return self._TogglingShuffle
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
@property
|
|
146
|
+
def TogglingRepeatTrack(self) -> bool:
|
|
147
|
+
"""
|
|
148
|
+
Toggling repeat track flag. Optional field.
|
|
149
|
+
"""
|
|
150
|
+
return self._TogglingRepeatTrack
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
@property
|
|
154
|
+
def TransferringPlayback(self) -> bool:
|
|
155
|
+
"""
|
|
156
|
+
Transfering playback between devices. Optional field.
|
|
157
|
+
"""
|
|
158
|
+
return self._TransferringPlayback
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
def ToDictionary(self) -> dict:
|
|
162
|
+
"""
|
|
163
|
+
Returns a dictionary representation of the class.
|
|
164
|
+
"""
|
|
165
|
+
result:dict = \
|
|
166
|
+
{
|
|
167
|
+
'interrupting_playback': self._InterruptingPlayback,
|
|
168
|
+
'pausing': self._Pausing,
|
|
169
|
+
'resuming': self._Resuming,
|
|
170
|
+
'seeking': self._Seeking,
|
|
171
|
+
'skipping_next': self._SkippingNext,
|
|
172
|
+
'skipping_prev': self._SkippingPrev,
|
|
173
|
+
'toggling_repeat_context': self._TogglingRepeatContext,
|
|
174
|
+
'toggling_repeat_track': self._TogglingRepeatTrack,
|
|
175
|
+
'toggling_shuffle': self._TogglingShuffle,
|
|
176
|
+
'transferring_playback': self._TransferringPlayback,
|
|
177
|
+
}
|
|
178
|
+
return result
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
def ToString(self) -> str:
|
|
182
|
+
"""
|
|
183
|
+
Returns a displayable string representation of the class.
|
|
184
|
+
"""
|
|
185
|
+
msg:str = 'PlayerActions:'
|
|
186
|
+
if self._InterruptingPlayback is not None: msg = '%s\n InterruptingPlayback="%s"' % (msg, str(self._InterruptingPlayback))
|
|
187
|
+
if self._Pausing is not None: msg = '%s\n Pausing="%s"' % (msg, str(self._Pausing))
|
|
188
|
+
if self._Resuming is not None: msg = '%s\n Resuming="%s"' % (msg, str(self._Resuming))
|
|
189
|
+
if self._Seeking is not None: msg = '%s\n Seeking="%s"' % (msg, str(self._Seeking))
|
|
190
|
+
if self._SkippingNext is not None: msg = '%s\n SkippingNext="%s"' % (msg, str(self._SkippingNext))
|
|
191
|
+
if self._SkippingPrev is not None: msg = '%s\n SkippingPrev="%s"' % (msg, str(self._SkippingPrev))
|
|
192
|
+
if self._TogglingRepeatContext is not None: msg = '%s\n TogglingRepeatContext="%s"' % (msg, str(self._TogglingRepeatContext))
|
|
193
|
+
if self._TogglingRepeatTrack is not None: msg = '%s\n TogglingRepeatTrack="%s"' % (msg, str(self._TogglingRepeatTrack))
|
|
194
|
+
if self._TogglingShuffle is not None: msg = '%s\n TogglingShuffle="%s"' % (msg, str(self._TogglingShuffle))
|
|
195
|
+
if self._TransferringPlayback is not None: msg = '%s\n TransferringPlayback="%s"' % (msg, str(self._TransferringPlayback))
|
|
196
|
+
return msg
|