mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-06-19 01:03:53 +00:00
* Update playlist endpoints to modern format Deprecate user_playlist_* in favor of the following replacements: * user_playlist_change_details -> playlist_change_details * user_playlist_unfollow -> current_user_unfollow_playlist * user_playlist_add_tracks -> playlist_add_tracks * user_playlist_replace_tracks -> playlist_replace_tracks * user_playlist_reorder_tracks -> playlist_reorder_tracks * user_playlist_remove_all_occurrences_of_tracks -> playlist_remove_all_occurrences_of_tracks * user_playlist_remove_specific_occurrences_of_tracks -> playlist_remove_specific_occurrences_of_tracks * user_playlist_follow_playlist -> current_user_follow_playlist * user_playlist_is_following -> playlist_is_following * Add current_user_following_artists and current_user_following_users * Update tests and examples Resolve TODO in test_user_endpoints.py > SpotifyFollowApiTests.test_user_follows_and_unfollows_user Use modern playlist endpoints (no username required) in tests and examples. * Update changelog * Deprecate playlist_tracks in favor of playlist_items * Link deprecated functions to new functions and change tracks to items * Fix references to playlist_tracks * Change test_playlist_add_items as requested
48 lines
1.8 KiB
Python
48 lines
1.8 KiB
Python
import argparse
|
|
import logging
|
|
|
|
import spotipy
|
|
from spotipy.oauth2 import SpotifyOAuth
|
|
|
|
logger = logging.getLogger('examples.change_playlist_details')
|
|
logging.basicConfig(level='DEBUG')
|
|
|
|
scope = 'playlist-modify-public playlist-modify-private'
|
|
|
|
|
|
def get_args():
|
|
parser = argparse.ArgumentParser(description='Modify details of playlist')
|
|
parser.add_argument('-p', '--playlist', required=True,
|
|
help='Playlist id to alter details')
|
|
parser.add_argument('-n', '--name', required=False,
|
|
help='Name of playlist')
|
|
parser.add_argument('--public', action='store_true', required=False,
|
|
help='Include param if playlist is public')
|
|
parser.add_argument('--private', action='store_false', required=False,
|
|
default=None,
|
|
help='Include param to make playlist is private')
|
|
parser.add_argument('-c', '--collaborative', action='store_true',
|
|
required=False, default=None,
|
|
help='Include param if playlist is collaborative')
|
|
parser.add_argument('-i', '--independent', action='store_false',
|
|
required=False, default=None,
|
|
help='Include param to make playlist non collaborative')
|
|
parser.add_argument('-d', '--description', default=None, required=False,
|
|
help='Description of playlist')
|
|
return parser.parse_args()
|
|
|
|
|
|
def main():
|
|
args = get_args()
|
|
sp = spotipy.Spotify(auth_manager=SpotifyOAuth(scope=scope))
|
|
sp.playlist_change_details(
|
|
args.playlist,
|
|
name=args.name,
|
|
public=args.public or args.private,
|
|
collaborative=args.collaborative or args.independent,
|
|
description=args.description)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|