spotifywebapiPython 1.0.271__py3-none-any.whl → 1.0.273__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.
- spotifywebapipython/const.py +1 -1
- spotifywebapipython/docs/__init__.html +15 -3
- spotifywebapipython/docs/index.html +2 -2
- spotifywebapipython/docs/search.js +1 -1
- spotifywebapipython/docs/spotifywebapipython/const.html +3 -3
- spotifywebapipython/docs/spotifywebapipython/saappmessages.html +2 -2
- spotifywebapipython/docs/spotifywebapipython/sautils.html +27 -2
- spotifywebapipython/docs/spotifywebapipython/spotifyapierror.html +2 -2
- spotifywebapipython/docs/spotifywebapipython/spotifyapimessage.html +2 -2
- spotifywebapipython/docs/spotifywebapipython/spotifyauthtoken.html +2 -2
- spotifywebapipython/docs/spotifywebapipython/spotifyclient.html +2 -2
- spotifywebapipython/docs/spotifywebapipython/spotifydiscovery.html +2 -2
- spotifywebapipython/docs/spotifywebapipython/spotifymediatypes.html +2 -2
- spotifywebapipython/docs/spotifywebapipython/spotifytypeprefixes.html +2 -2
- spotifywebapipython/docs/spotifywebapipython/spotifywebapiauthenticationerror.html +2 -2
- spotifywebapipython/docs/spotifywebapipython/spotifywebapierror.html +2 -2
- spotifywebapipython/docs/spotifywebapipython/spotifywebplayertoken.html +2 -2
- spotifywebapipython/sautils.py +25 -0
- spotifywebapipython/spotifyclient.py +39 -32
- spotifywebapipython/spotifyconnect/spotifyconnectzeroconflistener.py +21 -0
- {spotifywebapipython-1.0.271.dist-info → spotifywebapipython-1.0.273.dist-info}/METADATA +1 -1
- {spotifywebapipython-1.0.271.dist-info → spotifywebapipython-1.0.273.dist-info}/RECORD +25 -25
- {spotifywebapipython-1.0.271.dist-info → spotifywebapipython-1.0.273.dist-info}/LICENSE +0 -0
- {spotifywebapipython-1.0.271.dist-info → spotifywebapipython-1.0.273.dist-info}/WHEEL +0 -0
- {spotifywebapipython-1.0.271.dist-info → spotifywebapipython-1.0.273.dist-info}/top_level.txt +0 -0
|
@@ -224,6 +224,7 @@ class SpotifyClient:
|
|
|
224
224
|
self._AuthClient:AuthClient = None
|
|
225
225
|
self._ConfigurationCache:dict = {}
|
|
226
226
|
self._ConfigurationDataPath:str = None
|
|
227
|
+
self._ConfigurationData_RLock:threading.RLock = threading.RLock()
|
|
227
228
|
self._DefaultDeviceId:str = None
|
|
228
229
|
self._HasSpotifyWebPlayerCredentials:bool = False
|
|
229
230
|
self._IsDisposed:bool = False
|
|
@@ -964,27 +965,30 @@ class SpotifyClient:
|
|
|
964
965
|
_logsi.LogVerbose("Config data storage key: \"%s\"" % (dataKey))
|
|
965
966
|
_logsi.LogVerbose("Config data storage file path: \"%s\"" % (self._ConfigurationDataPath))
|
|
966
967
|
|
|
967
|
-
#
|
|
968
|
-
|
|
968
|
+
# make the following thread-safe, so we don't read / write the config at the same time.
|
|
969
|
+
with self._ConfigurationData_RLock:
|
|
969
970
|
|
|
970
|
-
#
|
|
971
|
-
|
|
972
|
-
|
|
971
|
+
# does the config data file exist?
|
|
972
|
+
if os.path.exists(self._ConfigurationDataPath):
|
|
973
|
+
|
|
974
|
+
# open the config data storage file, and load it's contents.
|
|
975
|
+
_logsi.LogVerbose("Opening config data storage file")
|
|
976
|
+
with open(self._ConfigurationDataPath, 'r') as f:
|
|
973
977
|
|
|
974
|
-
|
|
978
|
+
dataKeys = json.load(f)
|
|
975
979
|
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
980
|
+
# if config data key exists then return its data; otherwise, return the default.
|
|
981
|
+
if dataKey in dataKeys:
|
|
982
|
+
_logsi.LogDictionary(SILevel.Verbose, "Data was loaded from config data storage file for key: \"%s\"" % (dataKey), dataKeys[dataKey], prettyPrint=True)
|
|
983
|
+
return dataKeys[dataKey]
|
|
984
|
+
else:
|
|
985
|
+
_logsi.LogVerbose("DataKey was not found in config data storage file for key: \"%s\"" % (dataKey))
|
|
986
|
+
return defaultValue
|
|
983
987
|
|
|
984
|
-
|
|
988
|
+
else:
|
|
985
989
|
|
|
986
|
-
|
|
987
|
-
|
|
990
|
+
_logsi.LogVerbose("Config data storage file was not found: \"%s\"" % (self._ConfigurationDataPath))
|
|
991
|
+
return defaultValue
|
|
988
992
|
|
|
989
993
|
except Exception as ex:
|
|
990
994
|
|
|
@@ -1027,26 +1031,29 @@ class SpotifyClient:
|
|
|
1027
1031
|
else:
|
|
1028
1032
|
_logsi.LogValue(SILevel.Verbose, "Config data storage value (non-dict)", dataValue)
|
|
1029
1033
|
|
|
1030
|
-
|
|
1034
|
+
# make the following thread-safe, so we don't read / write the config at the same time.
|
|
1035
|
+
with self._ConfigurationData_RLock:
|
|
1036
|
+
|
|
1037
|
+
dataKeys:dict = {}
|
|
1031
1038
|
|
|
1032
|
-
|
|
1033
|
-
|
|
1039
|
+
# does the config data storage file exist?
|
|
1040
|
+
if os.path.exists(self._ConfigurationDataPath):
|
|
1034
1041
|
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1042
|
+
# open the config data storage file, and load it's contents.
|
|
1043
|
+
#_logsi.LogVerbose("Loading config data storage file contents")
|
|
1044
|
+
with open(self._ConfigurationDataPath, 'r') as f:
|
|
1045
|
+
dataKeys = json.load(f)
|
|
1039
1046
|
|
|
1040
|
-
|
|
1047
|
+
if dataValue is not None:
|
|
1041
1048
|
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1049
|
+
# store the config data for the key.
|
|
1050
|
+
#_logsi.LogVerbose("Updating config key value in config data storage")
|
|
1051
|
+
dataKeys[dataKey] = dataValue
|
|
1052
|
+
|
|
1053
|
+
# save the config data storage file changes.
|
|
1054
|
+
_logsi.LogVerbose("Saving config key data to disk: \"%s\"" % (dataKey))
|
|
1055
|
+
with open(self._ConfigurationDataPath, 'w') as f:
|
|
1056
|
+
json.dump(dataKeys, f, indent=4, sort_keys=True)
|
|
1050
1057
|
|
|
1051
1058
|
except Exception as ex:
|
|
1052
1059
|
|
|
@@ -4,6 +4,7 @@ from zeroconf import Zeroconf, ServiceInfo, ServiceStateChange, IPVersion
|
|
|
4
4
|
|
|
5
5
|
# our package imports.
|
|
6
6
|
from spotifywebapipython.models import ZeroconfProperty, ZeroconfDiscoveryResult
|
|
7
|
+
from spotifywebapipython.sautils import get_source_ip
|
|
7
8
|
# note - cannot reference `SpotifyConnectDirectoryTask` due to circular import!
|
|
8
9
|
# from .SpotifyConnectDirectoryTask import SpotifyConnectDirectoryTask
|
|
9
10
|
|
|
@@ -109,6 +110,24 @@ class SpotifyConnectZeroconfListener:
|
|
|
109
110
|
|
|
110
111
|
# trace.
|
|
111
112
|
_logsi.LogObject(SILevel.Debug, "Spotify Connect Zeroconf service details: \"%s\" (%s) (serviceinfo object)" % (deviceName, serviceInfo.name), serviceInfo)
|
|
113
|
+
|
|
114
|
+
# get originating source ip address for each discovered address.
|
|
115
|
+
# this will determine if a discovered address is on the same subnet or not.
|
|
116
|
+
# we will not use the address if it's not on the same subnet, as Spotify Connect
|
|
117
|
+
# requires discovered devices to be on the same subnet.
|
|
118
|
+
# Spotify Connect Zeroconf discovery IP Address Name for ipAddr "172.30.32.1" = "192.168.1.1"
|
|
119
|
+
ipAddressVerified:str = None
|
|
120
|
+
for ipAddr in ipAddressList:
|
|
121
|
+
ipAddrSource = get_source_ip(ipAddr)
|
|
122
|
+
_logsi.LogVerbose("Spotify Connect Zeroconf discovery is verifying IP Address \"%s\" from Source IP \"%s\" for device name \"%s\"" % (ipAddr, ipAddrSource, deviceName))
|
|
123
|
+
if ipAddrSource is not None:
|
|
124
|
+
if ipAddrSource.count(".") == 3:
|
|
125
|
+
lastDotIdx = ipAddrSource.rfind(".")
|
|
126
|
+
if (lastDotIdx > -1) and (len(ipAddr) >= lastDotIdx):
|
|
127
|
+
if ipAddrSource[0:lastDotIdx] == ipAddr[0:lastDotIdx]:
|
|
128
|
+
ipAddressVerified = ipAddr
|
|
129
|
+
_logsi.LogVerbose("Spotify Connect Zeroconf discovery will use device IP Address \"%s\" for device name \"%s\"" % (ipAddressVerified, deviceName))
|
|
130
|
+
break # use the first one that matches the same subnet.
|
|
112
131
|
|
|
113
132
|
# create new discovery result instance.
|
|
114
133
|
result:ZeroconfDiscoveryResult = ZeroconfDiscoveryResult()
|
|
@@ -116,6 +135,8 @@ class SpotifyConnectZeroconfListener:
|
|
|
116
135
|
result.Domain = '.local'
|
|
117
136
|
for item in ipAddressList:
|
|
118
137
|
result.HostIpAddresses.append(item)
|
|
138
|
+
if (len(result.HostIpAddresses) > 1): # only use verified address if more than 1 address discovered.
|
|
139
|
+
result.HostIpAddress = ipAddressVerified
|
|
119
140
|
result.HostIpPort = serviceInfo.port
|
|
120
141
|
result.HostTTL = serviceInfo.host_ttl
|
|
121
142
|
result.Key = serviceInfo.key
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
spotifywebapipython/__init__.py,sha256=ka7F2AsT-UU7KSYKBnfgl5Trojcep5aQspLutg8D-2k,1306
|
|
2
|
-
spotifywebapipython/const.py,sha256=
|
|
2
|
+
spotifywebapipython/const.py,sha256=8oP375Os1hsmY31bHb1SiCfs6zxd6WVe0wlth3B6ZdQ,4100
|
|
3
3
|
spotifywebapipython/saappmessages.py,sha256=mVprjpd5CdD8kYeAkLzRvMvIQPmaYtH4UCP5my3QhSk,5065
|
|
4
|
-
spotifywebapipython/sautils.py,sha256=
|
|
4
|
+
spotifywebapipython/sautils.py,sha256=LZF3UvxaBK35WIg1hO37nbW8j1y-M-oOxRbi1dPR39w,8746
|
|
5
5
|
spotifywebapipython/spotifyapierror.py,sha256=23_CYlxWN0BceYYCLpBpunl55vEwPr_wFf34l74xzeA,1855
|
|
6
6
|
spotifywebapipython/spotifyapimessage.py,sha256=wCnW8jYMLS3x9kjyXPgXXZqaf1HeMTTXzU8u_Dm5pfA,8447
|
|
7
7
|
spotifywebapipython/spotifyauthtoken.py,sha256=iVg2Pa5mfMqYe4qgc5H8td6JzJlaDqk4vMEhH5LmtfI,9289
|
|
8
|
-
spotifywebapipython/spotifyclient.py,sha256=
|
|
8
|
+
spotifywebapipython/spotifyclient.py,sha256=5F1so7SdO8iYVl45El7GxK2r55dtJMlurHZmHXLQgmc,901035
|
|
9
9
|
spotifywebapipython/spotifydiscovery.py,sha256=cyysxl8PQj9yGHVbaqhSF3SStlrp-NvfGAudM-dDmg0,20290
|
|
10
10
|
spotifywebapipython/spotifymediatypes.py,sha256=hMjkxhbfTtks0_P8BKmY7qg3EmB2zhH3RT0DbEpb_2s,1628
|
|
11
11
|
spotifywebapipython/spotifytypeprefixes.py,sha256=3yfpxKF7jF694qBuo-PbKYvm70YwwdBoGj9enOpWsAg,1375
|
|
12
12
|
spotifywebapipython/spotifywebapiauthenticationerror.py,sha256=5A0MKvYo3Ypv0ZeSSfLHuFLwzoUUu044bBoUgMfNXNw,3940
|
|
13
13
|
spotifywebapipython/spotifywebapierror.py,sha256=5cga9213J_nFQ0UX4vSn3dpyinASKTRiH0wAR4nLjvs,3147
|
|
14
14
|
spotifywebapipython/spotifywebplayertoken.py,sha256=axj1j1lM7COiiZfpElkJRdnk4AmE6bAQcjKshUIz1Nk,35813
|
|
15
|
-
spotifywebapipython/docs/__init__.html,sha256=
|
|
15
|
+
spotifywebapipython/docs/__init__.html,sha256=lrPl2UUBlZh4Fk1JGqXeTRo-AQXsZ10sTrSg3yqRXk4,189948
|
|
16
16
|
spotifywebapipython/docs/codecopy.js,sha256=ryuoZwLIL03YitjjFzn49UO5ta7-OBos6LNA3qHhFzs,3120
|
|
17
|
-
spotifywebapipython/docs/index.html,sha256=
|
|
18
|
-
spotifywebapipython/docs/search.js,sha256=
|
|
17
|
+
spotifywebapipython/docs/index.html,sha256=MyO_pTnOe2Q023BfcPHb6kedmJH2raTY-OHF5NeTMAA,48779
|
|
18
|
+
spotifywebapipython/docs/search.js,sha256=9Q3ewHFsndlyJ7GIzJS3M40--ZmacLvrPtY8DwXxErg,9156714
|
|
19
19
|
spotifywebapipython/docs/spotifywebapipython.ico,sha256=YImj39fqqSPSuB2-sMDlUYDd6YwRfQeJRtq4FjwWglg,16410
|
|
20
20
|
spotifywebapipython/docs/spotifywebapipython_OLD.ico,sha256=YIv5LjcD4bTIJQSOr8jjwbWaeB3QkElRwkTOePiGbZo,14904
|
|
21
|
-
spotifywebapipython/docs/spotifywebapipython/const.html,sha256=
|
|
22
|
-
spotifywebapipython/docs/spotifywebapipython/saappmessages.html,sha256=
|
|
23
|
-
spotifywebapipython/docs/spotifywebapipython/sautils.html,sha256=
|
|
24
|
-
spotifywebapipython/docs/spotifywebapipython/spotifyapierror.html,sha256=
|
|
25
|
-
spotifywebapipython/docs/spotifywebapipython/spotifyapimessage.html,sha256=
|
|
26
|
-
spotifywebapipython/docs/spotifywebapipython/spotifyauthtoken.html,sha256=
|
|
27
|
-
spotifywebapipython/docs/spotifywebapipython/spotifyclient.html,sha256=
|
|
28
|
-
spotifywebapipython/docs/spotifywebapipython/spotifydiscovery.html,sha256=
|
|
29
|
-
spotifywebapipython/docs/spotifywebapipython/spotifymediatypes.html,sha256=
|
|
30
|
-
spotifywebapipython/docs/spotifywebapipython/spotifytypeprefixes.html,sha256=
|
|
31
|
-
spotifywebapipython/docs/spotifywebapipython/spotifywebapiauthenticationerror.html,sha256=
|
|
32
|
-
spotifywebapipython/docs/spotifywebapipython/spotifywebapierror.html,sha256=
|
|
33
|
-
spotifywebapipython/docs/spotifywebapipython/spotifywebplayertoken.html,sha256=
|
|
21
|
+
spotifywebapipython/docs/spotifywebapipython/const.html,sha256=uA4aSw56JWEOVG9yuYWiHkgtzQQLhwCt1hZuT4huev4,60537
|
|
22
|
+
spotifywebapipython/docs/spotifywebapipython/saappmessages.html,sha256=aYagyGIS33pOd2nql6B9IKlGpqgijSxI_iGuZqUi1gw,62358
|
|
23
|
+
spotifywebapipython/docs/spotifywebapipython/sautils.html,sha256=XJCU_qfYVhGMMZ-hLvZC_uMQj8yLl4FMBcRAsmtZUZw,62031
|
|
24
|
+
spotifywebapipython/docs/spotifywebapipython/spotifyapierror.html,sha256=11bJWINLI6OJJVqeK0PXYPSqD3ty97msys1_NAqxdJM,48054
|
|
25
|
+
spotifywebapipython/docs/spotifywebapipython/spotifyapimessage.html,sha256=LrvPGPT1wbbLffRDXoAvgfpA0PhGGyOqkCyv45kk9hU,59210
|
|
26
|
+
spotifywebapipython/docs/spotifywebapipython/spotifyauthtoken.html,sha256=wPTL_yholTpYc2q0Sea8QVDq2-lDjOtcXf7gd1KeH6M,59256
|
|
27
|
+
spotifywebapipython/docs/spotifywebapipython/spotifyclient.html,sha256=jTtKnuKuU-u8XUhC-UEwd_-ytno3LWdxhP6LKEBxx4M,1667177
|
|
28
|
+
spotifywebapipython/docs/spotifywebapipython/spotifydiscovery.html,sha256=9IXRdnpRGD4n4HEJqLuXWPeg602rDQv7DoZRq6zCD4g,57662
|
|
29
|
+
spotifywebapipython/docs/spotifywebapipython/spotifymediatypes.html,sha256=RSd_qiBEkDJeGIBfuxTm-AdH2C5-cHpCS_HHTZWW_Ug,51532
|
|
30
|
+
spotifywebapipython/docs/spotifywebapipython/spotifytypeprefixes.html,sha256=zzCw1fn3WubRUO_NDSw1OOiaGZzrKuwY1AeVTdYZ_2A,52401
|
|
31
|
+
spotifywebapipython/docs/spotifywebapipython/spotifywebapiauthenticationerror.html,sha256=gmzjrJ8GKag7TfP0wDRLz05sc1HqvOj0N0paEWW2ILs,52174
|
|
32
|
+
spotifywebapipython/docs/spotifywebapipython/spotifywebapierror.html,sha256=Tz27uWAyVNaMUnHaWuVKzW-6kj_UmUNupP_szPAnBpw,50592
|
|
33
|
+
spotifywebapipython/docs/spotifywebapipython/spotifywebplayertoken.html,sha256=rCAoHY67tZbghUATzKqoNq4Fi_Lef3joK9etpszmxJg,62204
|
|
34
34
|
spotifywebapipython/models/__init__.py,sha256=RwRQhUX-6EUs8XvStVFpR8EPwoqIAz9K6ref-28qHKI,4423
|
|
35
35
|
spotifywebapipython/models/album.py,sha256=U3Pdw0-EL33LdkeiN31fjZ23rlLk6DNGV8jRmZU7EyQ,5170
|
|
36
36
|
spotifywebapipython/models/albumpagesaved.py,sha256=SBYMhkh5ZsMrRAXl-cm9zsxMDh8gO190ENq6Py2TyGY,2417
|
|
@@ -117,7 +117,7 @@ spotifywebapipython/spotifyconnect/spotifyconnectzeroconfcastlistener.py,sha256=
|
|
|
117
117
|
spotifywebapipython/spotifyconnect/spotifyconnectzeroconfcastmultizonecontrollerlistener.py,sha256=AA-XxS6AptJWzyO2zsM9DA5ioCncJBKDTpJkr_aN9IM,12352
|
|
118
118
|
spotifywebapipython/spotifyconnect/spotifyconnectzeroconfcastmultizonemanagerlistener.py,sha256=k3wMC80Z7jBXYwiw9jq-oixRsum7E_vdHzwEgvcGbiw,18918
|
|
119
119
|
spotifywebapipython/spotifyconnect/spotifyconnectzeroconfexceptions.py,sha256=aesGauxMoKupdTPR5rL2-rXBC3SEvH_9bQQx2Vh-abs,524
|
|
120
|
-
spotifywebapipython/spotifyconnect/spotifyconnectzeroconflistener.py,sha256=
|
|
120
|
+
spotifywebapipython/spotifyconnect/spotifyconnectzeroconflistener.py,sha256=yhz1DU3cDRLG4ymCy2v5d3gUXrvNB2CNlhgqG9p6-yM,16208
|
|
121
121
|
spotifywebapipython/vibrant/__init__.py,sha256=x3yGfhH0ydjWTSILADuwQXaoLvpkV2EM0T_gyZ5aX38,712
|
|
122
122
|
spotifywebapipython/vibrant/colorthieffast.py,sha256=hMPL1yLeCMj6KXpq5V_Pp8eYkvB_8NlA7w95LRh3f1A,21736
|
|
123
123
|
spotifywebapipython/vibrant/generator.py,sha256=UFLketHF_gAjjC-VQCP8vCUFCgZEYxqN91m1_IeOtj0,7462
|
|
@@ -137,8 +137,8 @@ spotifywebapipython/zeroconfapi/zeroconfgetinfo.py,sha256=APayso_F7lCsdzzrkescgd
|
|
|
137
137
|
spotifywebapipython/zeroconfapi/zeroconfgetinfoalias.py,sha256=FZJM23HIPJSfhXIC3-EuS1XhawheoG5maSp7__k4yBo,2932
|
|
138
138
|
spotifywebapipython/zeroconfapi/zeroconfgetinfodrmmediaformat.py,sha256=c5uk8ljsIuBK3w2jahHKQuoWvm245LOjUBitetXx5Mo,2347
|
|
139
139
|
spotifywebapipython/zeroconfapi/zeroconfresponse.py,sha256=mAPIDj5MG53x8peiScrp7OJblwy_o_Sto4wqE0rGujU,6445
|
|
140
|
-
spotifywebapipython-1.0.
|
|
141
|
-
spotifywebapipython-1.0.
|
|
142
|
-
spotifywebapipython-1.0.
|
|
143
|
-
spotifywebapipython-1.0.
|
|
144
|
-
spotifywebapipython-1.0.
|
|
140
|
+
spotifywebapipython-1.0.273.dist-info/LICENSE,sha256=KGcc9g0zwqNLcWnSn_ezv1UtKyhMENFhvtixpxUPNsE,1177
|
|
141
|
+
spotifywebapipython-1.0.273.dist-info/METADATA,sha256=RAKNhVpYfHllZpZ6MPnCEdL_oQ5FH_tZ919ES1UGq7M,11644
|
|
142
|
+
spotifywebapipython-1.0.273.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
|
|
143
|
+
spotifywebapipython-1.0.273.dist-info/top_level.txt,sha256=jTBLFlijKTesYh2dteAz4vb17qjaqWKeDjpnnwTcrjs,20
|
|
144
|
+
spotifywebapipython-1.0.273.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
{spotifywebapipython-1.0.271.dist-info → spotifywebapipython-1.0.273.dist-info}/top_level.txt
RENAMED
|
File without changes
|