spotifywebapiPython 1.0.175__py3-none-any.whl → 1.0.176__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 (22) hide show
  1. {spotifywebapiPython-1.0.175.dist-info → spotifywebapiPython-1.0.176.dist-info}/METADATA +1 -1
  2. {spotifywebapiPython-1.0.175.dist-info → spotifywebapiPython-1.0.176.dist-info}/RECORD +22 -22
  3. spotifywebapipython/const.py +1 -1
  4. spotifywebapipython/docs/__init__.html +8 -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 +4 -4
  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/spotifyclient.py +17 -33
  19. spotifywebapipython/spotifyconnect/spotifyconnectdirectorytask.py +50 -25
  20. {spotifywebapiPython-1.0.175.dist-info → spotifywebapiPython-1.0.176.dist-info}/LICENSE +0 -0
  21. {spotifywebapiPython-1.0.175.dist-info → spotifywebapiPython-1.0.176.dist-info}/WHEEL +0 -0
  22. {spotifywebapiPython-1.0.175.dist-info → spotifywebapiPython-1.0.176.dist-info}/top_level.txt +0 -0
@@ -1048,37 +1048,45 @@ class SpotifyConnectDirectoryTask(threading.Thread):
1048
1048
  if (sonosPlayer is None):
1049
1049
  raise SpotifyApiError("Could not find Sonos Controller instance for device: %s" % (device.Title), None, logsi=_logsi)
1050
1050
 
1051
+ # trace.
1052
+ _logsi.LogDictionary(SILevel.Verbose, "Sonos Controller instance for device: %s (speaker_info)" % (device.Title), sonosPlayer.speaker_info)
1053
+
1051
1054
  # does caller want the group coordinator?
1052
1055
  if (returnCoordinator):
1053
1056
 
1054
1057
  # TEST TODO - use to test Sonos coordinator functionality.
1055
1058
  # _logsi.LogObject(SILevel.Verbose, "Sonos Controller instance for device: %s" % (device.Title), sonosPlayer, colorValue=SIColors.Red)
1056
- # sonosPlayer._is_coordinator = False
1059
+ #sonosPlayer._is_coordinator = False
1057
1060
 
1058
- # if Sonos Controller instance is the group coordinator then we are done.
1061
+ # is Sonos Controller instance the group coordinator?
1059
1062
  if (sonosPlayer.is_coordinator):
1060
- if _logsi.IsOn(SILevel.Verbose):
1061
- _logsi.LogVerbose("Sonos Controller instance is a group coordinator for device: %s" % (device.Title))
1062
- _logsi.LogObject(SILevel.Verbose, "Sonos Controller instance for device: %s" % (device.Title), sonosPlayer)
1063
- _logsi.LogDictionary(SILevel.Verbose, "Sonos Controller instance for device: %s (speaker_info)" % (device.Title), sonosPlayer.speaker_info)
1064
- _logsi.LogObject(SILevel.Verbose, "Sonos Controller instance for device: %s (group)" % (device.Title), sonosPlayer.group)
1065
- _logsi.LogObject(SILevel.Verbose, "Sonos Controller instance for device: %s (zone_group_state)" % (device.Title), sonosPlayer.zone_group_state)
1066
- return sonosPlayer
1067
1063
 
1068
- # trace.
1069
- if _logsi.IsOn(SILevel.Verbose):
1070
- _logsi.LogObject(SILevel.Verbose, "Sonos Controller instance for device: %s" % (device.Title), sonosPlayer)
1071
- _logsi.LogDictionary(SILevel.Verbose, "Sonos Controller instance for device: %s (speaker_info)" % (device.Title), sonosPlayer.speaker_info)
1072
- _logsi.LogObject(SILevel.Verbose, "Sonos Controller instance for device: %s (group)" % (device.Title), sonosPlayer.group)
1073
- _logsi.LogObject(SILevel.Verbose, "Sonos Controller instance for device: %s (zone_group_state)" % (device.Title), sonosPlayer.zone_group_state)
1074
-
1075
- # is the device part of a group? if so, then use the group coordinator.
1076
- if (sonosPlayer.group is not None):
1077
- if (sonosPlayer.group.coordinator is not None):
1078
- sonosPlayerCoordinator:SoCo = sonosPlayer.group.coordinator
1079
- _logsi.LogVerbose("Sonos Controller group coordinator \"%s\" (%s) will be used for device: %s" % (sonosPlayerCoordinator.player_name, sonosPlayerCoordinator.ip_address, device.Title))
1080
- sonosPlayer = sonosPlayerCoordinator
1064
+ # yes - nothing else to do since it's already a group coordinator.
1065
+ _logsi.LogVerbose("Sonos Controller instance is a group coordinator")
1066
+
1067
+ else:
1081
1068
 
