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.
Files changed (138) hide show
  1. spotifywebapipython/__init__.py +35 -0
  2. spotifywebapipython/const.py +114 -0
  3. spotifywebapipython/docs/__init__.html +2156 -0
  4. spotifywebapipython/docs/codecopy.js +70 -0
  5. spotifywebapipython/docs/index.html +514 -0
  6. spotifywebapipython/docs/search.js +46 -0
  7. spotifywebapipython/docs/spotifywebapipython/const.html +636 -0
  8. spotifywebapipython/docs/spotifywebapipython/saappmessages.html +540 -0
  9. spotifywebapipython/docs/spotifywebapipython/sautils.html +620 -0
  10. spotifywebapipython/docs/spotifywebapipython/spotifyapierror.html +341 -0
  11. spotifywebapipython/docs/spotifywebapipython/spotifyapimessage.html +598 -0
  12. spotifywebapipython/docs/spotifywebapipython/spotifyauthtoken.html +612 -0
  13. spotifywebapipython/docs/spotifywebapipython/spotifyclient.html +16557 -0
  14. spotifywebapipython/docs/spotifywebapipython/spotifydiscovery.html +518 -0
  15. spotifywebapipython/docs/spotifywebapipython/spotifywebapiauthenticationerror.html +421 -0
  16. spotifywebapipython/docs/spotifywebapipython/spotifywebapierror.html +400 -0
  17. spotifywebapipython/docs/spotifywebapipython/spotifywebplayertoken.html +635 -0
  18. spotifywebapipython/docs/spotifywebapipython.ico +0 -0
  19. spotifywebapipython/docs/spotifywebapipython_OLD.ico +0 -0
  20. spotifywebapipython/models/__init__.py +121 -0
  21. spotifywebapipython/models/album.py +170 -0
  22. spotifywebapipython/models/albumpagesaved.py +85 -0
  23. spotifywebapipython/models/albumpagesimplified.py +88 -0
  24. spotifywebapipython/models/albumsaved.py +102 -0
  25. spotifywebapipython/models/albumsimplified.py +308 -0
  26. spotifywebapipython/models/artist.py +146 -0
  27. spotifywebapipython/models/artistinfo.py +282 -0
  28. spotifywebapipython/models/artistinfotourevent.py +127 -0
  29. spotifywebapipython/models/artistpage.py +70 -0
  30. spotifywebapipython/models/artistsimplified.py +163 -0
  31. spotifywebapipython/models/audiobook.py +87 -0
  32. spotifywebapipython/models/audiobookpagesimplified.py +88 -0
  33. spotifywebapipython/models/audiobooksimplified.py +362 -0
  34. spotifywebapipython/models/audiofeatures.py +333 -0
  35. spotifywebapipython/models/author.py +67 -0
  36. spotifywebapipython/models/category.py +168 -0
  37. spotifywebapipython/models/categorypage.py +70 -0
  38. spotifywebapipython/models/chapter.py +84 -0
  39. spotifywebapipython/models/chapterpagesimplified.py +88 -0
  40. spotifywebapipython/models/chaptersimplified.py +387 -0
  41. spotifywebapipython/models/context.py +113 -0
  42. spotifywebapipython/models/copyright.py +79 -0
  43. spotifywebapipython/models/device.py +301 -0
  44. spotifywebapipython/models/episode.py +84 -0
  45. spotifywebapipython/models/episodepagesaved.py +85 -0
  46. spotifywebapipython/models/episodepagesimplified.py +88 -0
  47. spotifywebapipython/models/episodesaved.py +99 -0
  48. spotifywebapipython/models/episodesimplified.py +370 -0
  49. spotifywebapipython/models/explicitcontent.py +80 -0
  50. spotifywebapipython/models/externalids.py +91 -0
  51. spotifywebapipython/models/externalurls.py +104 -0
  52. spotifywebapipython/models/followers.py +81 -0
  53. spotifywebapipython/models/imageobject.py +193 -0
  54. spotifywebapipython/models/imagevibrantcolors.py +182 -0
  55. spotifywebapipython/models/linkedfrom.py +165 -0
  56. spotifywebapipython/models/narrator.py +67 -0
  57. spotifywebapipython/models/owner.py +162 -0
  58. spotifywebapipython/models/pageobject.py +343 -0
  59. spotifywebapipython/models/playeractions.py +196 -0
  60. spotifywebapipython/models/playerlastplayedinfo.py +334 -0
  61. spotifywebapipython/models/playerplaystate.py +467 -0
  62. spotifywebapipython/models/playerqueueinfo.py +207 -0
  63. spotifywebapipython/models/playhistory.py +136 -0
  64. spotifywebapipython/models/playhistorypage.py +85 -0
  65. spotifywebapipython/models/playlist.py +125 -0
  66. spotifywebapipython/models/playlistpage.py +85 -0
  67. spotifywebapipython/models/playlistpagesimplified.py +107 -0
  68. spotifywebapipython/models/playlistsimplified.py +334 -0
  69. spotifywebapipython/models/playlisttrack.py +143 -0
  70. spotifywebapipython/models/playlisttracksummary.py +80 -0
  71. spotifywebapipython/models/recommendationseed.py +135 -0
  72. spotifywebapipython/models/restrictions.py +86 -0
  73. spotifywebapipython/models/resumepoint.py +79 -0
  74. spotifywebapipython/models/searchresponse.py +391 -0
  75. spotifywebapipython/models/searchresultbase.py +299 -0
  76. spotifywebapipython/models/show.py +87 -0
  77. spotifywebapipython/models/showpagesaved.py +85 -0
  78. spotifywebapipython/models/showpagesimplified.py +88 -0
  79. spotifywebapipython/models/showsaved.py +99 -0
  80. spotifywebapipython/models/showsimplified.py +320 -0
  81. spotifywebapipython/models/spotifyconnectdevice.py +321 -0
  82. spotifywebapipython/models/spotifyconnectdevices.py +441 -0
  83. spotifywebapipython/models/track.py +142 -0
  84. spotifywebapipython/models/trackpage.py +110 -0
  85. spotifywebapipython/models/trackpagesaved.py +85 -0
  86. spotifywebapipython/models/trackpagesimplified.py +88 -0
  87. spotifywebapipython/models/trackrecommendations.py +88 -0
  88. spotifywebapipython/models/tracksaved.py +99 -0
  89. spotifywebapipython/models/tracksimplified.py +398 -0
  90. spotifywebapipython/models/userprofile.py +184 -0
  91. spotifywebapipython/models/userprofilesimplified.py +206 -0
  92. spotifywebapipython/models/zeroconfdiscoveryresult.py +592 -0
  93. spotifywebapipython/models/zeroconfproperty.py +93 -0
  94. spotifywebapipython/oauthcli/__init__.py +7 -0
  95. spotifywebapipython/oauthcli/authclient.py +1229 -0
  96. spotifywebapipython/saappmessages.py +86 -0
  97. spotifywebapipython/sautils.py +285 -0
  98. spotifywebapipython/spotifyapierror.py +66 -0
  99. spotifywebapipython/spotifyapimessage.py +269 -0
  100. spotifywebapipython/spotifyauthtoken.py +264 -0
  101. spotifywebapipython/spotifyclient.py +17885 -0
  102. spotifywebapipython/spotifyconnect/__init__.py +19 -0
  103. spotifywebapipython/spotifyconnect/spotifyconnectdeviceeventargs.py +67 -0
  104. spotifywebapipython/spotifyconnect/spotifyconnectdirectorytask.py +2564 -0
  105. spotifywebapipython/spotifyconnect/spotifyconnectzeroconfcastapptask.py +467 -0
  106. spotifywebapipython/spotifyconnect/spotifyconnectzeroconfcastcontroller.py +701 -0
  107. spotifywebapipython/spotifyconnect/spotifyconnectzeroconfcastlistener.py +359 -0
  108. spotifywebapipython/spotifyconnect/spotifyconnectzeroconfcastmultizonelistener.py +212 -0
  109. spotifywebapipython/spotifyconnect/spotifyconnectzeroconfexceptions.py +20 -0
  110. spotifywebapipython/spotifyconnect/spotifyconnectzeroconflistener.py +335 -0
  111. spotifywebapipython/spotifydiscovery.py +473 -0
  112. spotifywebapipython/spotifymediatypes.py +53 -0
  113. spotifywebapipython/spotifywebapiauthenticationerror.py +122 -0
  114. spotifywebapipython/spotifywebapierror.py +106 -0
  115. spotifywebapipython/spotifywebplayertoken.py +743 -0
  116. spotifywebapipython/vibrant/__init__.py +17 -0
  117. spotifywebapipython/vibrant/generator.py +261 -0
  118. spotifywebapipython/vibrant/image.py +100 -0
  119. spotifywebapipython/vibrant/main.py +34 -0
  120. spotifywebapipython/vibrant/models.py +93 -0
  121. spotifywebapipython/vibrant/utils.py +56 -0
  122. spotifywebapipython/zeroconfapi/__init__.py +23 -0
  123. spotifywebapipython/zeroconfapi/authenticationtypes.py +38 -0
  124. spotifywebapipython/zeroconfapi/blobbuilder.py +370 -0
  125. spotifywebapipython/zeroconfapi/credentials.py +37 -0
  126. spotifywebapipython/zeroconfapi/cryptodiffiehellman.py +89 -0
  127. spotifywebapipython/zeroconfapi/helpers.py +64 -0
  128. spotifywebapipython/zeroconfapi/spotifyzeroconfapierror.py +108 -0
  129. spotifywebapipython/zeroconfapi/zeroconfconnect.py +1327 -0
  130. spotifywebapipython/zeroconfapi/zeroconfgetinfo.py +572 -0
  131. spotifywebapipython/zeroconfapi/zeroconfgetinfoalias.py +109 -0
  132. spotifywebapipython/zeroconfapi/zeroconfgetinfodrmmediaformat.py +90 -0
  133. spotifywebapipython/zeroconfapi/zeroconfresponse.py +195 -0
  134. spotifywebapipython-1.0.242.dist-info/LICENSE +22 -0
  135. spotifywebapipython-1.0.242.dist-info/METADATA +219 -0
  136. spotifywebapipython-1.0.242.dist-info/RECORD +138 -0
  137. spotifywebapipython-1.0.242.dist-info/WHEEL +5 -0
  138. spotifywebapipython-1.0.242.dist-info/top_level.txt +1 -0
