mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-26 16:15:51 +03:00
[GH-ISSUE #702] Is it possible to create a playlist of every song an artist ID has and appears on (including appears on section)? #415
Labels
No labels
api-bug
bug
dependencies
documentation
duplicate
enhancement
external-ide
headless-mode
implicit-grant-flow
invalid
missing-endpoint
pr-welcome
private-api
pull-request
question
spotipy3
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/spotipy#415
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @greeneryAO on GitHub (Jul 2, 2021).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/702
Several apps that claim to do this, like for example alfred spotify mini player that says creates complete collection misses many songs, mostly the appears on sections, which it cannot penetrate, but that is where artists frequently appear on remixes etc.
searching in spotify and sorting by songs is messy too, and often includes junk and songs not by that artist as it runs out of songs by the artist.
Is there a way to run a script that will return a list of all songs if I put in the artist name (ID?), regardless of dupes, just a total list, this would be helpful for grass cutting for updates every few weeks or so, as the big apps that update new releases are annoying and sporadic. I want to do it when I want to do it.
Would it be easy or hard, as you can probably tell I'm not a coder but have some money left on freelancer I'd rather spend than try to claw back.
I think this is the relevant section.
playlist_add_items(playlist_id, items, position=None)
Adds tracks/episodes to a playlist
Parameters:
playlist_id - the id of the playlist
items - a list of track/episode URIs, URLs or IDs
position - the position to add the tracks
thanks.
@kenmacf commented on GitHub (Jul 2, 2021):
I've done something like this, assuming authentication is in place:
@greeneryAO commented on GitHub (Jul 2, 2021):
thanks very much, I don't know what to make of the code but I'm glad I have it and I have saved it, and it's possible. I will try and learn it on my own, worst case I pay somebody on freelancer who understands python and spotipy
My guy who has helped me before just quit working there, don't want to bug him again, but somebody else could figure it out what I have to put in and where.
I have several python scripts that use authorization and spotipy and work well so I think that's good.
@greeneryAO commented on GitHub (Jul 3, 2021):
well I looked at it, sorry for not understanding a thing about python but where do you put the artist ID to run the script and generate the playlist?.
I assume I have to add the credentials and the redirect and that on top of the script like is required for spotipy and like is on all my other scripts, but on those scripts there would always be somewhere he would tell me to insert information.
if you could explain I would appreciate, if not , it's cool, I appreciate you even sharing.
@Peter-Schorn commented on GitHub (Jul 3, 2021):
You must define a variable called
artist_idwith the artist id.@greeneryAO commented on GitHub (Jul 3, 2021):
would this work?
@stephanebruckert commented on GitHub (Jul 3, 2021):
@greeneryAO why don't you just run it to know if it would work? it's not that hard, just google how to run a python script and start from there
@greeneryAO commented on GitHub (Jul 3, 2021):
I know how to run them, just not to fix them, tried it, error message was
Traceback (most recent call last):
File "spotify playlist maker.py", line 23, in
albums = session.spotify_artist_albums(artist_id)
NameError: name 'session' is not defined
@greeneryAO commented on GitHub (Jul 3, 2021):
If I change it around, either the token is not defined, or the session is not defined, or the scope is note defined, must have did something wrong.
@stephanebruckert commented on GitHub (Jul 3, 2021):
Yeah
sessionis not defined, as the error message says. @kenmacf's code aims to show the logic but as mentioned it's not including the authentication part. So you will have to adapt it a little.Since you don't need to add songs to any user playlist, you won't need user authentication, which will be easy for you.
My suggestion is you follow these steps:
Quick Start / Without user authenticationexample on the READMEsp.search(), you can dosp.artist_albumssp.album_tracksGood luck, and remember to always start from something that works
@greeneryAO commented on GitHub (Jul 3, 2021):
thanks, I'll give it a try, what about this code, I found it just in the newest changes to spotipy, maybe it's the same thing.
artist_discography.py
I ran it and it said it succeeded but nothing happened
@stephanebruckert commented on GitHub (Jul 3, 2021):
https://github.com/plamere/spotipy/blob/master/examples/artist_discography.py
You skipped the
main()function therefore nothing ran. Just run the full thing. Starting with examples is a very good approach@greeneryAO commented on GitHub (Jul 3, 2021):
ran it by itself and error was
spotipy.oauth2.SpotifyOauthError: No client_id. Pass it or set a SPOTIPY_CLIENT_ID environment variable.
ran it with credentials and same error?
@stephanebruckert commented on GitHub (Jul 3, 2021):
No you didn't pass the credentials. See the difference between your code:
and the code in the README:
@greeneryAO commented on GitHub (Jul 3, 2021):
is in the example, I'll try to make the credentials like the readme
@greeneryAO commented on GitHub (Jul 3, 2021):
Tried a bunch of things, putting in my app credentials authorized or not, wouldn't work, same errors.
spotipy.oauth2.SpotifyOauthError: No client_id. Pass it or set a SPOTIPY_CLIENT_ID environment variable.
I know I seem like a dolt to people who know python but not going to start learning python and spotipy for this last script I need for my spotify setup, I guess I'll take both scripts to market and get the dummy version handed to me and see if either can do what I imagined.
thanks anyway.