spotifywebapiPython 1.0.158__py3-none-any.whl → 1.0.161__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 (25) hide show
  1. {spotifywebapiPython-1.0.158.dist-info → spotifywebapiPython-1.0.161.dist-info}/METADATA +1 -1
  2. {spotifywebapiPython-1.0.158.dist-info → spotifywebapiPython-1.0.161.dist-info}/RECORD +25 -25
  3. spotifywebapipython/const.py +1 -1
  4. spotifywebapipython/docs/__init__.html +20 -2
  5. spotifywebapipython/docs/index.html +2 -2
  6. spotifywebapipython/docs/search.js +1 -1
  7. spotifywebapipython/docs/spotifywebapipython/const.html +3 -3
  8. spotifywebapipython/docs/spotifywebapipython/saappmessages.html +2 -2
  9. spotifywebapipython/docs/spotifywebapipython/sautils.html +2 -2
  10. spotifywebapipython/docs/spotifywebapipython/spotifyapierror.html +2 -2
  11. spotifywebapipython/docs/spotifywebapipython/spotifyapimessage.html +2 -2
  12. spotifywebapipython/docs/spotifywebapipython/spotifyauthtoken.html +2 -2
  13. spotifywebapipython/docs/spotifywebapipython/spotifyclient.html +2 -2
  14. spotifywebapipython/docs/spotifywebapipython/spotifydiscovery.html +2 -2
  15. spotifywebapipython/docs/spotifywebapipython/spotifywebapiauthenticationerror.html +2 -2
  16. spotifywebapipython/docs/spotifywebapipython/spotifywebapierror.html +2 -2
  17. spotifywebapipython/docs/spotifywebapipython/spotifywebplayertoken.html +2 -2
  18. spotifywebapipython/spotifyconnect/spotifyconnectdirectorytask.py +12 -8
  19. spotifywebapipython/spotifyconnect/spotifyconnectzeroconfcastlistener.py +19 -15
  20. spotifywebapipython/spotifyconnect/spotifyconnectzeroconflistener.py +7 -7
  21. spotifywebapipython/spotifydiscovery.py +2 -2
  22. spotifywebapipython/zeroconfapi/zeroconfconnect.py +7 -2
  23. {spotifywebapiPython-1.0.158.dist-info → spotifywebapiPython-1.0.161.dist-info}/LICENSE +0 -0
  24. {spotifywebapiPython-1.0.158.dist-info → spotifywebapiPython-1.0.161.dist-info}/WHEEL +0 -0
  25. {spotifywebapiPython-1.0.158.dist-info → spotifywebapiPython-1.0.161.dist-info}/top_level.txt +0 -0
@@ -48,7 +48,7 @@ class SpotifyConnectZeroconfListener:
48
48
  def __init__(
49
49
  self,
50
50
  parentDirectory,
51
- zeroconf_Lock:threading.Lock,
51
+ zeroconf_RLock:threading.RLock,
52
52
  ) -> None:
53
53
  """
54
54
  Initializes a new instance of the class.
@@ -56,7 +56,7 @@ class SpotifyConnectZeroconfListener:
56
56
  Args:
57
57
  parentDirectory (SpotifyConnectDirectoryTask):
58
58
  Parent SpotifyConnectDirectoryTask instance.
59
- zeroconf_Lock (threading.Lock):
59
+ zeroconf_RLock (threading.RLock):
60
60
  Lock object used to enforce thread-safe updates.
61
61
  """
62
62
  # invoke base class method.
@@ -64,7 +64,7 @@ class SpotifyConnectZeroconfListener:
64
64
 
65
65
  # initialize storage.
66
66
  self._ParentDirectory = parentDirectory
67
- self._Zeroconf_Lock:threading.Lock = zeroconf_Lock
67
+ self._Zeroconf_RLock:threading.RLock = zeroconf_RLock
68
68
 
69
69
 