@@ -0,0 +1,334 @@
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 .playlisttracksummary import PlaylistTrackSummary
8
+ from .owner import Owner
9
+
10
+ @export
11
+ class PlaylistSimplified:
12
+ """
13
+ Spotify Web API PlaylistSimplified object.
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
+ self._Collaborative:bool = None
26
+ self._Description:str = None
27
+ self._ExternalUrls:ExternalUrls = None
28
+ self._Href:str = None
29
+ self._Id:str = None
30
+ self._Images:list[ImageObject] = []
31
+ self._Name:str = None
32
+ self._Owner:Owner = None
33
+ self._Public:bool = None
34
+ self._SnapshotId:str = None
35
+ self._Tracks:PlaylistTrackSummary = None
36
+ self._Type:str = None
37
+ self._Uri:str = None
38
+
39
+ if (root is None):
40
+
41
+ # if not building the class from json response, then initialize various properties as
42
+ # the playlist is probably being built manually.
43
+ self._ExternalUrls = ExternalUrls()
44
+ self._Tracks = PlaylistTrackSummary()
45
+
46
+ else:
47
+
48
+ self._Collaborative = root.get('collaborative', None)
49
+ self._Description = root.get('description', None)
50
+ self._Href = root.get('href', None)
51
+ self._Id = root.get('id', None)
52
+ self._Name = root.get('name', None)
53
+ self._Public = root.get('public', None)
54
+ self._SnapshotId = root.get('snapshot_id', None)
55
+ self._Type = root.get('type', None)
56
+ self._Uri = root.get('uri', None)
57
+
58
+ # process all collections and objects.
59
+ item:dict = root.get('external_urls',None)
60
+ if item is not None:
61
+ self._ExternalUrls = ExternalUrls(root=item)
62
+
63
+ items:list = root.get('images',None)
64
+ if items is not None:
65
+ for item in items:
66
+ self._Images.append(ImageObject(root=item))
67
+
68
+ item:dict = root.get('owner',None)
69
+ if item is not None:
70
+ self._Owner = Owner(root=item)
71
+
72
+ # Tracks could be one of the following objects:
73
+ # - PlaylistTrackSummary (default) if used for playlist summary methods.
74
+ # - PlaylistPage if used for playlist detail methods.
75
+ item:dict = root.get('tracks',None)
76
+ if item is not None:
77
+ self._Tracks = PlaylistTrackSummary(root=item)
78
+
79
+
80
+ def __repr__(self) -> str:
81
+ return self.ToString()
82
+
83
+
84
+ def __str__(self) -> str:
85
+ return self.ToString()
86
+
87
+
88
+ # implement sorting support.
89
+ def __eq__(self, other):
90
+ try:
91
+ return self.Name == other.Name
92
+ except Exception:
93
+ if (isinstance(self, PlaylistSimplified )) and (isinstance(other, PlaylistSimplified )):
94
+ return self.Name == other.Name
95
+ return False
96
+
97
+ def __lt__(self, other):
98
+ try:
99
+ return self.Name < other.Name
100
+ except Exception:
101
+ if (isinstance(self, PlaylistSimplified )) and (isinstance(other, PlaylistSimplified )):
102
+ return self.Name < other.Name
103
+ return False
104
+
105
+
106
+ @property
107
+ def Collaborative(self) -> bool:
108
+ """
109
+ True if the owner allows other users to modify the playlist.
110
+ """
111
+ return self._Collaborative
112
+
113
+
114
+ @property
115
+ def Description(self) -> str:
116
+ """
117
+ The playlist description.
118
+
119
+ Only returned for modified, verified playlists; otherwise null.
120
+ """
121
+ return self._Description
122
+
123
+ @Description.setter
124
+ def Description(self, value:str):
125
+ """
126
+ Sets the Description property value.
127
+ """
128
+ if isinstance(value, str):
129
+ self._Description = value
130
+
131
+
132
+ @property
133
+ def ExternalUrls(self) -> ExternalUrls:
134
+ """
135
+ Known external URLs for this playlist.
136
+ """
137
+ return self._ExternalUrls
138
+
139
+
140
+ @property
141
+ def Href(self) -> str:
142
+ """
143
+ A link to the Web API endpoint providing full details of the playlist.
144
+ """
145
+ return self._Href
146
+
147
+
148
+ @property
149
+ def Id(self) -> str:
150
+ """
151
+ The Spotify ID for the playlist.
152
+
153
+ Example: `5v5ETK9WFXAnGQ3MRubKuE`
154
+ """
155
+ return self._Id
156
+
157
+ @Id.setter
158
+ def Id(self, value:str):
159
+ """
160
+ Sets the Id property value.
161
+ """
162
+ if isinstance(value, str):
163
+ self._Id = value
164
+
165
+
166
+ @property
167
+ def Images(self) -> list[ImageObject]:
168
+ """
169
+ Images for the playlist.
170
+
171
+ The array may be empty or contain up to three images.
172
+ The images are returned by size in descending order.
173
+ Note: If returned, the source URL for the image (url) is temporary and will expire in less than a day.
174
+ """
175
+ return self._Images
176
+
177
+
178
+ @property
179
+ def ImageUrl(self) -> str:
180
+ """
181
+ Returns the highest resolution order image from the `Images` list, if images
182
+ are defined; otherwise, null.
183
+ """
184
+ return ImageObject.GetImageHighestResolution(self._Images)
185
+
186
+
187
+ @property
188
+ def Name(self) -> str:
189
+ """
190
+ The name of the playlist.
191
+ """
192
+ return self._Name
193
+
194
+ @Name.setter
195
+ def Name(self, value:str):
196
+ """
197
+ Sets the Name property value.
198
+ """
199
+ if isinstance(value, str):
200
+ self._Name = value
201
+
202
+
203
+ @property
204
+ def Owner(self) -> Owner:
205
+ """
206
+ The user who owns the playlist.
207
+ """
208
+ return self._Owner
209
+
210
+
211
+ @property
212
+ def Public(self) -> bool:
213
+ """
214
+ The playlist's public/private status:
215
+ - true: the playlist is public.
216
+ - false: the playlist is private.
217
+ - null: the playlist status is not relevant.
218
+ """
219
+ return self._Public
220
+
221
+
222
+ @property
223
+ def SnapshotId(self) -> str:
224
+ """
225
+ The version identifier for the current playlist.
226
+
227
+ Can be supplied in other requests to target a specific playlist version.
228
+ """
229
+ return self._SnapshotId
230
+
231
+
232
+ @property
233
+ def Tracks(self) -> PlaylistTrackSummary: # [PlaylistTrackSummary | PlaylistPage]
234
+ """
235
+ The tracks summary of the playlist.
236
+ """
237
+ return self._Tracks
238
+
239
+
240
+ @property
241
+ def Type(self) -> str:
242
+ """
243
+ The object type: `playlist`.
244
+ """
245
+ return self._Type
246
+
247
+ @Type.setter
248
+ def Type(self, value:str):
249
+ """
250
+ Sets the Type property value.
251
+ """
252
+ if isinstance(value, str):
253
+ self._Type = value
254
+
255
+
256
+ @property
257
+ def Uri(self) -> str:
258
+ """
259
+ The Spotify URI for the playlist.
260
+
261
+ Example: `spotify:playlist:5v5ETK9WFXAnGQ3MRubKuE`
262
+ """
263
+ return self._Uri
264
+
265
+ @Uri.setter
266
+ def Uri(self, value:str):
267
+ """
268
+ Sets the Uri property value.
269
+ """
270
+ if isinstance(value, str):
271
+ self._Uri = value
272
+
273
+
274
+ def ToDictionary(self) -> dict:
275
+ """
276
+ Returns a dictionary representation of the class.
277
+ """
278
+ externalUrls:dict = {}
279
+ if self._ExternalUrls is not None:
280
+ externalUrls = self._ExternalUrls.ToDictionary()
281
+
282
+ owner:dict = {}
283
+ if self._Owner is not None:
284
+ owner = self._Owner.ToDictionary()
285
+
286
+ tracks:dict = {}
287
+ if self._Tracks is not None:
288
+ tracks = self._Tracks.ToDictionary()
289
+
290
+ result:dict = \
291
+ {
292
+ 'collaborative': self._Collaborative,
293
+ 'description': self._Description,
294
+ 'external_urls': externalUrls,
295
+ 'href': self._Href,
296
+ 'id': self._Id,
297
+ 'image_url': self.ImageUrl,
298
+ 'images': [ item.ToDictionary() for item in self._Images ],
299
+ 'name': self._Name,
300
+ 'owner': owner,
301
+ 'public': self._Public,
302
+ 'snapshotId': self._SnapshotId,
303
+ 'tracks': tracks,
304
+ 'type': self._Type,
305
+ 'uri': self._Uri,
306
+ }
307
+ return result
308
+
309
+
310
+ def ToString(self, includeTitle:bool=True) -> str:
311
+ """
312
+ Returns a displayable string representation of the class.
313
+
314
+ Args:
315
+ includeTitle (str):
316
+ True to include the class name title prefix.
317
+ """
318
+ msg:str = ''
319
+ if includeTitle:
320
+ msg = 'PlaylistSimplified:'
321
+
322
+ if self._Name is not None: msg = '%s\n Name="%s"' % (msg, str(self._Name))
323
+ if self._Uri is not None: msg = '%s\n Uri="%s"' % (msg, str(self._Uri))
324
+ if self._Collaborative is not None: msg = '%s\n Collaborative="%s"' % (msg, str(self._Collaborative))
325
+ if self._Description is not None: msg = '%s\n Description="%s"' % (msg, str(self._Description))
326
+ #if self._ExternalUrls is not None: msg = '%s\n %s' % (msg, str(self._ExternalUrls))
327
+ if self._Href is not None: msg = '%s\n Href="%s"' % (msg, str(self._Href))
328
+ if self._Id is not None: msg = '%s\n Id="%s"' % (msg, str(self._Id))
329
+ if self._Images is not None: msg = '%s\n Images Count=%s' % (msg, str(len(self._Images)))
330
+ if self._Owner is not None: msg = '%s\n Owner="%s"' % (msg, str(self._Owner.Uri))
331
+ if self._Public is not None: msg = '%s\n Public="%s"' % (msg, str(self._Public))
332
+ if self._SnapshotId is not None: msg = '%s\n SnapshotId="%s"' % (msg, str(self._SnapshotId))
333
+ if self._Type is not None: msg = '%s\n Type="%s"' % (msg, str(self._Type))
334
+ return msg
@@ -0,0 +1,143 @@
1
+ # external package imports.
2
+
3
+ # our package imports.
4
+ from ..sautils import export
5
+ from .owner import Owner
6
+ from .track import Track
7
+
8
+ @export
9
+ class PlaylistTrack:
10
+ """
11
+ Spotify Web API PlaylistTrack 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
+ self._AddedAt:str = None
24
+ self._AddedBy:Owner = None
25
+ self._IsLocal:bool = None
26
+ self._Track:Track = None
27
+
28
+ if (root is None):
29
+
30
+ pass
31
+
32
+ else:
33
+
34
+ self._AddedAt = root.get('added_at', None)
35
+ self._IsLocal = root.get('is_local', None)
36
+
37
+ # process all collections and objects.
38
+ item:dict = root.get('added_by',None)
39
+ if item is not None:
40
+ self._AddedBy = Owner(root=item)
41
+
42
+ item:dict = root.get('track',None)
43
+ if item is not None:
44
+ self._Track = Track(root=item)
45
+
46
+
47
+ def __repr__(self) -> str:
48
+ return self.ToString()
49
+
50
+
51
+ def __str__(self) -> str:
52
+ return self.ToString()
53
+
54
+
55
+ @property
56
+ def AddedAt(self) -> str:
57
+ """
58
+ The date and time the track or episode was added.
59
+
60
+ Note: some very old playlists may return null in this field.
61
+ """
62
+ return self._AddedAt
63
+
64
+
65
+ @property
66
+ def AddedBy(self) -> Owner:
67
+ """
68
+ The Spotify user who added the track or episode.
69
+
70
+ Note: some very old playlists may return null in this field.
71
+ """
72
+ return self._AddedBy
73
+
74
+
75
+ @property
76
+ def ImageUrl(self) -> str:
77
+ """
78
+ Gets the first image url in the underlying track album `Images` list, if images are defined;
79
+ otherwise, null.
80
+ """
81
+ if self._Track is not None:
82
+ if self._Track.Album is not None:
83
+ return self._Track.Album.ImageUrl
84
+ return None
85
+
86
+
87
+ @property
88
+ def IsLocal(self) -> bool:
89
+ """
90
+ Whether this track or episode is a local file (True) or not False).
91
+ """
92
+ return self._IsLocal
93
+
94
+
95
+ @property
96
+ def Track(self) -> Track:
97
+ """
98
+ Information about the track.
99
+ """
100
+ return self._Track
101
+
102
+
103
+ def ToDictionary(self) -> dict:
104
+ """
105
+ Returns a dictionary representation of the class.
106
+ """
107
+ addedBy:dict = {}
108
+ if self._AddedBy is not None:
109
+ addedBy = self._AddedBy.ToDictionary()
110
+
111
+ track:dict = {}
112
+ if self._Track is not None:
113
+ track = self._Track.ToDictionary()
114
+
115
+ result:dict = \
116
+ {
117
+ 'added_at': self._AddedAt,
118
+ 'added_by': addedBy,
119
+ 'image_url': self.ImageUrl,
120
+ 'is_local': self._IsLocal,
121
+ 'track': track
122
+ }
123
+ return result
124
+
125
+
126
+ def ToString(self, includeItems:bool=False) -> str:
127
+ """
128
+ Returns a displayable string representation of the class.
129
+
130
+ Args:
131
+ includeItems (bool):
132
+ True to include the Items collection of objects; otherwise, False
133
+ to only return base properties.
134
+ """
135
+ msg:str = 'PlaylistTrack:'
136
+ if self._AddedAt is not None: msg = '%s\n AddedAt="%s"' % (msg, str(self._AddedAt))
137
+ if self._AddedBy is not None: msg = '%s\n AddedBy="%s"' % (msg, str(self._AddedBy.Uri))
138
+ if self._IsLocal is not None: msg = '%s\n IsLocal="%s"' % (msg, str(self._IsLocal))
139
+
140
+ if (includeItems):
141
+ if self._Track is not None: msg = '%s\n %s' % (msg, str(self._Track))
142
+
143
+ return msg
@@ -0,0 +1,80 @@
1
+ # external package imports.
2
+
3
+ # our package imports.
4
+ from ..sautils import export
5
+
6
+ @export
7
+ class PlaylistTrackSummary:
8
+ """
9
+ Spotify Web API PlaylistTrackSummary 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
+ self._Href:str = None
22
+ self._Total:int = None
23
+
24
+ if (root is None):
25
+
26
+ # if not building the class from json response, then initialize various properties as
27
+ # the playlist is probably being built manually.
28
+ self._Total = 0
29
+
30
+ else:
31
+
32
+ self._Href = root.get('href', None)
33
+ self._Total = root.get('total', None)
34
+
35
+
36
+ def __repr__(self) -> str:
37
+ return self.ToString()
38
+
39
+
40
+ def __str__(self) -> str:
41
+ return self.ToString()
42
+
43
+
44
+ @property
45
+ def Href(self) -> str:
46
+ """
47
+ A link to the Web API endpoint where full details of the playlist's
48
+ tracks can be retrieved.
49
+ """
50
+ return self._Href
51
+
52
+
53
+ @property
54
+ def Total(self) -> int:
55
+ """
56
+ Number of tracks in the playlist.
57
+ """
58
+ return self._Total
59
+
60
+
61
+ def ToDictionary(self) -> dict:
62
+ """
63
+ Returns a dictionary representation of the class.
64
+ """
65
+ result:dict = \
66
+ {
67
+ 'href': self._Href,
68
+ 'total': self._Total,
69
+ }
70
+ return result
71
+
72
+
73
+ def ToString(self) -> str:
74
+ """
75
+ Returns a displayable string representation of the class.
76
+ """
77
+ msg:str = 'PlaylistTrackSummary:'
78
+ if self._Href is not None: msg = '%s\n Href="%s"' % (msg, str(self._Href))
79
+ if self._Total is not None: msg = '%s\n Total="%s"' % (msg, str(self._Total))
80
+ return msg
@@ -0,0 +1,135 @@
1
+ # external package imports.
2
+
3
+ # our package imports.
4
+ from ..sautils import export
5
+
6
+ @export
7
+ class RecommendationSeed:
8
+ """
9
+ Spotify Web API Content RecommendationSeed object.
10
+
11
+ Contains information about recommended tracks.
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
+ self._AfterFilteringSize:int = 0
24
+ self._AfterRelinkingSize:int = 0
25
+ self._Href:str = None
26
+ self._Id:str = None
27
+ self._InitialPoolSize:int = 0
28
+ self._Type:str = None
29
+
30
+ if (root is None):
31
+
32
+ pass
33
+
34
+ else:
35
+
36
+ self._AfterFilteringSize = root.get('afterFilteringSize', 0)
37
+ self._AfterRelinkingSize = root.get('afterRelinkingSize', 0)
38
+ self._Href = root.get('href', None)
39
+ self._Id = root.get('id', None)
40
+ self._InitialPoolSize = root.get('initialPoolSize', 0)
41
+ self._Type = root.get('type', None)
42
+
43
+
44
+ def __repr__(self) -> str:
45
+ return self.ToString()
46
+
47
+
48
+ def __str__(self) -> str:
49
+ return self.ToString()
50
+
51
+
52
+ @property
53
+ def AfterFilteringSize(self) -> int:
54
+ """
55
+ The number of tracks available after min_* and max_* filters have been applied.
56
+ """
57
+ return self._AfterFilteringSize
58
+
59
+
60
+ @property
61
+ def AfterRelinkingSize(self) -> int:
62
+ """
63
+ The number of tracks available after relinking for regional availability.
64
+ """
65
+ return self._AfterRelinkingSize
66
+
67
+
68
+ @property
69
+ def Href(self) -> str:
70
+ """
71
+ A link to the full track or artist data for this seed.
72
+
73
+ For tracks this will be a link to a Track Object.
74
+ For artists a link to an Artist Object.
75
+ For genre seeds, this value will be null.
76
+ """
77
+ return self._Href
78
+
79
+
80
+ @property
81
+ def Id(self) -> str:
82
+ """
83
+ The id used to select this seed.
84
+
85
+ This will be the same as the string used in the seedArtists, seedTracks or seedGenres parameter.
86
+ """
87
+ return self._Id
88
+
89
+
90
+ @property
91
+ def InitialPoolSize(self) -> int:
92
+ """
93
+ The number of recommended tracks available for this seed.
94
+ """
95
+ return self._InitialPoolSize
96
+
97
+
98
+ @property
99
+ def Type(self) -> str:
100
+ """
101
+ The entity type of this seed.
102
+
103
+ One of `artist`, `track` or `genre`.
104
+ """
105
+ return self._Type
106
+
107
+
108
+ def ToDictionary(self) -> dict:
109
+ """
110
+ Returns a dictionary representation of the class.
111
+ """
112
+ result:dict = \
113
+ {
114
+ 'after_filtering_size': self._AfterFilteringSize,
115
+ 'after_relinking_size': self._AfterRelinkingSize,
116
+ 'href': self._Href,
117
+ 'id': self._Id,
118
+ 'initial_pool_size': self._InitialPoolSize,
119
+ 'type': self._Type,
120
+ }
121
+ return result
122
+
123
+
124
+ def ToString(self) -> str:
125
+ """
126
+ Returns a displayable string representation of the class.
127
+ """
128
+ msg:str = 'RecommendationSeed:'
129
+ if self._AfterFilteringSize is not None: msg = '%s\n AfterFilteringSize="%s"' % (msg, str(self._AfterFilteringSize))
130
+ if self._AfterRelinkingSize is not None: msg = '%s\n AfterRelinkingSize="%s"' % (msg, str(self._AfterRelinkingSize))
131
+ if self._Href is not None: msg = '%s\n Href="%s"' % (msg, str(self._Href))
132
+ if self._Id is not None: msg = '%s\n Id="%s"' % (msg, str(self._Id))
133
+ if self._InitialPoolSize is not None: msg = '%s\n InitialPoolSize="%s"' % (msg, str(self._InitialPoolSize))
134
+ if self._Type is not None: msg = '%s\n Type="%s"' % (msg, str(self._Type))
135
+ return msg