Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

play a song you request #15

Open
GeronVanDenHam opened this issue Jan 26, 2018 · 5 comments
Open

play a song you request #15

GeronVanDenHam opened this issue Jan 26, 2018 · 5 comments

Comments

@GeronVanDenHam
Copy link

can you make it possible to add a request to a song in the parameter?
so for instance
--play_ thunder
and it would then search for thunder, find thunder by Imagine Dragons and play thay.
or for instance
--play imginedragons
to play the spotify playlist of most listened to songs from this artist

@pwittchen
Copy link
Owner

pwittchen commented Jan 26, 2018

Hello,

Thanks for your issue. We can consider adding such features. I'm also open for Pull Requests.
Please note, this project is only wrapper around API exposed by Spotify desktop application and it cannot work without it. If Spotify exposed an API, which allows to implement these functions, then we can do it.

Regards,
Piotr

@kindlehl
Copy link
Contributor

This is possible using dbus-send --print-reply --session --type=method_call --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.OpenUri <spotify_uri>.

However, you'd have to get the uri somehow. You can get this from right-clicking a song in spotify, or go through the Spotify API. Unfortunately, the API requires authentication for any requests, which requires you to either register the application or using web redirects to their app auth page.

Possible, but not easy.

@pwittchen
Copy link
Owner

Maybe we can utilize this project: https://github.com/plamere/spotipy, to achieve that. I'm not sure, if it's able to return appropriate url.

@kindlehl
Copy link
Contributor

kindlehl commented Feb 15, 2019

It looks like it might be possible with the search function. Will also need spotify credentials to embed in the project for authenticating with the API. I'm not sure how secure that is, or how to secure it. I can probably play around with this in a month or two when school/work eases, if you are interested in having this implemented. :)

We could add syntax on top of the spotify --play command. It could be something like:

spotify --play [ [--title | --album | --artist | --playlist] ref ]

[Edit] We could also have a dotfile for the user to place their own spotify credentials.

@fritz-fritz
Copy link

This is possible using dbus-send --print-reply --session --type=method_call --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.OpenUri <spotify_uri>.

Thank you for this, led me to find out that I could do this easier with a tool I already had installed playerctl

playerctl --player=spotify open spotify:playlist:<id> && \
playerctl --player=spotify shuffle on && \
playerctl --player=spotify play && \
sleep 1 && \
playerctl --player=spotify metadata

Fortunately, I didn't need the actual search functionality this feature request wants. I just wanted to control the player.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants