spotifywebapiPython 1.0.35__py3-none-any.whl → 1.0.147__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.

Potentially problematic release.


This version of spotifywebapiPython might be problematic. Click here for more details.

Files changed (91) hide show
  1. {spotifywebapiPython-1.0.35.dist-info → spotifywebapiPython-1.0.147.dist-info}/LICENSE +1 -1
  2. {spotifywebapiPython-1.0.35.dist-info → spotifywebapiPython-1.0.147.dist-info}/METADATA +7 -6
  3. spotifywebapiPython-1.0.147.dist-info/RECORD +117 -0
  4. spotifywebapipython/__init__.py +2 -0
  5. spotifywebapipython/const.py +19 -1
  6. spotifywebapipython/docs/__init__.html +799 -3
  7. spotifywebapipython/docs/index.html +21 -3
  8. spotifywebapipython/docs/search.js +1 -1
  9. spotifywebapipython/docs/{spotifywebapiPython → spotifywebapipython}/const.html +72 -4
  10. spotifywebapipython/docs/{spotifywebapiPython → spotifywebapipython}/saappmessages.html +77 -3
  11. spotifywebapipython/docs/{spotifywebapiPython → spotifywebapipython}/sautils.html +63 -3
  12. spotifywebapipython/docs/{spotifywebapiPython → spotifywebapipython}/spotifyapierror.html +3 -3
  13. spotifywebapipython/docs/{spotifywebapiPython → spotifywebapipython}/spotifyapimessage.html +20 -3
  14. spotifywebapipython/docs/{spotifywebapiPython → spotifywebapipython}/spotifyauthtoken.html +39 -3
  15. spotifywebapipython/docs/{spotifywebapiPython → spotifywebapipython}/spotifyclient.html +2553 -364
  16. spotifywebapipython/docs/{spotifywebapiPython → spotifywebapipython}/spotifydiscovery.html +85 -52
  17. spotifywebapipython/docs/{spotifywebapiPython → spotifywebapipython}/spotifywebapiauthenticationerror.html +3 -3
  18. spotifywebapipython/docs/{spotifywebapiPython → spotifywebapipython}/spotifywebapierror.html +3 -3
  19. spotifywebapipython/models/__init__.py +8 -0
  20. spotifywebapipython/models/albumpagesaved.py +2 -1
  21. spotifywebapipython/models/albumpagesimplified.py +2 -1
  22. spotifywebapipython/models/albumsimplified.py +4 -5
  23. spotifywebapipython/models/artist.py +4 -5
  24. spotifywebapipython/models/artistinfo.py +282 -0
  25. spotifywebapipython/models/artistinfotourevent.py +127 -0
  26. spotifywebapipython/models/artistpage.py +2 -1
  27. spotifywebapipython/models/artistsimplified.py +4 -0
  28. spotifywebapipython/models/audiobookpagesimplified.py +2 -1
  29. spotifywebapipython/models/audiobooksimplified.py +4 -5
  30. spotifywebapipython/models/category.py +16 -0
  31. spotifywebapipython/models/categorypage.py +2 -1
  32. spotifywebapipython/models/chapterpagesimplified.py +2 -1
  33. spotifywebapipython/models/chaptersimplified.py +6 -7
  34. spotifywebapipython/models/context.py +1 -3
  35. spotifywebapipython/models/device.py +85 -2
  36. spotifywebapipython/models/episodepagesaved.py +2 -1
  37. spotifywebapipython/models/episodepagesimplified.py +2 -1
  38. spotifywebapipython/models/episodesaved.py +2 -2
  39. spotifywebapipython/models/episodesimplified.py +5 -6
  40. spotifywebapipython/models/imageobject.py +98 -0
  41. spotifywebapipython/models/pageobject.py +29 -4
  42. spotifywebapipython/models/playeractions.py +33 -11
  43. spotifywebapipython/models/playerplaystate.py +128 -13
  44. spotifywebapipython/models/playerqueueinfo.py +61 -4
  45. spotifywebapipython/models/playhistorypage.py +2 -1
  46. spotifywebapipython/models/playlist.py +6 -3
  47. spotifywebapipython/models/playlistpage.py +2 -1
  48. spotifywebapipython/models/playlistpagesimplified.py +2 -1
  49. spotifywebapipython/models/playlistsimplified.py +49 -7
  50. spotifywebapipython/models/playlisttrack.py +1 -0
  51. spotifywebapipython/models/playlisttracksummary.py +3 -1
  52. spotifywebapipython/models/searchresponse.py +1 -1
  53. spotifywebapipython/models/showpagesaved.py +2 -1
  54. spotifywebapipython/models/showpagesimplified.py +2 -1
  55. spotifywebapipython/models/showsaved.py +2 -2
  56. spotifywebapipython/models/showsimplified.py +8 -5
  57. spotifywebapipython/models/spotifyconnectdevice.py +188 -0
  58. spotifywebapipython/models/spotifyconnectdevices.py +628 -0
  59. spotifywebapipython/models/track.py +2 -1
  60. spotifywebapipython/models/trackpage.py +42 -1
  61. spotifywebapipython/models/trackpagesaved.py +2 -1
  62. spotifywebapipython/models/trackpagesimplified.py +2 -1
  63. spotifywebapipython/models/trackrecommendations.py +5 -5
  64. spotifywebapipython/models/tracksimplified.py +10 -3
  65. spotifywebapipython/models/userprofile.py +25 -1
  66. spotifywebapipython/models/userprofilesimplified.py +4 -5
  67. spotifywebapipython/models/zeroconfdiscoveryresult.py +599 -0
  68. spotifywebapipython/models/zeroconfproperty.py +93 -0
  69. spotifywebapipython/oauthcli/authclient.py +119 -19
  70. spotifywebapipython/saappmessages.py +21 -1
  71. spotifywebapipython/sautils.py +88 -1
  72. spotifywebapipython/spotifyapimessage.py +18 -1
  73. spotifywebapipython/spotifyauthtoken.py +26 -0
  74. spotifywebapipython/spotifyclient.py +4311 -525
  75. spotifywebapipython/spotifyconnectdeviceeventargs.py +67 -0
  76. spotifywebapipython/spotifydiscovery.py +326 -136
  77. spotifywebapipython/zeroconfapi/__init__.py +23 -0
  78. spotifywebapipython/zeroconfapi/authenticationtypes.py +38 -0
  79. spotifywebapipython/zeroconfapi/blobbuilder.py +370 -0
  80. spotifywebapipython/zeroconfapi/credentials.py +37 -0
  81. spotifywebapipython/zeroconfapi/cryptodiffiehellman.py +89 -0
  82. spotifywebapipython/zeroconfapi/helpers.py +64 -0
  83. spotifywebapipython/zeroconfapi/spotifyzeroconfapierror.py +108 -0
  84. spotifywebapipython/zeroconfapi/zeroconfconnect.py +1315 -0
  85. spotifywebapipython/zeroconfapi/zeroconfgetinfo.py +619 -0
  86. spotifywebapipython/zeroconfapi/zeroconfgetinfoalias.py +105 -0
  87. spotifywebapipython/zeroconfapi/zeroconfgetinfodrmmediaformat.py +90 -0
  88. spotifywebapipython/zeroconfapi/zeroconfresponse.py +141 -0
  89. spotifywebapiPython-1.0.35.dist-info/RECORD +0 -98
  90. {spotifywebapiPython-1.0.35.dist-info → spotifywebapiPython-1.0.147.dist-info}/WHEEL +0 -0
  91. {spotifywebapiPython-1.0.35.dist-info → spotifywebapiPython-1.0.147.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,619 @@
1
+ # external package imports.
2
+
3
+ # our package imports.
4
+ from ..sautils import export
5
+ from .zeroconfgetinfoalias import ZeroconfGetInfoAlias
6
+ from .zeroconfgetinfodrmmediaformat import ZeroconfGetInfoDrmMediaFormat
7
+ from .zeroconfresponse import ZeroconfResponse
8
+
9
+ @export
10
+ class ZeroconfGetInfo(ZeroconfResponse):
11
+ """
12
+ Spotify Zeroconf API GetInfo response object.
13
+ """
14
+
15
+ def __init__(self, root:dict=None) -> None:
16
+ """
17
+ Initializes a new instance of the class.
18
+
19
+ Args:
20
+ root (dict):
21
+ Spotify Web API JSON response in dictionary format, used to load object
22
+ attributes; otherwise, None to not load attributes.
23
+ """
24
+ # initialize base class.
25
+ super().__init__(root=root)
26
+
27
+ # initialize our attributes.
28
+ self._AccountReq:str = None
29
+ self._ActiveUser:str = ""
30
+ self._Aliases:list[ZeroconfGetInfoAlias] = []
31
+ self._Availability:str = ""
32
+ self._BrandDisplayName:str = None
33
+ self._ClientId:str = None
34
+ self._DeviceId:str = None
35
+ self._DeviceType:str = None
36
+ self._GroupStatus:str = None
37
+ self._LibraryVersion:str = None
38
+ self._ModelDisplayName:str = None
39
+ self._ProductId:str = None
40
+ self._PublicKey:str = None
41
+ self._RemoteName:str = None
42
+ self._ResolverVersion:str = None
43
+ self._Scope:str = None
44
+ self._SupportedCapabilities:int = None
45
+ self._SupportedDrmMediaFormats:list[ZeroconfGetInfoDrmMediaFormat] = []
46
+ self._TokenType:str = None
47
+ self._Version:str = None
48
+ self._VoiceSupport:str = None
49
+
50
+ # non-Spotify properties.
51
+ self._IsActiveDevice:bool = None
52
+ self._IsInDeviceList:bool = None
53
+
54
+ if (root is None):
55
+
56
+ pass
57
+
58
+ else:
59
+
60
+ self._AccountReq = root.get('accountReq', None)
61
+ self._ActiveUser = root.get('activeUser', "")
62
+ self._Availability = root.get('availability', "")
63
+ self._BrandDisplayName = root.get('brandDisplayName', None)
64
+ self._ClientId = root.get('clientID', None)
65
+ self._DeviceId = root.get('deviceID', None)
66
+ self._DeviceType = root.get('deviceType', None)
67
+ self._GroupStatus = root.get('groupStatus', None)
68
+ self._LibraryVersion = root.get('libraryVersion', None)
69
+ self._ModelDisplayName = root.get('modelDisplayName', None)
70
+ self._ProductId = root.get('productID', None)
71
+ self._PublicKey = root.get('publicKey', None)
72
+ self._RemoteName = root.get('remoteName', None)
73
+ self._ResolverVersion = root.get('resolverVersion', None)
74
+ self._Scope = root.get('scope', None)
75
+ self._SupportedCapabilities = root.get('supported_capabilities', None)
76
+ self._TokenType = root.get('tokenType', None)
77
+ self._Version = root.get('version', None)
78
+ self._VoiceSupport = root.get('voiceSupport', None)
79
+
80
+ # process all collections and objects.
81
+ #items:list = root.get('aliases', [{ "id":"aliasId","isGroup": False, "name":"aliasName" }]) # simulate an alias value (used for testing).
82
+ items:list = root.get('aliases',None)
83
+ if items is not None:
84
+ for item in items:
85
+ self._Aliases.append(ZeroconfGetInfoAlias(root=item))
86
+
87
+ items:list = root.get('supported_drm_media_formats',None)
88
+ if items is not None:
89
+ for item in items:
90
+ self._SupportedDrmMediaFormats.append(ZeroconfGetInfoDrmMediaFormat(root=item))
91
+
92
+
93
+ def __repr__(self) -> str:
94
+ return self.ToString()
95
+
96
+
97
+ def __str__(self) -> str:
98
+ return self.ToString()
99
+
100
+
101
+ @property
102
+ def AccountReq(self) -> str:
103
+ """
104
+ ? (e.g. "DONTCARE").
105
+ """
106
+ return self._AccountReq
107
+
108
+
109
+ @property
110
+ def ActiveUser(self) -> str:
111
+ """
112
+ Canonical username of the logged in user (e.g. "31l77y2123456789012345678901").
113
+
114
+ This value will be an empty string if there is no user logged into the device.
115
+ """
116
+ return self._ActiveUser
117
+
118
+ @ActiveUser.setter
119
+ def ActiveUser(self, value:str):
120
+ """
121
+ Sets the ActiveUser property value.
122
+ """
123
+ if (isinstance(value, str)) or (value is None):
124
+ self._ActiveUser = value
125
+
126
+
127
+ @property
128
+ def Aliases(self) -> list:
129
+ """
130
+ Device alias information, IF the device supports aliases.
131
+
132
+ Using ZeroConf, it is possible to announce multiple "virtual devices" from a device.
133
+ This allows the eSDK device to expose, for instance, multiroom zones as ZeroConf devices.
134
+
135
+ Device aliases will show up as separate devices in the Spotify app.
136
+
137
+ A maximum of 8 aliases are supported (SP_MAX_DEVICE_ALIASES).
138
+
139
+ Please refer to the `RemoteName` property for more information.
140
+ """
141
+ return self._Aliases
142
+
143
+
144
+ @property
145
+ def Availability(self) -> str:
146
+ """
147
+ The SpZeroConfVars availability field returned by SpZeroConfGetVars.
148
+
149
+ The following are values that I have encountered thus far:
150
+ - "" - Device is available and ready for use.
151
+ - "UNAVAILABLE" - Device is unavailable, and should probably be rebooted.
152
+ - "NOT-LOADED" - Spotify SDK / API is not loaded.
153
+
154
+ The maximum length of the availability string (SP_MAX_AVAILABILITY_LENGTH)
155
+ is 15 characters (not counting terminating NULL).
156
+ """
157
+ return self._Availability
158
+
159
+
160
+ @property
161
+ def BrandDisplayName(self) -> str:
162
+ """
163
+ A UTF-8-encoded brand name of the hardware device, for hardware integrations (e.g. "Bose", "Onkyo", etc).
164
+
165
+ The maximum length of the brand display name (SP_MAX_BRAND_NAME_LENGTH)
166
+ is 32 characters (not counting terminating NULL).
167
+ """
168
+ return self._BrandDisplayName
169
+
170
+ @BrandDisplayName.setter
171
+ def BrandDisplayName(self, value:str):
172
+ """
173
+ Sets the BrandDisplayName property value.
174
+ """
175
+ if (isinstance(value, str)) or (value is None):
176
+ self._BrandDisplayName = value
177
+
178
+
179
+ @property
180
+ def ClientId(self) -> str:
181
+ """
182
+ Client id of the application (e.g. "79ebcb219e8e4e123456789000123456").
183
+
184
+ The maximum length of the client ID value (SP_MAX_CLIENT_ID_LENGTH)
185
+ is 32 characters (not counting terminating NULL).
186
+ """
187
+ return self._ClientId
188
+
189
+
190
+ @property
191
+ def DeviceId(self) -> str:
192
+ """
193
+ Unique device ID used for ZeroConf logins (e.g. "30fbc80e35598f3c242f2120413c943dfd9715fe").
194
+
195
+ The maximum length of the device ID value used for ZeroConf logins (SP_MAX_DEVICE_ID_LENGTH)
196
+ is 64 characters (not counting terminating NULL).
197
+ """
198
+ return self._DeviceId
199
+
200
+ @DeviceId.setter
201
+ def DeviceId(self, value:str):
202
+ """
203
+ Sets the DeviceId property value.
204
+ """
205
+ if (isinstance(value, str)) or (value is None):
206
+ self._DeviceId = value
207
+
208
+
209
+ @property
210
+ def DeviceType(self) -> str:
211
+ """
212
+ Type of the device (e.g. "SPEAKER", "AVR", etc).
213
+
214
+ Can be any of the following `SpDeviceType` devices:
215
+ - Computer Laptop or desktop computer device.
216
+ - Tablet Tablet PC device.
217
+ - Smartphone Smartphone device.
218
+ - Speaker Speaker device.
219
+ - TV Television device.
220
+ - AVR Audio/Video receiver device.
221
+ - STB Set-Top Box device.
222
+ - AudioDongle Audio dongle device.
223
+ - GameConsole Game console device.
224
+ - CastVideo Chromecast Video.
225
+ - CastAudio Chromecast Audio.
226
+ - Automobile Automobile.
227
+ - Smartwatch Smartwatch.
228
+ - Chromebook Chromebook.
229
+
230
+ The maximum length of the device type string (SP_MAX_DEVICE_TYPE_LENGTH)
231
+ is 15 characters (not counting terminating NULL).
232
+ """
233
+ return self._DeviceType
234
+
235
+ @DeviceType.setter
236
+ def DeviceType(self, value:str):
237
+ """
238
+ Sets the DeviceType property value.
239
+ """
240
+ if (isinstance(value, str)) or (value is None):
241
+ self._DeviceType = value
242
+
243
+
244
+ @property
245
+ def GroupStatus(self) -> str:
246
+ """
247
+ The SpZeroConfVars group_status field returned by SpZeroConfGetVars (e.g. "NONE").
248
+
249
+ The maximum length of the group status string (SP_MAX_GROUP_STATUS_LENGTH)
250
+ is 15 characters (not counting terminating NULL).
251
+ """
252
+ return self._GroupStatus
253
+
254
+
255
+ @property
256
+ def HasActiveUser(self) -> bool:
257
+ """
258
+ Returns True if the device has an active user account specified;
259
+ otherwise, False.
260
+ """
261
+ return (self._ActiveUser != "")
262
+
263
+
264
+ @property
265
+ def HasAliases(self) -> bool:
266
+ """
267
+ Returns True if the device has alias entries defined;
268
+ otherwise, False.
269
+ """
270
+ return (len(self._Aliases) > 0)
271
+
272
+
273
+ @property
274
+ def IsAvailable(self) -> bool:
275
+ """
276
+ Returns True if the device is available; otherwise, False.
277
+
278
+ Determination is made based upon the `Availability` property value.
279
+ """
280
+ if (self._Availability is None) or (self._Availability == ""):
281
+ return True
282
+ return False
283
+
284
+
285
+ @property
286
+ def IsBrandSonos(self) -> bool:
287
+ """
288
+ Returns True if the device is a 'Sonos' branded device; otherwise, False.
289
+
290
+ Determination is made based upon the `BrandDisplayName` property value.
291
+ """
292
+ result:bool = False
293
+ if (isinstance(self._BrandDisplayName, str)) and (self._BrandDisplayName.lower().strip() == 'sonos'):
294
+ result = True
295
+ return result
296
+
297
+
298
+ @property
299
+ def LibraryVersion(self) -> str:
300
+ """
301
+ Client library version that processed the Zeroconf action (e.g. "3.88.29-gc4d4bb01").
302
+ """
303
+ return self._LibraryVersion
304
+
305
+
306
+ @property
307
+ def ModelDisplayName(self) -> str:
308
+ """
309
+ A UTF-8-encoded model name of the hardware device, for hardware integrations (e.g. "Soundtouch").
310
+
311
+ The maximum length of the model display name (SP_MAX_MODEL_NAME_LENGTH)
312
+ is 30 characters (not counting terminating NULL).
313
+ """
314
+ return self._ModelDisplayName
315
+
316
+ @ModelDisplayName.setter
317
+ def ModelDisplayName(self, value:str):
318
+ """
319
+ Sets the ModelDisplayName property value.
320
+ """
321
+ if (isinstance(value, str)) or (value is None):
322
+ self._ModelDisplayName = value
323
+
324
+
325
+ @property
326
+ def ProductId(self) -> str:
327
+ """
328
+ An integer enumerating the product for this partner (e.g. 12345).
329
+ """
330
+ return self._ProductId
331
+
332
+ @ProductId.setter
333
+ def ProductId(self, value:str):
334
+ """
335
+ Sets the ProductId property value.
336
+ """
337
+ if (isinstance(value, str)) or (value is None):
338
+ self._ProductId = value
339
+
340
+
341
+ @property
342
+ def PublicKey(self) -> str:
343
+ """
344
+ Public key used in ZeroConf logins (e.g. "G+ZM4irhc...").
345
+
346
+ The maximum length of the public key used in ZeroConf logins (SP_MAX_PUBLIC_KEY_LENGTH)
347
+ is 149 characters (not counting terminating NULL).
348
+ """
349
+ return self._PublicKey
350
+
351
+ @PublicKey.setter
352
+ def PublicKey(self, value:str):
353
+ """
354
+ Sets the PublicKey property value.
355
+ """
356
+ if (isinstance(value, str)) or (value is None):
357
+ self._PublicKey = value
358
+
359
+
360
+ @property
361
+ def RemoteName(self) -> str:
362
+ """
363
+ Name to be displayed for the device (e.g. "BOSE-ST10-1").
364
+
365
+ This value will be null if the response is from a device using device aliases,
366
+ as the displayed name for respective alias is defined in the aliases field.
367
+
368
+ Please refer to the `Aliases` property for more information.
369
+ """
370
+ return self._RemoteName
371
+
372
+ @RemoteName.setter
373
+ def RemoteName(self, value:str):
374
+ """
375
+ Sets the RemoteName property value.
376
+ """
377
+ if (isinstance(value, str)) or (value is None):
378
+ self._RemoteName = value
379
+
380
+
381
+ @property
382
+ def ResolverVersion(self) -> str:
383
+ """
384
+ The SpZeroConfVars resolver_version field returned by SpZeroConfGetVars (e.g. "0").
385
+ """
386
+ return self._ResolverVersion
387
+
388
+
389
+ @property
390
+ def Scope(self) -> str:
391
+ """
392
+ OAuth scope requested when authenticating with the Spotify backend (e.g. "streaming").
393
+
394
+ The maximum length of the token type string (SP_MAX_SCOPE_LENGTH)
395
+ is 64 characters (not counting terminating NULL).
396
+ """
397
+ return self._Scope
398
+
399
+
400
+ @property
401
+ def SupportedCapabilities(self) -> int:
402
+ """
403
+ Bitmasked integer representing list of device capabilities (e.g. 0).
404
+ """
405
+ return self._SupportedCapabilities
406
+
407
+
408
+ @property
409
+ def SupportedDrmMediaFormats(self) -> list:
410
+ """
411
+ The SpZeroConfVars supported_drm_media_formats field returned by SpZeroConfGetVars (e.g. []).
412
+
413
+ A maximum of 8 formats are supported (SP_MAX_SUPPORTED_FORMATS).
414
+ """
415
+ return self._SupportedDrmMediaFormats
416
+
417
+
418
+ @property
419
+ def TokenType(self) -> str:
420
+ """
421
+ Token type provided by the client:
422
+ - "accesstoken" Access token.
423
+ - "authorization_code" OAuth Authorization Code token.
424
+ - "default" Default access token.
425
+
426
+ The maximum length of the token type string (SP_MAX_TOKEN_TYPE_LENGTH)
427
+ is 30 characters (not counting terminating NULL).
428
+ """
429
+ return self._TokenType
430
+
431
+
432
+ @property
433
+ def Version(self) -> str:
434
+ """
435
+ ZeroConf API version number (e.g. "2.10.0").
436
+
437
+ The maximum length of the library version string (SP_MAX_VERSION_LENGTH)
438
+ is 30 characters (not counting terminating NULL).
439
+ """
440
+ return self._Version
441
+
442
+
443
+ @property
444
+ def VoiceSupport(self) -> str:
445
+ """
446
+ Indicates if the device supports voice commands (e.g. "YES").
447
+ """
448
+ return self._VoiceSupport
449
+
450
+
451
+ # non-Spotify properties.
452
+
453
+ @property
454
+ def IsActiveDevice(self) -> bool:
455
+ """
456
+ Returns True if this device is the currently active device;
457
+ otherwise, False.
458
+ """
459
+ return self._IsActiveDevice
460
+
461
+ @IsActiveDevice.setter
462
+ def IsActiveDevice(self, value:bool):
463
+ """
464
+ Sets the IsActiveDevice property value.
465
+ """
466
+ if isinstance(value, bool):
467
+ self._IsActiveDevice = value
468
+
469
+
470
+ @property
471
+ def IsInDeviceList(self) -> bool:
472
+ """
473
+ Returns the status of active device list verification:
474
+ * None - device list verification has not been performed for this device.
475
+ * True - device is a member of the active device list.
476
+ * False - device is NOT a member of the active device list.
477
+ """
478
+ return self._IsInDeviceList
479
+
480
+ @IsInDeviceList.setter
481
+ def IsInDeviceList(self, value:bool):
482
+ """
483
+ Sets the IsInDeviceList property value.
484
+ """
485
+ if isinstance(value, bool):
486
+ self._IsInDeviceList = value
487
+
488
+
489
+ def Equals(self, obj) -> bool:
490
+ """
491
+ Returns true if the specified object instance contains the same argument
492
+ values as our object instance values; otherwise, False.
493
+
494
+ Args:
495
+ obj (ZeroconfGetInfo):
496
+ Object instance to compare.
497
+ """
498
+ result:bool = False
499
+ if (not isinstance(obj, type(self))):
500
+ return result
501
+
502
+ # compare attributes for equality.
503
+ if (self._AccountReq != obj._AccountReq): return result
504
+ if (self._ActiveUser != obj._ActiveUser): return result
505
+ if (self._Availability != obj._Availability): return result
506
+ if (self._BrandDisplayName != obj._BrandDisplayName): return result
507
+ if (self._ClientId != obj._ClientId): return result
508
+ if (self._DeviceId != obj._DeviceId): return result
509
+ if (self._DeviceType != obj._DeviceType): return result
510
+ if (self._GroupStatus != obj._GroupStatus): return result
511
+ if (self._LibraryVersion != obj._LibraryVersion): return result
512
+ if (self._ModelDisplayName != obj._ModelDisplayName): return result
513
+ if (self._ProductId != obj._ProductId): return result
514
+ if (self._PublicKey != obj._PublicKey): return result
515
+ if (self._RemoteName != obj._RemoteName): return result
516
+ if (self._ResolverVersion != obj._ResolverVersion): return result
517
+ if (self._Scope != obj._Scope): return result
518
+ if (self._SupportedCapabilities != obj._SupportedCapabilities): return result
519
+ if (self._TokenType != obj._TokenType): return result
520
+ if (self._Version != obj._Version): return result
521
+ if (self._VoiceSupport != obj._VoiceSupport): return result
522
+
523
+ # don't compare the following:
524
+ # self._Aliases:list[ZeroconfGetInfoAlias] = []
525
+ # self._IsActiveDevice:bool = None
526
+ # self._IsInDeviceList:bool = None
527
+ # self._SupportedDrmMediaFormats:list[ZeroconfGetInfoDrmMediaFormat] = []
528
+
529
+ # objects attributes are equal.
530
+ return True
531
+
532
+
533
+ def ToDictionary(self) -> dict:
534
+ """
535
+ Returns a dictionary representation of the class.
536
+ """
537
+ # get base class result.
538
+ resultBase:dict = super().ToDictionary()
539
+
540
+ # get our attribute results.
541
+ result:dict = \
542
+ {
543
+ 'AccountReq': self._AccountReq,
544
+ 'ActiveUser': self._ActiveUser,
545
+ 'Aliases': [ item.ToDictionary() for item in self._Aliases ],
546
+ 'Availability': self._Availability,
547
+ 'BrandDisplayName': self._BrandDisplayName,
548
+ 'ClientId': self._ClientId,
549
+ 'DeviceId': self._DeviceId,
550
+ 'DeviceType': self._DeviceType,
551
+ 'GroupStatus': self._GroupStatus,
552
+ 'LibraryVersion': self._LibraryVersion,
553
+ 'ModelDisplayName': self._ModelDisplayName,
554
+ 'ProductId': self._ProductId,
555
+ 'PublicKey': self._PublicKey,
556
+ 'RemoteName': self._RemoteName,
557
+ 'ResolverVersion': self._ResolverVersion,
558
+ 'Scope': self._Scope,
559
+ 'SupportedCapabilities': self._SupportedCapabilities,
560
+ 'SupportedDrmMediaFormats': [ item.ToDictionary() for item in self._SupportedDrmMediaFormats ],
561
+ 'TokenType': self._TokenType,
562
+ 'Version': self._Version,
563
+ 'VoiceSupport': self._VoiceSupport,
564
+ # helper property(s), not part of the Spotify Web API interface:
565
+ 'HasActiveUser': self.HasActiveUser,
566
+ 'HasAliases': self.HasAliases,
567
+ 'IsAvailable': self.IsAvailable,
568
+ 'IsBrandSonos': self.IsBrandSonos,
569
+ 'IsActiveDevice': self._IsActiveDevice,
570
+ 'IsInDeviceList': self._IsInDeviceList,
571
+ }
572
+
573
+ # combine base class results with these results.
574
+ resultBase.update(result)
575
+
576
+ # return an unsorted dictionary.
577
+ return resultBase
578
+
579
+
580
+ def ToString(self, includeTitle:bool=True) -> str:
581
+ """
582
+ Returns a displayable string representation of the class.
583
+
584
+ Args:
585
+ includeTitle (str):
586
+ True to include the class name title prefix.
587
+ """
588
+ msg:str = ''
589
+ if includeTitle:
590
+ msg = 'ZeroconfGetInfo: '
591
+
592
+ # get base class result.
593
+ msg = '%s%s' % (msg, super().ToString(False))
594
+
595
+ # get our attribute results.
596
+ if self._AccountReq is not None: msg = '%s\n AccountReq="%s"' % (msg, str(self._AccountReq))
597
+ if self._ActiveUser is not None: msg = '%s\n ActiveUser="%s"' % (msg, str(self._ActiveUser))
598
+ if self._Aliases is not None: msg = '%s\n Aliases=%s' % (msg, str(self._Aliases))
599
+ if self._Availability is not None: msg = '%s\n Availability="%s"' % (msg, str(self._Availability))
600
+ if self._BrandDisplayName is not None: msg = '%s\n BrandDisplayName="%s"' % (msg, str(self._BrandDisplayName))
601
+ if self._ClientId is not None: msg = '%s\n ClientId="%s"' % (msg, str(self._ClientId))
602
+ if self._DeviceId is not None: msg = '%s\n DeviceId="%s"' % (msg, str(self._DeviceId))
603
+ if self._DeviceType is not None: msg = '%s\n DeviceType="%s"' % (msg, str(self._DeviceType))
604
+ if self._GroupStatus is not None: msg = '%s\n GroupStatus="%s"' % (msg, str(self._GroupStatus))
605
+ if self._LibraryVersion is not None: msg = '%s\n LibraryVersion="%s"' % (msg, str(self._LibraryVersion))
606
+ if self._ModelDisplayName is not None: msg = '%s\n ModelDisplayName="%s"' % (msg, str(self._ModelDisplayName))
607
+ if self._ProductId is not None: msg = '%s\n ProductId="%s"' % (msg, str(self._ProductId))
608
+ if self._PublicKey is not None: msg = '%s\n PublicKey="%s"' % (msg, str(self._PublicKey))
609
+ if self._RemoteName is not None: msg = '%s\n RemoteName="%s"' % (msg, str(self._RemoteName))
610
+ if self._ResolverVersion is not None: msg = '%s\n ResolverVersion="%s"' % (msg, str(self._ResolverVersion))
611
+ if self._Scope is not None: msg = '%s\n Scope="%s"' % (msg, str(self._Scope))
612
+ if self._SupportedCapabilities is not None: msg = '%s\n SupportedCapabilities="%s"' % (msg, str(self._SupportedCapabilities))
613
+ if self._SupportedDrmMediaFormats is not None: msg = '%s\n SupportedDrmMediaFormats=%s' % (msg, str(self._SupportedDrmMediaFormats))
614
+ if self._TokenType is not None: msg = '%s\n TokenType="%s"' % (msg, str(self._TokenType))
615
+ if self._Version is not None: msg = '%s\n Version="%s"' % (msg, str(self._Version))
616
+ if self._VoiceSupport is not None: msg = '%s\n VoiceSupport="%s"' % (msg, str(self._VoiceSupport))
617
+ if self._IsActiveDevice is not None: msg = '%s\n IsActiveDevice="%s"' % (msg, str(self._IsActiveDevice))
618
+ if self._IsInDeviceList is not None: msg = '%s\n IsInDeviceList="%s"' % (msg, str(self._IsInDeviceList))
619
+ return msg