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.

Files changed (24) hide show
  1. {spotifywebapiPython-1.0.150.dist-info → spotifywebapiPython-1.0.151.dist-info}/METADATA +2 -1
  2. {spotifywebapiPython-1.0.150.dist-info → spotifywebapiPython-1.0.151.dist-info}/RECORD +24 -24
  3. spotifywebapipython/const.py +6 -1
  4. spotifywebapipython/docs/__init__.html +9 -2
  5. spotifywebapipython/docs/index.html +2 -2
  6. spotifywebapipython/docs/search.js +1 -1
  7. spotifywebapipython/docs/spotifywebapipython/const.html +20 -3
  8. spotifywebapipython/docs/spotifywebapipython/saappmessages.html +2 -2
  9. spotifywebapipython/docs/spotifywebapipython/sautils.html +65 -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 +42 -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/models/spotifyconnectdevice.py +12 -0
  19. spotifywebapipython/sautils.py +50 -0
  20. spotifywebapipython/spotifyclient.py +491 -163
  21. spotifywebapipython/spotifyconnect/spotifyconnectdirectorytask.py +61 -0
  22. {spotifywebapiPython-1.0.150.dist-info → spotifywebapiPython-1.0.151.dist-info}/LICENSE +0 -0
  23. {spotifywebapiPython-1.0.150.dist-info → spotifywebapiPython-1.0.151.dist-info}/WHEEL +0 -0
  24. {spotifywebapiPython-1.0.150.dist-info → spotifywebapiPython-1.0.151.dist-info}/top_level.txt +0 -0
@@ -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.