1069
+ # no - try to determine the group coordinator.
1070
+ _logsi.LogVerbose("Sonos Controller instance is NOT a group coordinator for device: %s" % (device.Title))
1071
+
1072
+ # is the device part of a group? if so, then use the `group.coordinator` value (if present).
1073
+ sonosPlayerCoordinator:SoCo = None
1074
+ if (sonosPlayer.group is not None):
1075
+ if (sonosPlayer.group.coordinator is not None):
1076
+ sonosPlayerCoordinator = sonosPlayer.group.coordinator
1077
+ sonosPlayer = sonosPlayerCoordinator
1078
+ _logsi.LogVerbose("Sonos Controller group coordinator \"%s\" (%s) will be used for device: %s" % (sonosPlayerCoordinator.player_name, sonosPlayerCoordinator.ip_address, device.Title))
1079
+ _logsi.LogDictionary(SILevel.Verbose, "Sonos Controller instance for device: %s (speaker_info)" % (device.Title), sonosPlayerCoordinator.speaker_info)
1080
+
1081
+ # if group coordinator could not be found, then log a trace message indicating
1082
+ # this and that subsequent Sonos Controller operations will probably fail.
1083
+ # this only seems to happen for "orphaned" Sonos devices (e.g. uid="")
1084
+ # zone_group_state.groups = [ZoneGroup(uid='RINCON_5CAAFDF4E8DE01400:orphan', coordinator=None, members={SoCo("192.168.50.79")}), etc
1085
+ if (sonosPlayerCoordinator is None):
1086
+ _logsi.LogVerbose("Sonos Controller group coordinator could not be determined for device: %s; subsequent Sonos Controller API functions will probably fail!" % (device.Title), colorValue=SIColors.Red)
1087
+ _logsi.LogObject(SILevel.Verbose, "Sonos Controller instance for device: %s (group)" % (device.Title), sonosPlayer.group)
1088
+
1089
+ # return Sonos Controller instance to caller.
1082
1090
  return sonosPlayer
1083
1091
 
1084
1092
 
@@ -1882,11 +1890,28 @@ class SpotifyConnectDirectoryTask(threading.Thread):
1882
1890
 
1883
1891
  try:
1884
1892
 
1885
- # if new device is a Sonos, then create a Sonos Controller instance for the device.
1886
- # use device ip address as the key, as Spotify Web API reports id=null for restricted devices in playerstate!
1893
+ # is this a Sonos device?
1887
1894
  if (scDevice.IsSonos):
1895
+
1896
+ # create a Sonos Controller instance for the device, retrieve the Sonos speaker information,
1897
+ # and add it to the Sonos players collection. use device ip address as the key, as the
1898
+ # Spotify Web API reports "id=null" for restricted devices in playerstate!
1888
1899
  _logsi.LogVerbose("Sonos device detected; creating Sonos Controller instance for device: %s (ip=%s)" % (scDevice.Title, zeroconfDiscoveryResult.HostIpAddress))
1889
- self._SonosPlayers[zeroconfDiscoveryResult.HostIpAddress] = SoCo(zeroconfDiscoveryResult.HostIpAddress)
1900
+ sonosPlayer:SoCo = SoCo(zeroconfDiscoveryResult.HostIpAddress)
1901
+ self._SonosPlayers[zeroconfDiscoveryResult.HostIpAddress] = sonosPlayer
1902
+
1903
+ try:
1904
+ sonosPlayer.get_speaker_info()
1905
+ except Exception as ex:
1906
+ _logsi.LogException("Could not get speaker info for Sonos Controller instance: %s" % (str(ex)), ex, logToSystemLogger=False)
1907
+
1908
+ # trace.
1909
+ if (_logsi.IsOn(SILevel.Verbose)):
1910
+ _logsi.LogObject(SILevel.Verbose, "Sonos Controller instance for device: %s" % (scDevice.Title), sonosPlayer)
1911
+ _logsi.LogDictionary(SILevel.Verbose, "Sonos Controller instance for device: %s (speaker_info)" % (scDevice.Title), sonosPlayer.speaker_info)
1912
+ _logsi.LogObject(SILevel.Verbose, "Sonos Controller instance for device: %s (group)" % (scDevice.Title), sonosPlayer.group)
1913
+ _logsi.LogObject(SILevel.Verbose, "Sonos Controller instance for device: %s (zone_group_state)" % (scDevice.Title), sonosPlayer.zone_group_state)
1914
+ _logsi.LogEnumerable(SILevel.Verbose, "Sonos Controller instance for device: %s (all_zones)" % (scDevice.Title), sonosPlayer.all_zones)
1890
1915
 
1891
1916
  except:
1892
1917