spotifywebapiPython 1.0.36__py3-none-any.whl → 1.0.148__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.36.dist-info → spotifywebapiPython-1.0.148.dist-info}/LICENSE +1 -1
  2. {spotifywebapiPython-1.0.36.dist-info → spotifywebapiPython-1.0.148.dist-info}/METADATA +7 -6
  3. spotifywebapiPython-1.0.148.dist-info/RECORD +117 -0
  4. spotifywebapipython/__init__.py +2 -0
  5. spotifywebapipython/const.py +19 -1
  6. spotifywebapipython/docs/__init__.html +796 -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 +4302 -516
  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.36.dist-info/RECORD +0 -98
  90. {spotifywebapiPython-1.0.36.dist-info → spotifywebapiPython-1.0.148.dist-info}/WHEEL +0 -0
  91. {spotifywebapiPython-1.0.36.dist-info → spotifywebapiPython-1.0.148.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,599 @@
1
+ # external package imports.
2
+ from zeroconf import ServiceInfo
3
+
4
+ # our package imports.
5
+ from ..sautils import export
6
+ from .zeroconfproperty import ZeroconfProperty
7
+
8
+ @export
9
+ class ZeroconfDiscoveryResult:
10
+ """
11
+ Zeroconf Discovery Result object.
12
+
13
+ Information about the Zeroconf entry for a SpotifyConnect device as found by Zeroconf (mDNS).
14
+ """
15
+
16
+ def __init__(self) -> None:
17
+ """
18
+ Initializes a new instance of the class.
19
+ """
20
+ self._DeviceName:str = None
21
+ self._Domain:str = '.'
22
+ self._HostIpAddresses:list = []
23
+ self._HostIpPort:int = None
24
+ self._HostTTL:int = None
25
+ self._IsChromeCast:bool = False
26
+ self._Id:str = None
27
+ self._Key:str = None
28
+ self._Name:str = None
29
+ self._OtherTTL:int = None
30
+ self._Priority:int = None
31
+ self._Properties:list = []
32
+ self._Server:str = None
33
+ self._ServerKey:str = None
34
+ self._ServiceInfo:ServiceInfo = None
35
+ self._ServiceType:str = None
36
+ self._Weight:int = None
37
+
38
+ # Spotify Connect specific properties:
39
+ self._SpotifyConnectCPath:str = None
40
+ self._SpotifyConnectVersion:str = None
41
+ self._SpotifyConnectIsInDeviceList:bool = False
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 Description(self) -> bool:
54
+ """
55
+ Returns a basic description of the device, and how source info was obtained.
56
+
57
+ This is a helper property, and not part of the Zeroconf ServiceInfo result.
58
+ """
59
+ result:str = "Spotify Connect Zeroconf Device"
60
+ if (self.IsChromeCast):
61
+ result = "Chromecast Zeroconf Device"
62
+ elif (self.IsDynamicDevice):
63
+ result = "Dynamic Device"
64
+ return result
65
+
66
+
67
+ @property
68
+ def DeviceName(self) -> str:
69
+ """
70
+ Device name (e.g. "Bose-ST10-1").
71
+ """
72
+ return self._DeviceName
73
+
74
+ @DeviceName.setter
75
+ def DeviceName(self, value:str):
76
+ """
77
+ Sets the DeviceName property value.
78
+ """
79
+ if isinstance(value, str):
80
+ self._DeviceName = value
81
+
82
+
83
+ @property
84
+ def Domain(self) -> str:
85
+ """
86
+ Domain on which the service is located, which should match the one passed in during the query (e.g. "local.").
87
+ """
88
+ return self._Domain
89
+
90
+ @Domain.setter
91
+ def Domain(self, value:str):
92
+ """
93
+ Sets the Domain property value.
94
+ """
95
+ if isinstance(value, str):
96
+ self._Domain = value
97
+
98
+
99
+ @property
100
+ def HostIpAddress(self) -> str:
101
+ """
102
+ IP address at which the host can be reached (e.g. "192.168.1.81").
103
+
104
+ This value may also contain a DNS alias, if no IP addresses were discovered
105
+ for the device. This is very rare, but possible.
106
+ """
107
+ # return server alias by default.
108
+ result:str = self._Server
109
+
110
+ # if ip addresses present, then return the first one that was detected.
111
+ # note that addresses are in LIFO order as detected by zeroconf discovery.
112
+ if (len(self._HostIpAddresses) > 0):
113
+ result = self._HostIpAddresses[len(self._HostIpAddresses) - 1]
114
+
115
+ return result
116
+
117
+ @HostIpAddress.setter
118
+ def HostIpAddress(self, value:str):
119
+ """
120
+ Sets the HostIpAddress property value.
121
+ """
122
+ if isinstance(value, str):
123
+
124
+ # if ip addresses present, then update the first one that was detected
125
+ # as it is the address referenced by the `HostIpAddress` get method.
126
+ # note that addresses are in LIFO order as detected by zeroconf discovery.
127
+ if (len(self._HostIpAddresses) > 0):
128
+ self._HostIpAddresses[len(self._HostIpAddresses) - 1] = value
129
+
130
+
131
+ @property
132
+ def HostIpAddresses(self) -> list:
133
+ """
134
+ IP address(es) at which the host can be reached (e.g. ["192.168.1.81", "172.30.32.1"]).
135
+
136
+ Note that this value can contain multiple addresses.
137
+ """
138
+ return self._HostIpAddresses
139
+
140
+ @HostIpAddresses.setter
141
+ def HostIpAddresses(self, value:list):
142
+ """
143
+ Sets the HostIpAddresses property value.
144
+ """
145
+ if value is not None:
146
+ if isinstance(value, list):
147
+ self._HostIpAddresses = value
148
+
149
+
150
+ @property
151
+ def HostIpPort(self) -> int:
152
+ """
153
+ Port number (as an integer) for the service on the host (e.g. 8080).
154
+ """
155
+ return self._HostIpPort
156
+
157
+ @HostIpPort.setter
158
+ def HostIpPort(self, value:int):
159
+ """
160
+ Sets the HostIpPort property value.
161
+ """
162
+ if isinstance(value, int):
163
+ self._HostIpPort = value
164
+
165
+
166
+ @property
167
+ def HostTTL(self) -> int:
168
+ """
169
+ Host Time-To-Live value (as an integer) for the service on the host (e.g. 1200).
170
+ """
171
+ return self._HostTTL
172
+
173
+ @HostTTL.setter
174
+ def HostTTL(self, value:int):
175
+ """
176
+ Sets the HostTTL property value.
177
+ """
178
+ if isinstance(value, int):
179
+ self._HostTTL = value
180
+
181
+
182
+ @property
183
+ def Id(self) -> str:
184
+ """
185
+ Result ID (e.g. "Bose-ST10-1" (192.168.1.81:8200)).
186
+
187
+ This is a helper property, and not part of the Zeroconf interface.
188
+ """
189
+ return self._Id
190
+
191
+ @Id.setter
192
+ def Id(self, value:str):
193
+ """
194
+ Sets the Id property value.
195
+ """
196
+ if isinstance(value, str):
197
+ self._Id = value
198
+
199
+
200
+ @property
201
+ def IsDynamicDevice(self) -> bool:
202
+ """
203
+ Returns True if the device is a dynamic device;
204
+ otherwise, False.
205
+
206
+ Dynamic devices are Spotify Connect devices that are not found in Zeroconf discovery
207
+ process, but still exist in the player device list. These are usually Spotify Connect
208
+ web or mobile players with temporary device id's.
209
+ """
210
+ return (self._HostIpPort == 0) and (self._ServiceType is None)
211
+
212
+
213
+ @property
214
+ def IsChromeCast(self) -> bool:
215
+ """
216
+ True if the device is a Google ChromeCast device; otherwise, False.
217
+ """
218
+ return self._IsChromeCast
219
+
220
+ @IsChromeCast.setter
221
+ def IsChromeCast(self, value:bool):
222
+ """
223
+ Sets the IsChromeCast property value.
224
+ """
225
+ if isinstance(value, bool):
226
+ self._IsChromeCast = value
227
+
228
+
229
+ @property
230
+ def Key(self) -> str:
231
+ """
232
+ Service key (e.g. "bose-st10-2._spotify-connect._tcp.local.").
233
+ """
234
+ return self._Key
235
+
236
+ @Key.setter
237
+ def Key(self, value:str):
238
+ """
239
+ Sets the Key property value.
240
+ """
241
+ if isinstance(value, str):
242
+ self._Key = value
243
+
244
+
245
+ @property
246
+ def Name(self) -> str:
247
+ """
248
+ Service name (e.g. "Bose-ST10-2._spotify-connect._tcp.local.").
249
+ """
250
+ return self._Name
251
+
252
+ @Name.setter
253
+ def Name(self, value:str):
254
+ """
255
+ Sets the Name property value.
256
+ """
257
+ if isinstance(value, str):
258
+ self._Name = value
259
+
260
+
261
+ @property
262
+ def Priority(self) -> int:
263
+ """
264
+ Priority value (as an integer) for the service on the host (e.g. 0).
265
+ """
266
+ return self._Priority
267
+
268
+ @Priority.setter
269
+ def Priority(self, value:int):
270
+ """
271
+ Sets the Priority property value.
272
+ """
273
+ if isinstance(value, int):
274
+ self._Priority = value
275
+
276
+
277
+ @property
278
+ def OtherTTL(self) -> int:
279
+ """
280
+ Other Time-To-Live value (as an integer) for the service on the host (e.g. 5400).
281
+ """
282
+ return self._OtherTTL
283
+
284
+ @OtherTTL.setter
285
+ def OtherTTL(self, value:int):
286
+ """
287
+ Sets the OtherTTL property value.
288
+ """
289
+ if isinstance(value, int):
290
+ self._OtherTTL = value
291
+
292
+
293
+ @property
294
+ def Properties(self) -> list[ZeroconfProperty]:
295
+ """
296
+ Discovered properties.
297
+ """
298
+ return self._Properties
299
+
300
+
301
+ @property
302
+ def Server(self) -> str:
303
+ """
304
+ Server name (e.g. "Bose-SM2-341513fbeeae.local.").
305
+ """
306
+ return self._Server
307
+
308
+ @Server.setter
309
+ def Server(self, value:str):
310
+ """
311
+ Sets the Server property value.
312
+ """
313
+ if isinstance(value, str):
314
+ self._Server = value
315
+
316
+
317
+ @property
318
+ def ServerKey(self) -> str:
319
+ """
320
+ Server key (e.g. "bose-sm2-341513fbeeae.local.").
321
+ """
322
+ return self._ServerKey
323
+
324
+ @ServerKey.setter
325
+ def ServerKey(self, value:str):
326
+ """
327
+ Sets the ServerKey property value.
328
+ """
329
+ if isinstance(value, str):
330
+ self._ServerKey = value
331
+
332
+
333
+ @property
334
+ def ServiceInfo(self) -> ServiceInfo:
335
+ """
336
+ Zeroconf Service info object.
337
+ """
338
+ return self._ServiceInfo
339
+
340
+ @ServiceInfo.setter
341
+ def ServiceInfo(self, value:ServiceInfo):
342
+ """
343
+ Sets the ServiceInfo property value.
344
+ """
345
+ if isinstance(value, ServiceInfo):
346
+ self._ServiceInfo = value
347
+
348
+
349
+ @property
350
+ def ServiceType(self) -> str:
351
+ """
352
+ Service type, which should match the one passed in during the query name (e.g. "_spotify-connect._tcp.").
353
+ """
354
+ return self._ServiceType
355
+
356
+ @ServiceType.setter
357
+ def ServiceType(self, value:str):
358
+ """
359
+ Sets the ServiceType property value.
360
+ """
361
+ if isinstance(value, str):
362
+ self._ServiceType = value
363
+
364
+
365
+ @property
366
+ def Weight(self) -> int:
367
+ """
368
+ Weight value (as an integer) for the service on the host (e.g. 0).
369
+ """
370
+ return self._Weight
371
+
372
+ @Weight.setter
373
+ def Weight(self, value:int):
374
+ """
375
+ Sets the Weight property value.
376
+ """
377
+ if isinstance(value, int):
378
+ self._Weight = value
379
+
380
+ # *****************************************************************************
381
+ # The following are Spotify Connect specific properties.
382
+ # *****************************************************************************
383
+
384
+ @property
385
+ def SpotifyConnectCPath(self) -> str:
386
+ """
387
+ Spotify Connect CPath property value (e.g. "/zc").
388
+ """
389
+ return self._SpotifyConnectCPath
390
+
391
+ @SpotifyConnectCPath.setter
392
+ def SpotifyConnectCPath(self, value:str):
393
+ """
394
+ Sets the SpotifyConnectCPath property value.
395
+ """
396
+ if isinstance(value, str):
397
+ self._SpotifyConnectCPath = value
398
+
399
+
400
+ @property
401
+ def SpotifyConnectIsInDeviceList(self) -> bool:
402
+ """
403
+ True if the device is in the Spotify Player active device list; otherwise, False.
404
+ """
405
+ return self._SpotifyConnectIsInDeviceList
406
+
407
+ @SpotifyConnectIsInDeviceList.setter
408
+ def SpotifyConnectIsInDeviceList(self, value:bool):
409
+ """
410
+ Sets the SpotifyConnectIsInDeviceList property value.
411
+ """
412
+ if isinstance(value, bool):
413
+ self._SpotifyConnectIsInDeviceList = value
414
+
415
+
416
+ @property
417
+ def SpotifyConnectVersion(self) -> str:
418
+ """
419
+ Spotify Connect Version property value (e.g. null, "1.0").
420
+
421
+ """
422
+ return self._SpotifyConnectVersion
423
+
424
+ @SpotifyConnectVersion.setter
425
+ def SpotifyConnectVersion(self, value:str):
426
+ """
427
+ Sets the SpotifyConnectVersion property value.
428
+ """
429
+ if (isinstance(value, str)) or (value is None):
430
+ self._SpotifyConnectVersion = value
431
+
432
+
433
+ @property
434
+ def ZeroconfApiEndpointAddUser(self) -> str:
435
+ """
436
+ Zeroconf API endpoint to add a user to a Spotify Connect device (e.g. "http://192.168.1.81:8200/zc?action=addUser&version=2.10.0").
437
+ """
438
+ return self.GetEndpointUrl('addUser')
439
+
440
+
441
+ @property
442
+ def ZeroconfApiEndpointGetInformation(self) -> str:
443
+ """
444
+ Zeroconf API endpoint to retrieve device information for a Spotify Connect device (e.g. "http://192.168.1.81:8200/zc?action=getInfo&version=2.10.0").
445
+ """
446
+ return self.GetEndpointUrl('getInfo')
447
+
448
+
449
+ @property
450
+ def ZeroconfApiEndpointResetUsers(self) -> str:
451
+ """
452
+ Zeroconf API endpoint to reset users (e.g. Logoff) currently active on a Spotify Connect device (e.g. "http://192.168.1.81:8200/zc?action=resetUsers&version=2.10.0").
453
+ """
454
+ return self.GetEndpointUrl('resetUsers')
455
+
456
+
457
+ def Equals(self, obj) -> bool:
458
+ """
459
+ Returns true if the specified object instance contains the same argument
460
+ values as our object instance values; otherwise, False.
461
+
462
+ Args:
463
+ obj (ZeroconfDiscoveryResult):
464
+ Object instance to compare.
465
+ """
466
+ result:bool = False
467
+ if (not isinstance(obj, type(self))):
468
+ return result
469
+
470
+ # compare attributes for equality.
471
+ if (self._DeviceName != obj._DeviceName): return result
472
+ if (self._Domain != obj._Domain): return result
473
+ if (self.HostIpAddress != obj.HostIpAddress): return result
474
+ if (self._HostIpPort != obj._HostIpPort): return result
475
+ if (self._HostTTL != obj._HostTTL): return result
476
+ if (self._IsChromeCast != obj._IsChromeCast): return result
477
+ if (self._Id != obj._Id): return result
478
+ if (self._Key != obj._Key): return result
479
+ if (self._Name != obj._Name): return result
480
+ if (self._OtherTTL != obj._OtherTTL): return result
481
+ if (self._Priority != obj._Priority): return result
482
+ if (self._Server != obj._Server): return result
483
+ if (self._ServerKey != obj._ServerKey): return result
484
+ if (self._ServiceType != obj._ServiceType): return result
485
+ if (self._Weight != obj._Weight): return result
486
+ if (self._SpotifyConnectCPath != obj._SpotifyConnectCPath): return result
487
+ if (self._SpotifyConnectVersion != obj._SpotifyConnectVersion): return result
488
+ if (self._SpotifyConnectIsInDeviceList != obj._SpotifyConnectIsInDeviceList): return result
489
+
490
+ # don't compare the following:
491
+ # self._Properties:list = []
492
+ # self._ServiceInfo:ServiceInfo = None
493
+
494
+ # objects attributes are equal.
495
+ return True
496
+
497
+
498
+ def GetEndpointUrl(self, action:str) -> str:
499
+ """
500
+ Gets a Spotify Zeroconf API endpoint url for the specified action key.
501
+
502
+ Args:
503
+ action (str):
504
+ Spotify Zeroconf endpoint action to formulate (e.g. 'getInfo', 'addUser', 'resetUsers', etc).
505
+
506
+ Returns:
507
+ A string containing the endpoint url for the specified action key.
508
+ """
509
+ return "http://{ip}:{port}{cpath}?action={action}&version={version}".format(
510
+ ip=self.HostIpAddress,
511
+ port=self.HostIpPort,
512
+ cpath=self.SpotifyConnectCPath,
513
+ action=action,
514
+ version=self.SpotifyConnectVersion or ''
515
+ )
516
+
517
+
518
+ def ToDictionary(self) -> dict:
519
+ """
520
+ Returns a dictionary representation of the class.
521
+ """
522
+ result:dict = \
523
+ {
524
+ 'Id': self._Id,
525
+ 'DeviceName': self._DeviceName,
526
+ 'Domain': self._Domain,
527
+ 'HostIpAddress': self.HostIpAddress,
528
+ 'HostIpAddresses': [ str(item) for item in self._HostIpAddresses ],
529
+ 'HostIpPort': self._HostIpPort,
530
+ 'HostTTL': self._HostTTL,
531
+ 'IsDynamicDevice': self.IsDynamicDevice,
532
+ 'IsChromeCast': self._IsChromeCast,
533
+ 'Key': self._Key,
534
+ 'Name': self._Name,
535
+ 'Priority': self._Priority,
536
+ 'OtherTTL': self._OtherTTL,
537
+ 'Server': self._Server,
538
+ 'ServerKey': self._ServerKey,
539
+ 'ServiceType': self._ServiceType,
540
+ 'Weight': self._Weight,
541
+ 'Description': self.Description,
542
+ 'Properties': [ item.ToDictionary() for item in self._Properties ],
543
+ 'SpotifyConnectCPath': self._SpotifyConnectCPath,
544
+ 'SpotifyConnectIsInDeviceList': self._SpotifyConnectIsInDeviceList,
545
+ 'SpotifyConnectVersion': self._SpotifyConnectVersion,
546
+ 'ZeroconfApiEndpointAddUser': self.ZeroconfApiEndpointAddUser,
547
+ 'ZeroconfApiEndpointGetInformation': self.ZeroconfApiEndpointGetInformation,
548
+ 'ZeroconfApiEndpointResetUsers': self.ZeroconfApiEndpointResetUsers,
549
+ }
550
+ return result
551
+
552
+
553
+ def ToString(self, includeTitle:bool=True) -> str:
554
+ """
555
+ Returns a displayable string representation of the class.
556
+
557
+ Args:
558
+ includeTitle (str):
559
+ True to include the class name title prefix.
560
+ """
561
+ msg:str = ''
562
+ if includeTitle:
563
+ msg = 'ZeroconfDiscoveryResult:'
564
+
565
+ # get dynamically generated property values.
566
+ description:str = self.Description
567
+ hostIpAddress:str = self.HostIpAddress
568
+ isDynamicDevice:bool = self.IsDynamicDevice
569
+ zeroconfApiEndpointAddUser:str = self.ZeroconfApiEndpointAddUser
570
+ zeroconfApiEndpointGetInformation:str = self.ZeroconfApiEndpointGetInformation
571
+ zeroconfApiEndpointResetUsers:str = self.ZeroconfApiEndpointResetUsers
572
+
573
+ # build result.
574
+ if self._Id is not None: msg = '%s\n Id="%s"' % (msg, str(self._Id))
575
+ if self._DeviceName is not None: msg = '%s\n DeviceName="%s"' % (msg, str(self._DeviceName))
576
+ if self._Domain is not None: msg = '%s\n Domain="%s"' % (msg, str(self._Domain))
577
+ if self._HostIpAddresses is not None: msg = '%s\n HostIpAddresses Count=%s' % (msg, str(len(self._HostIpAddresses)))
578
+ if hostIpAddress is not None: msg = '%s\n HostIpAddress="%s"' % (msg, str(hostIpAddress))
579
+ if self._HostIpPort is not None: msg = '%s\n HostIpPort="%s"' % (msg, str(self._HostIpPort))
580
+ if self._HostTTL is not None: msg = '%s\n HostTTL="%s"' % (msg, str(self._HostTTL))
581
+ if isDynamicDevice is not None: msg = '%s\n IsDynamicDevice="%s"' % (msg, str(isDynamicDevice))
582
+ if self._IsChromeCast is not None: msg = '%s\n IsChromeCast="%s"' % (msg, str(self._IsChromeCast))
583
+ if self._Key is not None: msg = '%s\n Key="%s"' % (msg, str(self._Key))
584
+ if self._Name is not None: msg = '%s\n Name="%s"' % (msg, str(self._Name))
585
+ if self._Priority is not None: msg = '%s\n Priority="%s"' % (msg, str(self._Priority))
586
+ if self._OtherTTL is not None: msg = '%s\n OtherTTL="%s"' % (msg, str(self._OtherTTL))
587
+ if self._Server is not None: msg = '%s\n Server="%s"' % (msg, str(self._Server))
588
+ if self._ServerKey is not None: msg = '%s\n ServerKey="%s"' % (msg, str(self._ServerKey))
589
+ if self._ServiceType is not None: msg = '%s\n ServiceType="%s"' % (msg, str(self._ServiceType))
590
+ if self._Weight is not None: msg = '%s\n Weight="%s"' % (msg, str(self._Weight))
591
+ if description is not None: msg = '%s\n Description="%s"' % (msg, str(description))
592
+ if self._Properties is not None: msg = '%s\n Properties Count=%s' % (msg, str(len(self._Properties)))
593
+ if self._SpotifyConnectCPath is not None: msg = '%s\n SpotifyConnectCPath="%s"' % (msg, str(self._SpotifyConnectCPath))
594
+ if self._SpotifyConnectIsInDeviceList is not None: msg = '%s\n SpotifyConnectIsInDeviceList="%s"' % (msg, str(self._SpotifyConnectIsInDeviceList))
595
+ if self._SpotifyConnectVersion is not None: msg = '%s\n SpotifyConnectVersion="%s"' % (msg, str(self._SpotifyConnectVersion))
596
+ if zeroconfApiEndpointAddUser is not None: msg = '%s\n ZeroconfApiEndpointAddUser="%s"' % (msg, zeroconfApiEndpointAddUser)
597
+ if zeroconfApiEndpointGetInformation is not None: msg = '%s\n ZeroconfApiEndpointGetInformation="%s"' % (msg, zeroconfApiEndpointGetInformation)
598
+ if zeroconfApiEndpointResetUsers is not None: msg = '%s\n ZeroconfApiEndpointResetUsers="%s"' % (msg, zeroconfApiEndpointResetUsers)
599
+ return msg
@@ -0,0 +1,93 @@
1
+ # external package imports.
2
+
3
+ # our package imports.
4
+ from ..sautils import export
5
+
6
+ @export
7
+ class ZeroconfProperty:
8
+ """
9
+ Zeroconf Property object.
10
+
11
+ Information about a Zeroconf property.
12
+ """
13
+
14
+ def __init__(self, name:str, value:str) -> None:
15
+ """
16
+ Initializes a new instance of the class.
17
+
18
+ Args:
19
+ name (str):
20
+ Property name.
21
+ value (str):
22
+ Property value.
23
+ """
24
+ self._Name:str = name
25
+ self._Value:str = value
26
+
27
+
28
+ def __repr__(self) -> str:
29
+ return self.ToString()
30
+
31
+
32
+ def __str__(self) -> str:
33
+ return self.ToString()
34
+
35
+
36
+ @property
37
+ def Name(self) -> str:
38
+ """
39
+ Property name.
40
+ """
41
+ return self._Name
42
+
43
+ @Name.setter
44
+ def Name(self, value:str):
45
+ """
46
+ Sets the Name property value.
47
+ """
48
+ if isinstance(value, str):
49
+ self._Name = value
50
+
51
+
52
+ @property
53
+ def Value(self) -> str:
54
+ """
55
+ Property value.
56
+ """
57
+ return self._Value
58
+
59
+ @Value.setter
60
+ def Value(self, value:str):
61
+ """
62
+ Sets the Value property value.
63
+ """
64
+ self._Value = value
65
+
66
+
67
+ def ToDictionary(self) -> dict:
68
+ """
69
+ Returns a dictionary representation of the class.
70
+ """
71
+ result:dict = \
72
+ {
73
+ 'Name': self._Name,
74
+ 'Value': self._Value,
75
+ }
76
+ return result
77
+
78
+
79
+ def ToString(self, includeTitle:bool=False) -> str:
80
+ """
81
+ Returns a displayable string representation of the class.
82
+
83
+ Args:
84
+ includeTitle (str):
85
+ True to include the class name title prefix.
86
+ """
87
+ msg:str = ''
88
+ if includeTitle:
89
+ msg = 'ZeroconfProperty:'
90
+
91
+ if self._Name is not None: msg = '%s\n Name="%s"' % (msg, str(self._Name))
92
+ if self._Value is not None: msg = '%s\n Value="%s"' % (msg, str(self._Value))
93
+ return msg