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,299 @@
|
|
|
1
|
+
# external package imports.
|
|
2
|
+
|
|
3
|
+
# our package imports.
|
|
4
|
+
from ..sautils import export
|
|
5
|
+
from .externalurls import ExternalUrls
|
|
6
|
+
from .imageobject import ImageObject
|
|
7
|
+
from .linkedfrom import LinkedFrom
|
|
8
|
+
|
|
9
|
+
@export
|
|
10
|
+
class SearchResultBase:
|
|
11
|
+
"""
|
|
12
|
+
Base class used to return basic search results common to all Spotify types.
|
|
13
|
+
|
|
14
|
+
This class is not part of the Spotify Web API specification.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
def __init__(self, root:dict=None) -> None:
|
|
18
|
+
"""
|
|
19
|
+
Initializes a new instance of the class.
|
|
20
|
+
|
|
21
|
+
Args:
|
|
22
|
+
root (dict):
|
|
23
|
+
Spotify Web API JSON response in dictionary format, used to load object
|
|
24
|
+
attributes; otherwise, None to not load attributes.
|
|
25
|
+
"""
|
|
26
|
+
self._ExternalUrls:ExternalUrls = None
|
|
27
|
+
self._Href:str = None
|
|
28
|
+
self._Id:str = None
|
|
29
|
+
self._Images:list[ImageObject] = []
|
|
30
|
+
self._LinkedFrom:LinkedFrom = None
|
|
31
|
+
self._Name:str = None
|
|
32
|
+
self._Type:str = None
|
|
33
|
+
self._Uri:str = None
|
|
34
|
+
|
|
35
|
+
if (root is None):
|
|
36
|
+
|
|
37
|
+
# if not building the class from json response, then initialize various properties as
|
|
38
|
+
# the object is probably being built manually.
|
|
39
|
+
self._ExternalUrls = ExternalUrls()
|
|
40
|
+
|
|
41
|
+
else:
|
|
42
|
+
|
|
43
|
+
self._Href = root.get('href', None)
|
|
44
|
+
self._Id = root.get('id', None)
|
|
45
|
+
self._Name = root.get('name', None)
|
|
46
|
+
self._Type = root.get('type', None)
|
|
47
|
+
self._Uri = root.get('uri', None)
|
|
48
|
+
|
|
49
|
+
# process all collections and objects.
|
|
50
|
+
item:dict = root.get('external_urls',None)
|
|
51
|
+
if item is not None:
|
|
52
|
+
self._ExternalUrls = ExternalUrls(root=item)
|
|
53
|
+
|
|
54
|
+
item:dict = root.get('linked_from',None)
|
|
55
|
+
if item is not None:
|
|
56
|
+
self._LinkedFrom = LinkedFrom(root=item)
|
|
57
|
+
|
|
58
|
+
items:list = root.get('images',None)
|
|
59
|
+
if items is not None:
|
|
60
|
+
for item in items:
|
|
61
|
+
self._Images.append(ImageObject(root=item))
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def __repr__(self) -> str:
|
|
65
|
+
return self.ToString()
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def __str__(self) -> str:
|
|
69
|
+
return self.ToString()
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
# implement sorting support.
|
|
73
|
+
def __eq__(self, other):
|
|
74
|
+
try:
|
|
75
|
+
return self.Name == other.Name
|
|
76
|
+
except Exception:
|
|
77
|
+
if (isinstance(self, SearchResultBase )) and (isinstance(other, SearchResultBase )):
|
|
78
|
+
return self.Name == other.Name
|
|
79
|
+
return False
|
|
80
|
+
|
|
81
|
+
def __lt__(self, other):
|
|
82
|
+
try:
|
|
83
|
+
return self.Name < other.Name
|
|
84
|
+
except Exception:
|
|
85
|
+
if (isinstance(self, SearchResultBase )) and (isinstance(other, SearchResultBase )):
|
|
86
|
+
return self.Name < other.Name
|
|
87
|
+
return False
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
@property
|
|
91
|
+
def ExternalUrls(self) -> ExternalUrls:
|
|
92
|
+
"""
|
|
93
|
+
Known external URLs for this object.
|
|
94
|
+
"""
|
|
95
|
+
return self._ExternalUrls
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
@property
|
|
99
|
+
def Href(self) -> str:
|
|
100
|
+
"""
|
|
101
|
+
A link to the Web API endpoint providing full details of the object.
|
|
102
|
+
"""
|
|
103
|
+
return self._Href
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
@property
|
|
107
|
+
def Id(self) -> str:
|
|
108
|
+
"""
|
|
109
|
+
The Spotify ID for the object.
|
|
110
|
+
|
|
111
|
+
Example: `5v5ETK9WFXAnGQ3MRubKuE`
|
|
112
|
+
"""
|
|
113
|
+
return self._Id
|
|
114
|
+
|
|
115
|
+
@Id.setter
|
|
116
|
+
def Id(self, value:str):
|
|
117
|
+
"""
|
|
118
|
+
Sets the Id property value.
|
|
119
|
+
"""
|
|
120
|
+
if isinstance(value, str):
|
|
121
|
+
self._Id = value
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
@property
|
|
125
|
+
def IdOrigin(self) -> str:
|
|
126
|
+
"""
|
|
127
|
+
The origin Spotify ID for the track.
|
|
128
|
+
The `LinkedFrom.Id` value is returned if present;
|
|
129
|
+
otherwise, the `Id` value is returned.
|
|
130
|
+
|
|
131
|
+
This is a helper property, and is not part of the Spotify Web API specification.
|
|
132
|
+
"""
|
|
133
|
+
if (self.IsLinkedFrom):
|
|
134
|
+
return self._LinkedFrom.Id
|
|
135
|
+
return self._Id
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
@property
|
|
139
|
+
def Images(self) -> list[ImageObject]:
|
|
140
|
+
"""
|
|
141
|
+
Images for the object.
|
|
142
|
+
|
|
143
|
+
The array may be empty or contain up to three images.
|
|
144
|
+
The images are returned by size in descending order.
|
|
145
|
+
Note: If returned, the source URL for the image (url) is temporary and will expire in less than a day.
|
|
146
|
+
"""
|
|
147
|
+
return self._Images
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
@property
|
|
151
|
+
def ImageUrl(self) -> str:
|
|
152
|
+
"""
|
|
153
|
+
Returns the highest resolution order image from the `Images` list, if images
|
|
154
|
+
are defined; otherwise, null.
|
|
155
|
+
"""
|
|
156
|
+
return ImageObject.GetImageHighestResolution(self._Images)
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
@property
|
|
160
|
+
def IsLinkedFrom(self) -> bool:
|
|
161
|
+
"""
|
|
162
|
+
Whether or not the track is linked from another track.
|
|
163
|
+
|
|
164
|
+
If True, the `LinkedFrom` property contains track origin data;
|
|
165
|
+
If False, the `LinkedFrom` property is an empty dictionary.
|
|
166
|
+
|
|
167
|
+
This is a helper property, and is not part of the Spotify Web API specification.
|
|
168
|
+
"""
|
|
169
|
+
if (self._LinkedFrom is not None) and (self._LinkedFrom.Id is not None):
|
|
170
|
+
return True
|
|
171
|
+
return False
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
@property
|
|
175
|
+
def LinkedFrom(self) -> LinkedFrom:
|
|
176
|
+
"""
|
|
177
|
+
Part of the response when Track Relinking is applied, and the requested track has been replaced
|
|
178
|
+
with a different track. The track in the LinkedFrom object contains information about the originally
|
|
179
|
+
requested track.
|
|
180
|
+
"""
|
|
181
|
+
return self._LinkedFrom
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
@property
|
|
185
|
+
def Name(self) -> str:
|
|
186
|
+
"""
|
|
187
|
+
The name of the object.
|
|
188
|
+
"""
|
|
189
|
+
return self._Name
|
|
190
|
+
|
|
191
|
+
@Name.setter
|
|
192
|
+
def Name(self, value:str):
|
|
193
|
+
"""
|
|
194
|
+
Sets the Name property value.
|
|
195
|
+
"""
|
|
196
|
+
if isinstance(value, str):
|
|
197
|
+
self._Name = value
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
@property
|
|
201
|
+
def Type(self) -> str:
|
|
202
|
+
"""
|
|
203
|
+
The object type (e.g. album, artist, audiobook, episode, playlist, show, track, etc).
|
|
204
|
+
"""
|
|
205
|
+
return self._Type
|
|
206
|
+
|
|
207
|
+
@Type.setter
|
|
208
|
+
def Type(self, value:str):
|
|
209
|
+
"""
|
|
210
|
+
Sets the Type property value.
|
|
211
|
+
"""
|
|
212
|
+
if isinstance(value, str):
|
|
213
|
+
self._Type = value
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
@property
|
|
217
|
+
def Uri(self) -> str:
|
|
218
|
+
"""
|
|
219
|
+
The Spotify URI for the object.
|
|
220
|
+
|
|
221
|
+
Example: `spotify:playlist:5v5ETK9WFXAnGQ3MRubKuE`
|
|
222
|
+
"""
|
|
223
|
+
return self._Uri
|
|
224
|
+
|
|
225
|
+
@Uri.setter
|
|
226
|
+
def Uri(self, value:str):
|
|
227
|
+
"""
|
|
228
|
+
Sets the Uri property value.
|
|
229
|
+
"""
|
|
230
|
+
if isinstance(value, str):
|
|
231
|
+
self._Uri = value
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
@property
|
|
235
|
+
def UriOrigin(self) -> str:
|
|
236
|
+
"""
|
|
237
|
+
The origin Spotify URI for the track.
|
|
238
|
+
The `LinkedFrom.Uri` value is returned if present;
|
|
239
|
+
otherwise, the `Uri` value is returned.
|
|
240
|
+
|
|
241
|
+
This is a helper property, and is not part of the Spotify Web API specification.
|
|
242
|
+
"""
|
|
243
|
+
if (self.IsLinkedFrom):
|
|
244
|
+
return self._LinkedFrom.Uri
|
|
245
|
+
return self._Uri
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
def ToDictionary(self) -> dict:
|
|
249
|
+
"""
|
|
250
|
+
Returns a dictionary representation of the class.
|
|
251
|
+
"""
|
|
252
|
+
externalUrls:dict = {}
|
|
253
|
+
if self._ExternalUrls is not None:
|
|
254
|
+
externalUrls = self._ExternalUrls.ToDictionary()
|
|
255
|
+
|
|
256
|
+
linked_from:dict = {}
|
|
257
|
+
if self._LinkedFrom is not None:
|
|
258
|
+
linked_from = self._LinkedFrom.ToDictionary()
|
|
259
|
+
|
|
260
|
+
result:dict = \
|
|
261
|
+
{
|
|
262
|
+
'external_urls': externalUrls,
|
|
263
|
+
'href': self._Href,
|
|
264
|
+
'id': self._Id,
|
|
265
|
+
'image_url': self.ImageUrl,
|
|
266
|
+
'images': [ item.ToDictionary() for item in self._Images ],
|
|
267
|
+
'is_linked_from': self.IsLinkedFrom,
|
|
268
|
+
'name': self._Name,
|
|
269
|
+
'type': self._Type,
|
|
270
|
+
'uri': self._Uri,
|
|
271
|
+
'linked_from': linked_from,
|
|
272
|
+
'id_origin': self.IdOrigin,
|
|
273
|
+
'uri_origin': self.UriOrigin,
|
|
274
|
+
}
|
|
275
|
+
return result
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
def ToString(self, includeTitle:bool=True) -> str:
|
|
279
|
+
"""
|
|
280
|
+
Returns a displayable string representation of the class.
|
|
281
|
+
|
|
282
|
+
Args:
|
|
283
|
+
includeTitle (str):
|
|
284
|
+
True to include the class name title prefix.
|
|
285
|
+
"""
|
|
286
|
+
msg:str = ''
|
|
287
|
+
if includeTitle:
|
|
288
|
+
msg = 'SearchResultBase:'
|
|
289
|
+
|
|
290
|
+
if self._Name is not None: msg = '%s\n Name="%s"' % (msg, str(self._Name))
|
|
291
|
+
if self._Href is not None: msg = '%s\n Href="%s"' % (msg, str(self._Href))
|
|
292
|
+
if self._Id is not None: msg = '%s\n Id="%s"' % (msg, str(self._Id))
|
|
293
|
+
if self.IdOrigin is not None: msg = '%s\n IdOrigin="%s"' % (msg, str(self.IdOrigin))
|
|
294
|
+
if self._Images is not None: msg = '%s\n Images Count=%s' % (msg, str(len(self._Images)))
|
|
295
|
+
if self._Type is not None: msg = '%s\n Type="%s"' % (msg, str(self._Type))
|
|
296
|
+
if self._Uri is not None: msg = '%s\n Uri="%s"' % (msg, str(self._Uri))
|
|
297
|
+
if self.UriOrigin is not None: msg = '%s\n UriOrigin="%s"' % (msg, str(self.UriOrigin))
|
|
298
|
+
if self._LinkedFrom is not None: msg = '%s\n LinkedFrom: %s' % (msg, self._LinkedFrom.ToString(False))
|
|
299
|
+
return msg
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# external package imports.
|
|
2
|
+
|
|
3
|
+
# our package imports.
|
|
4
|
+
from ..sautils import export
|
|
5
|
+
from .showsimplified import ShowSimplified
|
|
6
|
+
from .episodepagesimplified import EpisodePageSimplified
|
|
7
|
+
|
|
8
|
+
@export
|
|
9
|
+
class Show(ShowSimplified):
|
|
10
|
+
"""
|
|
11
|
+
Spotify Web API Show object.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
def __init__(self, root:dict=None) -> None:
|
|
15
|
+
"""
|
|
16
|
+
Initializes a new instance of the class.
|
|
17
|
+
|
|
18
|
+
Args:
|
|
19
|
+
root (dict):
|
|
20
|
+
Spotify Web API JSON response in dictionary format, used to load object
|
|
21
|
+
attributes; otherwise, None to not load attributes.
|
|
22
|
+
"""
|
|
23
|
+
# initialize base class.
|
|
24
|
+
super().__init__(root=root)
|
|
25
|
+
|
|
26
|
+
self._Episodes:EpisodePageSimplified = None
|
|
27
|
+
|
|
28
|
+
if (root is None):
|
|
29
|
+
|
|
30
|
+
pass
|
|
31
|
+
|
|
32
|
+
else:
|
|
33
|
+
|
|
34
|
+
# process all collections and objects.
|
|
35
|
+
item:dict = root.get('episodes',None)
|
|
36
|
+
if item is not None:
|
|
37
|
+
self._Episodes = EpisodePageSimplified(root=item)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def __repr__(self) -> str:
|
|
41
|
+
return self.ToString()
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def __str__(self) -> str:
|
|
45
|
+
return self.ToString()
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
@property
|
|
49
|
+
def Episodes(self) -> EpisodePageSimplified:
|
|
50
|
+
"""
|
|
51
|
+
The episodes of the show.
|
|
52
|
+
|
|
53
|
+
This is a `EpisodePageSimplified` object.
|
|
54
|
+
"""
|
|
55
|
+
return self._Episodes
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def ToDictionary(self) -> dict:
|
|
59
|
+
"""
|
|
60
|
+
Returns a dictionary representation of the class.
|
|
61
|
+
"""
|
|
62
|
+
# get base class result.
|
|
63
|
+
resultBase:dict = super().ToDictionary()
|
|
64
|
+
|
|
65
|
+
episodes:dict = {}
|
|
66
|
+
if self._Episodes is not None:
|
|
67
|
+
episodes = self._Episodes.ToDictionary()
|
|
68
|
+
|
|
69
|
+
result:dict = \
|
|
70
|
+
{
|
|
71
|
+
'episodes': episodes
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
# combine base class results with these results.
|
|
75
|
+
resultBase.update(result)
|
|
76
|
+
|
|
77
|
+
# return an unsorted dictionary.
|
|
78
|
+
return resultBase
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def ToString(self) -> str:
|
|
82
|
+
"""
|
|
83
|
+
Returns a displayable string representation of the class.
|
|
84
|
+
"""
|
|
85
|
+
msg:str = 'Show: %s' % super().ToString(False)
|
|
86
|
+
if self._Episodes is not None: msg = '%s\n Episode Count=%s' % (msg, str(self._Episodes.Total))
|
|
87
|
+
return msg
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# external package imports.
|
|
2
|
+
|
|
3
|
+
# our package imports.
|
|
4
|
+
from ..sautils import export
|
|
5
|
+
from .show import Show
|
|
6
|
+
from .showsaved import ShowSaved
|
|
7
|
+
from .pageobject import PageObject
|
|
8
|
+
|
|
9
|
+
@export
|
|
10
|
+
class ShowPageSaved(PageObject):
|
|
11
|
+
"""
|
|
12
|
+
Spotify Web API ShowPageSaved object.
|
|
13
|
+
|
|
14
|
+
This allows for multiple pages of `ShowSaved` objects to be navigated.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
def __init__(self, root:dict=None) -> None:
|
|
18
|
+
"""
|
|
19
|
+
Initializes a new instance of the class.
|
|
20
|
+
|
|
21
|
+
Args:
|
|
22
|
+
root (dict):
|
|
23
|
+
Spotify Web API JSON response in dictionary format, used to load object
|
|
24
|
+
attributes; otherwise, None to not load attributes.
|
|
25
|
+
"""
|
|
26
|
+
# initialize base class.
|
|
27
|
+
super().__init__(root=root)
|
|
28
|
+
|
|
29
|
+
# initialize storage.
|
|
30
|
+
self._Items:list[ShowSaved] = []
|
|
31
|
+
|
|
32
|
+
if (root is None):
|
|
33
|
+
|
|
34
|
+
pass
|
|
35
|
+
|
|
36
|
+
else:
|
|
37
|
+
|
|
38
|
+
# process all collections and objects.
|
|
39
|
+
items:list = root.get('items',None)
|
|
40
|
+
if items is not None:
|
|
41
|
+
for item in items:
|
|
42
|
+
if item is not None:
|
|
43
|
+
self._Items.append(ShowSaved(root=item))
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def __repr__(self) -> str:
|
|
47
|
+
return self.ToString()
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def __str__(self) -> str:
|
|
51
|
+
return self.ToString()
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
@property
|
|
55
|
+
def Items(self) -> list[ShowSaved]:
|
|
56
|
+
"""
|
|
57
|
+
Array of `ShowSaved` objects.
|
|
58
|
+
"""
|
|
59
|
+
return self._Items
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def GetShows(self) -> list[Show]:
|
|
63
|
+
"""
|
|
64
|
+
Gets a list of all shows contained in the underlying `Items` list.
|
|
65
|
+
|
|
66
|
+
This is a convenience method so one does not have to loop through the `Items`
|
|
67
|
+
array of ShowSaved objects to get the list of shows.
|
|
68
|
+
"""
|
|
69
|
+
result:list[Show] = []
|
|
70
|
+
item:ShowSaved
|
|
71
|
+
for item in self._Items:
|
|
72
|
+
result.append(item.Show)
|
|
73
|
+
return result
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def ToString(self, includeItems:bool=False) -> str:
|
|
77
|
+
"""
|
|
78
|
+
Returns a displayable string representation of the class.
|
|
79
|
+
|
|
80
|
+
Args:
|
|
81
|
+
includeItems (bool):
|
|
82
|
+
True to include the Items collection of objects; otherwise, False
|
|
83
|
+
to only return base properties.
|
|
84
|
+
"""
|
|
85
|
+
return 'ShowPageSaved: %s' % super().ToString(includeItems)
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# external package imports.
|
|
2
|
+
|
|
3
|
+
# our package imports.
|
|
4
|
+
from ..sautils import export
|
|
5
|
+
from .showsimplified import ShowSimplified
|
|
6
|
+
from .pageobject import PageObject
|
|
7
|
+
|
|
8
|
+
@export
|
|
9
|
+
class ShowPageSimplified(PageObject):
|
|
10
|
+
"""
|
|
11
|
+
Spotify Web API SimplifiedShowPage object.
|
|
12
|
+
|
|
13
|
+
This allows for multiple pages of `ShowSimplified` objects to be navigated.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
def __init__(self, root:dict=None) -> None:
|
|
17
|
+
"""
|
|
18
|
+
Initializes a new instance of the class.
|
|
19
|
+
|
|
20
|
+
Args:
|
|
21
|
+
root (dict):
|
|
22
|
+
Spotify Web API JSON response in dictionary format, used to load object
|
|
23
|
+
attributes; otherwise, None to not load attributes.
|
|
24
|
+
"""
|
|
25
|
+
# initialize base class.
|
|
26
|
+
super().__init__(root=root)
|
|
27
|
+
|
|
28
|
+
# initialize storage.
|
|
29
|
+
self._Items:list[ShowSimplified] = []
|
|
30
|
+
|
|
31
|
+
if (root is None):
|
|
32
|
+
|
|
33
|
+
pass
|
|
34
|
+
|
|
35
|
+
else:
|
|
36
|
+
|
|
37
|
+
# process all collections and objects.
|
|
38
|
+
items:list = root.get('items',None)
|
|
39
|
+
if items is not None:
|
|
40
|
+
for item in items:
|
|
41
|
+
if item is not None:
|
|
42
|
+
self._Items.append(ShowSimplified(root=item))
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def __repr__(self) -> str:
|
|
46
|
+
return self.ToString()
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def __str__(self) -> str:
|
|
50
|
+
return self.ToString()
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
@property
|
|
54
|
+
def Items(self) -> list[ShowSimplified]:
|
|
55
|
+
"""
|
|
56
|
+
Array of `ShowSimplified` objects.
|
|
57
|
+
"""
|
|
58
|
+
return self._Items
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def ContainsId(self, itemId:str=False) -> bool:
|
|
62
|
+
"""
|
|
63
|
+
Checks the `Items` collection to see if an item already exists with the
|
|
64
|
+
specified Id value.
|
|
65
|
+
|
|
66
|
+
Returns True if the itemId exists in the collection; otherwise, False.
|
|
67
|
+
"""
|
|
68
|
+
result:bool = False
|
|
69
|
+
|
|
70
|
+
item:ShowSimplified
|
|
71
|
+
for item in self._Items:
|
|
72
|
+
if item.Id == itemId:
|
|
73
|
+
result = True
|
|
74
|
+
break
|
|
75
|
+
|
|
76
|
+
return result
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def ToString(self, includeItems:bool=False) -> str:
|
|
80
|
+
"""
|
|
81
|
+
Returns a displayable string representation of the class.
|
|
82
|
+
|
|
83
|
+
Args:
|
|
84
|
+
includeItems (bool):
|
|
85
|
+
True to include the Items collection of objects; otherwise, False
|
|
86
|
+
to only return base properties.
|
|
87
|
+
"""
|
|
88
|
+
return 'ShowPageSimplified: %s' % super().ToString(includeItems)
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# external package imports.
|
|
2
|
+
|
|
3
|
+
# our package imports.
|
|
4
|
+
from ..sautils import export
|
|
5
|
+
from .showsimplified import ShowSimplified
|
|
6
|
+
|
|
7
|
+
@export
|
|
8
|
+
class ShowSaved:
|
|
9
|
+
"""
|
|
10
|
+
Spotify Web API SavedShow object.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
def __init__(self, root:dict=None) -> None:
|
|
14
|
+
"""
|
|
15
|
+
Initializes a new instance of the class.
|
|
16
|
+
|
|
17
|
+
Args:
|
|
18
|
+
root (dict):
|
|
19
|
+
Spotify Web API JSON response in dictionary format, used to load object
|
|
20
|
+
attributes; otherwise, None to not load attributes.
|
|
21
|
+
"""
|
|
22
|
+
self._Show:ShowSimplified = None
|
|
23
|
+
self._AddedAt:str = None
|
|
24
|
+
|
|
25
|
+
if (root is None):
|
|
26
|
+
|
|
27
|
+
pass
|
|
28
|
+
|
|
29
|
+
else:
|
|
30
|
+
|
|
31
|
+
self._AddedAt = root.get('added_at', None)
|
|
32
|
+
|
|
33
|
+
# process all collections and objects.
|
|
34
|
+
item:dict = root.get('show',None)
|
|
35
|
+
if item is not None:
|
|
36
|
+
self._Show = ShowSimplified(root=item)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def __repr__(self) -> str:
|
|
40
|
+
return self.ToString()
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def __str__(self) -> str:
|
|
44
|
+
return self.ToString()
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
@property
|
|
48
|
+
def AddedAt(self) -> str:
|
|
49
|
+
"""
|
|
50
|
+
The date and time the show was saved.
|
|
51
|
+
|
|
52
|
+
Timestamps are returned in ISO 8601 format as Coordinated Universal Time (UTC) with a zero
|
|
53
|
+
offset: YYYY-MM-DDTHH:MM:SSZ. If the time is imprecise (for example, the date/time of an
|
|
54
|
+
episode release), an additional field indicates the precision; see for example, release_date
|
|
55
|
+
in an episode object.
|
|
56
|
+
"""
|
|
57
|
+
return self._AddedAt
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
@property
|
|
61
|
+
def Show(self) -> ShowSimplified:
|
|
62
|
+
"""
|
|
63
|
+
Information about the show.
|
|
64
|
+
"""
|
|
65
|
+
return self._Show
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def ToDictionary(self) -> dict:
|
|
69
|
+
"""
|
|
70
|
+
Returns a dictionary representation of the class.
|
|
71
|
+
"""
|
|
72
|
+
show:dict = {}
|
|
73
|
+
if self._Show is not None:
|
|
74
|
+
show = self._Show.ToDictionary()
|
|
75
|
+
|
|
76
|
+
result:dict = \
|
|
77
|
+
{
|
|
78
|
+
'added_at': self._AddedAt,
|
|
79
|
+
'show': show
|
|
80
|
+
}
|
|
81
|
+
return result
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def ToString(self, includeItems:bool=False) -> str:
|
|
85
|
+
"""
|
|
86
|
+
Returns a displayable string representation of the class.
|
|
87
|
+
|
|
88
|
+
Args:
|
|
89
|
+
includeItems (bool):
|
|
90
|
+
True to include the Items collection of objects; otherwise, False
|
|
91
|
+
to only return base properties.
|
|
92
|
+
"""
|
|
93
|
+
msg:str = 'ShowSaved:'
|
|
94
|
+
if self._AddedAt is not None: msg = '%s\n AddedAt="%s"' % (msg, str(self._AddedAt))
|
|
95
|
+
|
|
96
|
+
if (includeItems):
|
|
97
|
+
if self._Show is not None: msg = '%s\n %s' % (msg, str(self._Show))
|
|
98
|
+
|
|
99
|
+
return msg
|