Hello community,
here is the log from the commit of package python-spotipy for
openSUSE:Leap:15.2 checked in at 2020-03-27 16:45:04
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Leap:15.2/python-spotipy (Old)
and /work/SRC/openSUSE:Leap:15.2/.python-spotipy.new.3160 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-spotipy"
Fri Mar 27 16:45:04 2020 rev:5 rq:788708 version:2.10.0
Changes:
--------
--- /work/SRC/openSUSE:Leap:15.2/python-spotipy/python-spotipy.changes
2020-03-19 08:36:10.469843079 +0100
+++
/work/SRC/openSUSE:Leap:15.2/.python-spotipy.new.3160/python-spotipy.changes
2020-03-27 16:47:29.763911184 +0100
@@ -1,0 +2,7 @@
+Thu Mar 26 14:45:02 UTC 2020 - Marketa Calabkova <[email protected]>
+
+- update to 2.10.0
+ * Support for add_to_queue
+ * Add CHANGELOG and LICENSE to released package
+
+-------------------------------------------------------------------
Old:
----
2.9.0.tar.gz
New:
----
2.10.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-spotipy.spec ++++++
--- /var/tmp/diff_new_pack.xCPhkd/_old 2020-03-27 16:47:30.047911351 +0100
+++ /var/tmp/diff_new_pack.xCPhkd/_new 2020-03-27 16:47:30.051911353 +0100
@@ -18,7 +18,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-spotipy
-Version: 2.9.0
+Version: 2.10.0
Release: 0
Summary: Client for the Spotify Web API
License: MIT
++++++ 2.9.0.tar.gz -> 2.10.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/spotipy-2.9.0/.github/workflows/pythonapp.yml
new/spotipy-2.10.0/.github/workflows/pythonapp.yml
--- old/spotipy-2.9.0/.github/workflows/pythonapp.yml 2020-02-15
20:48:21.000000000 +0100
+++ new/spotipy-2.10.0/.github/workflows/pythonapp.yml 2020-03-18
21:39:26.000000000 +0100
@@ -22,6 +22,7 @@
pip install -r requirements.txt
- name: Lint with flake8
run: |
+ pip install -Iv enum34==1.1.6 #
https://bitbucket.org/stoneleaf/enum34/issues/27/enum34-118-broken
pip install flake8
flake8 . --count --show-source --statistics
- name: Run unit tests
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/spotipy-2.9.0/.gitignore
new/spotipy-2.10.0/.gitignore
--- old/spotipy-2.9.0/.gitignore 2020-02-15 20:48:21.000000000 +0100
+++ new/spotipy-2.10.0/.gitignore 2020-03-18 21:39:26.000000000 +0100
@@ -30,7 +30,6 @@
htmlcov/
.tox/
.coverage
-.cache
nosetests.xml
coverage.xml
@@ -52,5 +51,8 @@
# Sphinx documentation
docs/_build/
+# Spotipy tokens
+.cache
+
.*
archive
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/spotipy-2.9.0/CHANGELOG.md
new/spotipy-2.10.0/CHANGELOG.md
--- old/spotipy-2.9.0/CHANGELOG.md 2020-02-15 20:48:21.000000000 +0100
+++ new/spotipy-2.10.0/CHANGELOG.md 2020-03-18 21:39:26.000000000 +0100
@@ -6,6 +6,17 @@
## [Unreleased]
+## [2.10.0] - 2020-03-18
+
+### Added
+
+ - Support for `add_to_queue`
+ - **Parameters:**
+ - track uri, id, or url
+ - device id. If None, then the active device is used.
+ - Add CHANGELOG and LICENSE to released package
+
+
## [2.9.0] - 2020-02-15
### Added
@@ -180,4 +191,4 @@
Repackaged for saner imports
## [1.0.0] - 2017-04-05
-Initial release
\ No newline at end of file
+Initial release
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/spotipy-2.9.0/MANIFEST.in
new/spotipy-2.10.0/MANIFEST.in
--- old/spotipy-2.9.0/MANIFEST.in 2020-02-15 20:48:21.000000000 +0100
+++ new/spotipy-2.10.0/MANIFEST.in 2020-03-18 21:39:26.000000000 +0100
@@ -1,2 +1,2 @@
-include *.txt
+include *.txt *.md
recursive-include docs *.txt
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/spotipy-2.9.0/README.md new/spotipy-2.10.0/README.md
--- old/spotipy-2.9.0/README.md 2020-02-15 20:48:21.000000000 +0100
+++ new/spotipy-2.10.0/README.md 2020-03-18 21:39:26.000000000 +0100
@@ -2,7 +2,7 @@
##### A light weight Python library for the Spotify Web API
-
[](https://spotipy.readthedocs.io/en/latest/?badge=latest)
+
[](https://spotipy.readthedocs.io/en/latest/?badge=latest)
## Documentation
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/spotipy-2.9.0/examples/multiple_accounts.py
new/spotipy-2.10.0/examples/multiple_accounts.py
--- old/spotipy-2.9.0/examples/multiple_accounts.py 1970-01-01
01:00:00.000000000 +0100
+++ new/spotipy-2.10.0/examples/multiple_accounts.py 2020-03-18
21:39:26.000000000 +0100
@@ -0,0 +1,10 @@
+import spotipy
+import spotipy.util as util
+
+from pprint import pprint
+
+while True:
+ username = input("Type the Spotify user ID to use: ")
+ token = util.prompt_for_user_token(username, show_dialog=True)
+ sp = spotipy.Spotify(token)
+ pprint(sp.me())
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/spotipy-2.9.0/examples/player.py
new/spotipy-2.10.0/examples/player.py
--- old/spotipy-2.9.0/examples/player.py 1970-01-01 01:00:00.000000000
+0100
+++ new/spotipy-2.10.0/examples/player.py 2020-03-18 21:39:26.000000000
+0100
@@ -0,0 +1,21 @@
+import spotipy
+from spotipy.oauth2 import SpotifyOAuth
+from pprint import pprint
+from time import sleep
+
+scope = "user-read-playback-state,user-modify-playback-state"
+sp = spotipy.Spotify(client_credentials_manager=SpotifyOAuth(scope=scope))
+
+# Shows playing devices
+res = sp.devices()
+pprint(res)
+
+# Change track
+sp.start_playback(uris=['spotify:track:6gdLoMygLsgktydTQ71b15'])
+
+# Change volume
+sp.volume(100)
+sleep(2)
+sp.volume(50)
+sleep(2)
+sp.volume(100)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/spotipy-2.9.0/examples/simple4.py
new/spotipy-2.10.0/examples/simple4.py
--- old/spotipy-2.9.0/examples/simple4.py 2020-02-15 20:48:21.000000000
+0100
+++ new/spotipy-2.10.0/examples/simple4.py 2020-03-18 21:39:26.000000000
+0100
@@ -1,7 +1,7 @@
import spotipy
-import os
from pprint import pprint
+
def main():
spotify = spotipy.Spotify(auth_manager=spotipy.SpotifyOAuth())
me = spotify.me()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/spotipy-2.9.0/setup.py new/spotipy-2.10.0/setup.py
--- old/spotipy-2.9.0/setup.py 2020-02-15 20:48:21.000000000 +0100
+++ new/spotipy-2.10.0/setup.py 2020-03-18 21:39:26.000000000 +0100
@@ -5,7 +5,7 @@
setup(
name='spotipy',
- version='2.9.0',
+ version='2.10.0',
description='A light weight Python library for the Spotify Web API',
long_description=long_description,
long_description_content_type="text/markdown",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/spotipy-2.9.0/spotipy/client.py
new/spotipy-2.10.0/spotipy/client.py
--- old/spotipy-2.9.0/spotipy/client.py 2020-02-15 20:48:21.000000000 +0100
+++ new/spotipy-2.10.0/spotipy/client.py 2020-03-18 21:39:26.000000000
+0100
@@ -81,7 +81,8 @@
:param auth_manager:
SpotifyOauth object or SpotifyClientCredentials object
:param proxies:
- Definition of proxies (optional)
+ Definition of proxies (optional).
+ See Requests doc
https://2.python-requests.org/en/master/user/advanced/#proxies
:param requests_timeout:
Tell Requests to stop waiting for a response after a given
number of seconds
@@ -187,39 +188,22 @@
if args:
kwargs.update(args)
retries = self.max_get_retries
- delay = 1
+ delay = 0
while retries > 0:
try:
return self._internal_call("GET", url, payload, kwargs)
except SpotifyException as e:
retries -= 1
+ delay += 1
status = e.http_status
- # 429 means we hit a rate limit, backoff
- if status == 429 or (status >= 500 and status < 600):
- if retries < 0:
- raise
- else:
- sleep_seconds = int(
- e.headers.get("Retry-After", delay)
- )
- print("retrying ..." + str(sleep_seconds) + "secs")
- time.sleep(sleep_seconds + 1)
- delay += 1
- else:
- raise
- except Exception as e:
- raise
- print("exception", str(e))
- # some other exception. Requests have
- # been know to throw a BadStatusLine exception
- retries -= 1
- if retries >= 0:
- sleep_seconds = int(e.headers.get("Retry-After", delay))
- print("retrying ..." + str(delay) + "secs")
- time.sleep(sleep_seconds + 1)
- delay += 1
- else:
+ # 429 means we hit a rate limit, back-off
+ if not (status == 429 or status >= 500 and status < 600):
raise
+ sleep_seconds = int(
+ e.headers.get("Retry-After", delay)
+ )
+ print("retrying after..." + str(sleep_seconds) + "secs")
+ time.sleep(sleep_seconds + 1)
def _post(self, url, args=None, payload=None, **kwargs):
if args:
@@ -278,7 +262,7 @@
""" returns a list of tracks given a list of track IDs, URIs, or URLs
Parameters:
- - tracks - a list of spotify URIs, URLs or IDs
+ - tracks - a list of spotify URIs, URLs or IDs. Maximum: 50
IDs.
- market - an ISO 3166-1 alpha-2 country code.
"""
@@ -1048,12 +1032,12 @@
**kwargs
):
""" Get a list of recommended tracks for one to five seeds.
+ (at least one of `seed_artists`, `seed_tracks` and `seed_genres`
+ are needed)
Parameters:
- seed_artists - a list of artist IDs, URIs or URLs
-
- seed_tracks - a list of track IDs, URIs or URLs
-
- seed_genres - a list of genre names. Available genres for
recommendations can be found by calling
recommendation_genre_seeds
@@ -1307,6 +1291,30 @@
)
)
+ def add_to_queue(self, uri, device_id=None):
+ """ Adds a song to the end of a user's queue
+
+ If device A is currently playing music and you try to add to the
queue
+ and pass in the id for device B, you will get a
+ 'Player command failed: Restriction violated' error
+ I therefore reccomend leaving device_id as None so that the active
device is targeted
+
+ :param uri: song uri, id, or url
+ :param device_id:
+ the id of a Spotify device.
+ If None, then the active device is used.
+
+ """
+
+ uri = self._get_uri("track", uri)
+
+ endpoint = "me/player/queue?uri=%s" % uri
+
+ if device_id is not None:
+ endpoint += "&device_id=%s" % device_id
+
+ return self._post(endpoint)
+
def _append_device_id(self, path, device_id):
""" Append device ID to API path.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/spotipy-2.9.0/spotipy/oauth2.py
new/spotipy-2.10.0/spotipy/oauth2.py
--- old/spotipy-2.9.0/spotipy/oauth2.py 2020-02-15 20:48:21.000000000 +0100
+++ new/spotipy-2.10.0/spotipy/oauth2.py 2020-03-18 21:39:26.000000000
+0100
@@ -105,7 +105,6 @@
as a string.
"""
if as_dict:
- print("")
warnings.warn(
"You're using 'as_dict = True'."
"get_access_token will return the token string directly in
future "
@@ -114,7 +113,6 @@
DeprecationWarning,
stacklevel=2,
)
- print("")
if self.token_info and not self.is_token_expired(self.token_info):
return self.token_info if as_dict else
self.token_info["access_token"]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/spotipy-2.9.0/tests/integration/test_user_endpoints.py
new/spotipy-2.10.0/tests/integration/test_user_endpoints.py
--- old/spotipy-2.9.0/tests/integration/test_user_endpoints.py 2020-02-15
20:48:21.000000000 +0100
+++ new/spotipy-2.10.0/tests/integration/test_user_endpoints.py 2020-03-18
21:39:26.000000000 +0100
@@ -387,3 +387,8 @@
pl = self.spotify.user_playlist_tracks(None, self.playlist, limit=2)
self.assertTrue(len(pl["items"]) == 2)
self.assertTrue(pl["total"] > 0)
+
+ def test_devices(self):
+ # No devices playing by default
+ res = self.spotify.devices()
+ self.assertEqual(len(res["devices"]), 0)