SpotMenu icon indicating copy to clipboard operation
SpotMenu copied to clipboard

Can you add a like button so I can save the current song to my favorites?

Open BrandTurner opened this issue 9 years ago • 28 comments

BrandTurner avatar Dec 14 '16 01:12 BrandTurner

Hi, currently I use the AppleScript API to get information from Spotify, unfortunately it does not provide an endpoint to save / modify / delete tracks from a users playlist / saved library. A plausible way to add this feature anyhow would be to use the Web API, but this would require the user to authenticate the application with their Spotify account.

kmikiy avatar Dec 14 '16 08:12 kmikiy

I'd also like this feature. What are your thoughts on allowing the user to sign in for additional features such as this? I'd be willing to work on this functionality, it's just a matter of whether you think that this is "in-scope" for SpotMenu. :)

camdenb avatar Feb 21 '17 17:02 camdenb

I think it would be a neat feature as well, I sometimes wish I had this feature too 😄. But since this is an open source project, I don't know how I could securely store a client_id and client_secret. I wouldn't to ask users to create their own Spotify App just to use this feature. If you have any ideas that would be great!

kmikiy avatar Feb 21 '17 18:02 kmikiy

That's a really good point that I hadn't thought of. I suppose we could spin up a small server solely to serve these keys (maybe using https://aws.amazon.com/lambda/)? Looks like Lambda has a pretty sweet free tier. I haven't used it myself but I've heard good things. Let me know what you think!

camdenb avatar Feb 21 '17 18:02 camdenb

I've never used Lambda before either.

Spotify authorization flows So you think we should set up a Lambda server so we can use the Authorization Code Flow?

kmikiy avatar Feb 21 '17 18:02 kmikiy

~~Actually, looks like we won't need to. Check this out: https://developer.spotify.com/web-api/authorization-guide/#implicit-grant-flow~~

~~Whoop, looks like we still need to store an ID somewhere.~~

Reviewing the docs for a third time, it looks like we don't need a secret key. Hooray!

These are some stellar docs, btw.

camdenb avatar Feb 21 '17 18:02 camdenb

I haven't read the documentation thoroughly yet, but I think the problem with the Implicit Grand Flow is that the user won't receive a refresh token and once the access token expires the user will have to login again, which would be really annoying. I don't know how long an issued access token is valid. If it's valid for more than a couple a months, then this is ok, but using a toking that expires weekly or even hourly wouldn't be such a great idea.

kmikiy avatar Feb 21 '17 19:02 kmikiy

Ooh, yeah, good point. Looks like the token expires after one hour. Might not be the best solution. :)

Then yeah looks like Lambda might be a good option. I'm more of a web dev guy myself (I've played around with OS X dev but it's certainly not my strong suit), so perhaps I can work on the Lambda business and you can work on the OS X side (which besides the UI would include providing a callback URI)?

camdenb avatar Feb 21 '17 19:02 camdenb

I started implementing this "add to your music" button feature.

Currently, this is the backend: https://github.com/kmikiy/kmikiy-for-spotify which runs on Heroku. I am using a free dyno for this. The url for the backend is this: http://kmikiy-for-spotify.herokuapp.com/

The client side is being developed on the save-button branch. Right now only logging in works, that is, retrieving access and refresh tokens, and nothing else.

I'll try to add the actual save feature as soon as possible. Also, there is a lot of boilerplate code to write for example refreshing access tokens, querying whether or not the current song is saved already and displaying a ✔︎ and ✘ accordingly, etc.

kmikiy avatar Mar 08 '17 17:03 kmikiy

Looks great! Anything I can do to help?

camdenb avatar Mar 08 '17 17:03 camdenb

Checkout the save-button branch, build it and see how it works (follow the steps in the README.md to build it).

Known issues:

  • If you restart the SpotMenu you will have to login again
  • After you login the "save button" will only be updated when you skip to the next song
  • If the popover hasn't been open for more than an hour then the save button might show the correct symbol until you skip to the next song (this is due to the that the access token may have expired and might not have been refreshed yet)
  • There is no sign out button yet 😅

kmikiy avatar Mar 09 '17 18:03 kmikiy

@camdenb

Looks great! Anything I can do to help?

If you could find out why it keeps hogging so much memory even after the webview has been dismissed that would be great 😃

kmikiy avatar Mar 09 '17 18:03 kmikiy

Just found this little project. It's awesome! I was also hoping that a save song button would de awesome, but I see you're already working on that. Keep up the good work! Cheers!

welkeletter avatar Mar 10 '17 08:03 welkeletter

Hi @kmikiy, how are you on this enhancement? I can try help in my free time, are you interested in it?

ManWithBear avatar Jun 25 '17 13:06 ManWithBear

Hey @ManWithBear I haven't really been working on it lately. But if youre willing to help id be glad to start working on it again. The changes from the main branch need to be merged in to the save-button branch. In my previous comments I mentioned the current state of the save-button branch and its issues. Basically those need to be fixed and evrything should be working fine. If youre good at debugging memory leaks then that would help because im concerned about the current way spotify login works now. I think it might be leaking

kmikiy avatar Jun 25 '17 14:06 kmikiy

Update on this? Would be keen on getting this as a feature, if at all possible now :))

ZSaber1 avatar Nov 02 '17 09:11 ZSaber1

@Zazerr To be honest I haven't worked on this feature for a while due to Spotify's limitations. I'll get back to this after I finish the requests that are currently in work in progress state

kmikiy avatar Nov 02 '17 18:11 kmikiy

Hey, it would be amazing to see this feature. Thanks!

lyapustin avatar Aug 02 '18 08:08 lyapustin

Would still love this aswell

CasperVerswijvelt avatar Oct 20 '18 17:10 CasperVerswijvelt

+1...This would be a great feature!

deecypher avatar Nov 29 '18 03:11 deecypher

I no longer use Mac, but I would just like to say that I think this feature would still be great if it is possible to implement.

ZSaber1 avatar Nov 29 '18 04:11 ZSaber1

+1 on this feature

swillsea avatar Dec 05 '18 21:12 swillsea

+1

fharper avatar Dec 06 '18 16:12 fharper

+1

martin-888 avatar May 27 '19 12:05 martin-888

I really love SpotMenu but need so much like button, +100500 on this feature

IgorAdams avatar Nov 01 '20 12:11 IgorAdams

Anything I can do to contribute to this?

JxxIT avatar Oct 17 '22 16:10 JxxIT

up up up

rayepeng avatar May 05 '23 02:05 rayepeng

I found an alternative that uses Spotifys API instead of their AppleScript API: https://github.com/Peter-Schorn/SoftPlayer

martin-braun avatar May 25 '23 23:05 martin-braun