spotifywebapiPython 1.0.150__py3-none-any.whl → 1.0.151__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.
- {spotifywebapiPython-1.0.150.dist-info → spotifywebapiPython-1.0.151.dist-info}/METADATA +2 -1
- {spotifywebapiPython-1.0.150.dist-info → spotifywebapiPython-1.0.151.dist-info}/RECORD +24 -24
- spotifywebapipython/const.py +6 -1
- spotifywebapipython/docs/__init__.html +9 -2
- spotifywebapipython/docs/index.html +2 -2
- spotifywebapipython/docs/search.js +1 -1
- spotifywebapipython/docs/spotifywebapipython/const.html +20 -3
- spotifywebapipython/docs/spotifywebapipython/saappmessages.html +2 -2
- spotifywebapipython/docs/spotifywebapipython/sautils.html +65 -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 +42 -2
- spotifywebapipython/docs/spotifywebapipython/spotifydiscovery.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/models/spotifyconnectdevice.py +12 -0
- spotifywebapipython/sautils.py +50 -0
- spotifywebapipython/spotifyclient.py +491 -163
- spotifywebapipython/spotifyconnect/spotifyconnectdirectorytask.py +61 -0
- {spotifywebapiPython-1.0.150.dist-info → spotifywebapiPython-1.0.151.dist-info}/LICENSE +0 -0
- {spotifywebapiPython-1.0.150.dist-info → spotifywebapiPython-1.0.151.dist-info}/WHEEL +0 -0
- {spotifywebapiPython-1.0.150.dist-info → spotifywebapiPython-1.0.151.dist-info}/top_level.txt +0 -0
spotifywebapipython/sautils.py
CHANGED
|
@@ -6,6 +6,9 @@ import sys
|
|
|
6
6
|
Utility module of helper functions.
|
|
7
7
|
"""
|
|
8
8
|
|
|
9
|
+
SONOS_NOT_IMPLEMENTED:str = 'NOT_IMPLEMENTED'
|
|
10
|
+
|
|
11
|
+
|
|
9
12
|
def GetUnixTimestampMSFromUtcNow(days:int=0,
|
|
10
13
|
hours:int=0,
|
|
11
14
|
minutes:int=0,
|
|
@@ -54,6 +57,53 @@ def passwordMaskString(inputObj:str) -> str:
|
|
|
54
57
|
return result
|
|
55
58
|
|
|
56
59
|
|
|
60
|
+
def mediaPositionHMS_fromSeconds(
|
|
61
|
+
position:int,
|
|
62
|
+
) -> float:
|
|
63
|
+
"""
|
|
64
|
+
Converts an integer media position value from seconds to a string value in H:MM:SS format.
|
|
65
|
+
|
|
66
|
+
Args:
|
|
67
|
+
position (int):
|
|
68
|
+
The position value (as specified in seconds) to convert.
|
|
69
|
+
"""
|
|
70
|
+
result:str = '0:00:00'
|
|
71
|
+
|
|
72
|
+
# validations.
|
|
73
|
+
if (isinstance(position, float)):
|
|
74
|
+
position = int(position)
|
|
75
|
+
if (position is None) or (position < 1):
|
|
76
|
+
return result
|
|
77
|
+
|
|
78
|
+
# convert seconds to H:MM:SS string format.
|
|
79
|
+
nSeconds = int(position)
|
|
80
|
+
mm, ss = divmod(nSeconds, 60) # get minutes and seconds first
|
|
81
|
+
hh, mm= divmod(mm, 60) # get hours next
|
|
82
|
+
result = "%d:%02d:%02d" % (hh, mm, ss) # format to hh:mm:ss
|
|
83
|
+
|
|
84
|
+
# return result to caller.
|
|
85
|
+
return result
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def mediaPositionHMS_toSeconds(
|
|
89
|
+
timestr:str
|
|
90
|
+
) -> int:
|
|
91
|
+
"""
|
|
92
|
+
Convert an "HH:MM:SS" string value to total number of seconds.
|
|
93
|
+
|
|
94
|
+
Args:
|
|
95
|
+
timestr (int):
|
|
96
|
+
The position value (as specified in H:MM:SS) to convert.
|
|
97
|
+
"""
|
|
98
|
+
if (timestr is None) or (timestr == SONOS_NOT_IMPLEMENTED):
|
|
99
|
+
return 0
|
|
100
|
+
|
|
101
|
+
seconds= 0
|
|
102
|
+
for part in timestr.split(':'):
|
|
103
|
+
seconds= seconds*60 + int(part, 10)
|
|
104
|
+
return seconds
|
|
105
|
+
|
|
106
|
+
|
|
57
107
|
def static_init(cls):
|
|
58
108
|
"""
|
|
59
109
|
Define the decorator used to call an initializer for a class with all static methods.
|