daniel5151 / spotify-car-thing-bt

code to connect + communicate with a Spotify Car Thing
27 stars 4 forks source link

Getting connected with Spotify #1

Open timonsku opened 1 year ago

timonsku commented 1 year ago

I compiled and installed the extension for spicetify and the rust app seems to connect successfully to the Car Thing but I get a "Not logged in" error on the car thing itself and I'm not sure there is an actual websocket connection to the Spotify extension as I don't know how to verify that, the log doesn't show anything obvious other than the BT connection log.

Should the extension show up under the Installed tab in the Marketplace menu? In spicetify there is deskthing-spotify-bridge.js under the Extensions folder, ran apply after the build script placed it there.

daniel5151 commented 1 year ago

when I last left off this project, I had the carthing reconnecting pretty consistently, but I don't think I cracked the nut on handling spotify client reconnect perfectly... I wonder if it has anything to do with that?

In any case, please share any logs you're seeing, in case there's a clue there.

Also, you can double-check that the extension is successfully loaded by enabling dev-tools via spicetify, and checking if you see (deskthing bridge) logs in the JS console. I don't think it shows up in the Marketplace menu...

adambnmohd commented 1 year ago

@timonsku how do i get the deskthing-spotify-bridge.js

marksmello commented 1 year ago

Is someone willing to share their code for their spicetify extension?

BillionJothi commented 1 year ago

I initially had not logged in error but fixed it after ensuring deskthing-spotify-bridge is working. The extension does not appear in the installed tab for me but resolved the not logged in error

@timonsku how do i get the deskthing-spotify-bridge.js

  1. Install Spicetify
  2. Install Node
  3. Run commands in CMD:
    • npm install zustand
    • npm install spicetify-creator
  4. Clone / Zip deskthing and go into spicetify_ext folder only (We only need this folder - can copy out to a new location etc)
  5. Run npm run-script build
  6. Find deskthing-spotify-bridge.js in your spicetify extensions folder
  7. Install above extension
    • spicetify config extensions deskthing-spotify-bridge.js
    • spicetify apply

I compiled and installed the extension for spicetify and the rust app seems to connect successfully to the Car Thing but I get a "Not logged in" error on the car thing itself and I'm not sure there is an actual websocket connection to the Spotify extension as I don't know how to verify that, the log doesn't show anything obvious other than the BT connection log.

Should the extension show up under the Installed tab in the Marketplace menu? In spicetify there is deskthing-spotify-bridge.js under the Extensions folder, ran apply after the build script placed it there.

I think you didn't configure the extension into spicetify (even tho already exists in the extension folder - seems still require running the configure command). Was facing similar issue before adding the configurations. Configure then apply

jdwede commented 7 months ago

@BillionJothi @timonsku @daniel5151

How do you connect the Rust app to the Car Thing?

I'm able to confirm the rust app connects to the spicetify extension via websockets, but stuck on waiting for bt connection on RFCOMM port.... Can't seem to get the car thing to show up as a device in windows...

EDIT: Nevermind, was able to get the Car Thing to show up on Windows by adding the device in control panel while the car thing was in pairing mode. Works now. Not sure why it wasn't showing up in the Win11 settings app, but it showed up in Control Panel.

jdwede commented 7 months ago

I noticed the shuffle and save buttons weren't working so I fixed them. Add this code snippet to your deskthing-spotify-bridge.js:


  registerRpcEvent(
    ["com.spotify.set_shuffle", "com.spotify.superbird.shuffle"],
    async ({ argsKw: { shuffle } }) => {
      await Spicetify.Platform.PlayerAPI.setShuffle(shuffle);
    }
  );
  registerRpcEvent(
    ["com.spotify.set_saved", "com.spotify.superbird.set_saved"],
    async ({ argsKw: { saved } }) => {
      await Spicetify.Player.toggleHeart();
    }
  );
jdwede commented 7 months ago

This snippet will also fix the seeking function when you click and drag on the progress bar on the current song:


  registerRpcEvent(
    ["com.spotify.set_playback_position"],
    async ({ argsKw: { position_ms } }) => {
      await Spicetify.Player.seek(position_ms);
    }
  );