epsil / spotgen

Spotify Playlist Generator
https://epsil.github.io/spotgen/
Other
130 stars 26 forks source link

more then 10 top songs of an arists #10

Open miberecz opened 6 years ago

miberecz commented 6 years ago

Is there any way to get more then 10 top songs of an arists? Not necessarily with the #top command. I mean, there is the "#order by popularity". Could this be limited to like 20-30-X...? And chained one after another for different artists?

What I want to achieve: Input a list of artists, and get the top 20-30-X... most popular songs from them in a playlist.

epsil commented 6 years ago

It's a little tricky. The #top command fetches the top ten tracks of an artist, as decided by Spotify. It is not possible to get more than ten top tracks from Spotify.

Alternatively, you can use #order by to calculate the top tracks yourself, using either #order by popularity (Spotify ratings) or #order by lastfm (Last.fm ratings). This is somewhat time-consuming, however, because the generator has to look up the rating of every single track first before it can sort them.

Of course, after having processed all the tracks, you could trim off all the tracks you don't need.

It seems that what would be needed in this case is a new command, perhaps something like #trim. Then one could trim off excess tracks post-processing. However, I am unsure how this would work in the case of multiple artists ... the generator's language is very simple as of currently, and there is little in the way of control flow statements.

Suggestions?

miberecz commented 6 years ago

Well, with my limited knowledge: You already have the list of songs with the attribute "popularity" (let it be from Spotify, LastFM, or whatever source). You can order it descending (most popular at first). Cutting a list down to a certain size not a hard thing I assume. Says like #trim 22 <- you stop outputting the list after the 21th element That is for one artist. Daisy chaining queries works with the #top command already. I can says:

top deadmau5

top m83

top moby

and it will give me 30 songs.

Mixing the two ... that is the part where my thinking fails here.

In the meantime I tried "order by" with more then one artist, its works just fine

order by popularity

artist 30y

artist Fish!

I could just copy the first X rows, but its is the first X popular song of the merged list, not by artist.

When its comes to lists, I always think in SQL. Google gave me this: https://stackoverflow.com/questions/3800551/select-first-row-in-each-group-by-group We need something similar, but not the "first of each group" but the "first X of each group".

Yeah... maybe I should go back to my work, instead of thinking on things like that.

miberecz commented 6 years ago

Other idea I tough about: I can go with the #trim command for single artist, and just run the script one after another with different artist in like an SH script, put all the output in one file. Isn't nice solution overall, won't work in a website. But hey, does the job.

nico-pizza commented 2 years ago

Hello. Any news or suggestions on this? I tried typing into the web demo:

order by popularity

order NAME

trim 30

but nothing happened... What am I doing wrong?