librespot-org / librespot

Open Source Spotify client library
MIT License
4.8k stars 602 forks source link

Okay my plan is to use librespot to change the user spotify device to librespot. #1143

Closed PetrNezbeda closed 1 year ago

PetrNezbeda commented 1 year ago

Okay my plan is to use librespot to change the user spotify device to librespot.

I builded a nodejs api that starts librespot with this following code

        this.librespotProcess = spawn('/root/.cargo/bin/librespot', [
            "-n",
            "Betty Spotify Sync",
            "--backend",
            "pipe",
            "--initial-volume",
            "75",
            "-u",
            `${this.currentUser.display_name}`,
            "-v",
        ]);

The question is now can I just set the user device with /me/player to librespot? and if yes how do I get the device id of liberspot?

Some other infos: I only have the username and the access_token with enough rights of a user. (Yes this all is wanted by the target user its nothing ilegal!)

Is this even possible with librespot?

Thanks for any reply!

Originally posted by @fb-sean in https://github.com/librespot-org/librespot/discussions/1142

dspearson commented 1 year ago

Not really a question related to this project. You're asking how to use the Web API.

I suggest you read the Spotify Web API documentation, specifically get available devices (where you can obtain the device_id), transfer playback & start/resume playback (you can see device_id is a parameter for example).