70
70
  def _GetZeroconfDiscoveryResult(
@@ -182,7 +182,7 @@ class SpotifyConnectZeroconfListener:
182
182
  The type of service state change (add, remove, update).
183
183
  """
184
184
  # use lock, as multiple threads could be calling this method simultaneously.
185
- with self._Zeroconf_Lock:
185
+ with self._Zeroconf_RLock:
186
186
 
187
187
  # copy passed parameters to thread-safe storage.
188
188
  serviceType:str = service_type
@@ -248,7 +248,7 @@ class SpotifyConnectZeroconfListener:
248
248
  A description of the type of service state change (add, remove, update).
249
249
 
250
250
  This method will be called in a thread-safe manner, as the caller is using
251
- the `Zeroconf_Lock` object to control access.
251
+ the `Zeroconf_RLock` object to control access.
252
252
  """
253
253
  # build discovery result instance from service state information.
254
254
  # if nothing returned, then don't bother!
@@ -282,7 +282,7 @@ class SpotifyConnectZeroconfListener:
282
282
  A description of the type of service state change (add, remove, update).
283
283
 
284
284
  This method will be called in a thread-safe manner, as the caller is using
285
- the `Zeroconf_Lock` object to control access.
285
+ the `Zeroconf_RLock` object to control access.
286
286
  """
287
287
  # for service removal notifications, there will be no zeroconf service info.
288
288
  # build discovery result instance from service state information.
@@ -322,7 +322,7 @@ class SpotifyConnectZeroconfListener:
322
322
  A description of the type of service state change (add, remove, update).
323
323
 
324
324
  This method will be called in a thread-safe manner, as the caller is using
325
- the `Zeroconf_Lock` object to control access.
325
+ the `Zeroconf_RLock` object to control access.
326
326
  """
327
327
  # build discovery result instance from service state information.
328
328
  # if nothing returned, then don't bother!
@@ -67,7 +67,7 @@ class SpotifyDiscovery:
67
67
  self._DiscoveryResults:list[ZeroconfDiscoveryResult] = []
68
68
  self._PrintToConsole:bool = printToConsole
69
69
  self._ZeroconfClient = zeroconfClient
70
- self._Zeroconf_Lock = threading.Lock()
70
+ self._Zeroconf_RLock = threading.RLock()
71
71
 
72
72
 
73
73
  def __getitem__(self, key):
@@ -293,7 +293,7 @@ class SpotifyDiscovery:
293
293
  # > the only way to remove an entry is to kill the process the entry was created under!
294
294
 
295
295
  # enter the following section one thread at a time (threadsafe).
296
- with self._Zeroconf_Lock:
296
+ with self._Zeroconf_RLock:
297
297
 
298
298
  # copy passed parameters to thread-safe storage.
299
299
  serviceType:str = service_type
@@ -1214,15 +1214,20 @@ class ZeroconfConnect:
1214
1214
  # try connecting to the device until we timeout or there are no more "connection refused" errors.
1215
1215
  loopTotalDelay:float = 0
1216
1216
  LOOP_DELAY:float = 0.25
1217
- LOOP_TIMEOUT:float = 2.0
1217
+ LOOP_TIMEOUT:float = 1.0 # this is the number of tries (not seconds to wait); 1.0 = 4 tries, 2.0 = 8 tries, etc.
1218
1218
  while True:
1219
1219
 
1220
1220
  try:
1221
1221
 
1222
+ # if device connection was previously delayed, then log the info
1223
+ # as it may be helpful in debugging other issues.
1224
+ if (loopTotalDelay > 0):
1225
+ _logsi.LogVerbose("Re-trying to reach Spotify Connect device (ip=%s:%s) after %f seconds from initial request" % (self._HostIpAddress, self._HostIpPort, loopTotalDelay))
1226
+
1222
1227
  # execute spotify zeroconf api request.
1223
1228
  response = requests.get(
1224
1229
  self._Uri,
1225
- timeout=5,
1230
+ timeout=4,
1226
1231
  headers=reqHeaders,
1227
1232
  params=reqParams
1228
1233
  )