mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-06-19 09:13:53 +00:00
Fix examples for saved tracks (#624)
This fixes the examples showin in delete_a_saved_track.py and contains_a_saved_track.py
This commit is contained in:
parent
94e164385e
commit
ec8a1105b1
@ -1,3 +1,5 @@
|
|||||||
|
# Prints whether a track exists in your collection of saved tracks
|
||||||
|
|
||||||
import pprint
|
import pprint
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@ -7,11 +9,11 @@ from spotipy.oauth2 import SpotifyOAuth
|
|||||||
scope = 'user-library-read'
|
scope = 'user-library-read'
|
||||||
|
|
||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
tids = sys.argv[1]
|
tid = sys.argv[1]
|
||||||
else:
|
else:
|
||||||
print("Usage: %s track-id ..." % (sys.argv[0],))
|
print("Usage: %s track-id ..." % (sys.argv[0],))
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
results = spotipy.current_user_saved_tracks_contains(tracks=tids)
|
sp = spotipy.Spotify(auth_manager=SpotifyOAuth(scope=scope))
|
||||||
pprint.pprint(results)
|
results = sp.current_user_saved_tracks_contains(tracks=[tid])
|
||||||
|
pprint.pprint(results)
|
||||||
|
|||||||
@ -9,11 +9,11 @@ from spotipy.oauth2 import SpotifyOAuth
|
|||||||
scope = 'user-library-modify'
|
scope = 'user-library-modify'
|
||||||
|
|
||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
tids = sys.argv[1]
|
tid = sys.argv[1]
|
||||||
else:
|
else:
|
||||||
print("Usage: %s track-id ..." % (sys.argv[0],))
|
print("Usage: %s track-id ..." % (sys.argv[0],))
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
sp = spotipy.Spotify(auth_manager=SpotifyOAuth(scope=scope))
|
sp = spotipy.Spotify(auth_manager=SpotifyOAuth(scope=scope))
|
||||||
results = sp.current_user_saved_tracks_delete(tracks=tids)
|
results = sp.current_user_saved_tracks_delete(tracks=[tid])
|
||||||
pprint.pprint(results)
|
pprint.pprint(results)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user