justinknguyen / BeatBind

A background Python Windows application for global hotkeys on Spotify.
MIT License
50 stars 7 forks source link
global-hotkeys hotkeys python spotify spotify-web-api spotipy windows

IMPORTANT NEWS

Due to rising Spotify Premium costs in Canada, it is more expensive than Apple Music now.

I've switched to Apple Music, but it doesn't mean I won't continue supporting this app. I'll try my best to resolve any issues, but I can't guarantee I'll be able to solve all of them. Some issues may require me to have Spotify Premium to fix.

Thanks for all of the love and support <3

BeatBind - Spotify Global Hotkeys

build version python contributions welcome

Are you tired of constantly switching back and forth between your game and Spotify just to adjust the volume? With this app, you can control Spotify and adjust it's volume separately, all without the hassle of alt+tabbing.

This background Python Windows application utilizes the global_hotkeys module to listen for hotkeys, allowing users to easily control Spotify without the window focused. The app leverages the power of Spotify's Web API through the use of Spotipy, providing seamless integration between the app and the music streaming platform.

You'll create your own Spotify API to control your Spotify application. YOU are the one in control.



This app does not control your Spotify locally. It sends an API request to Spotify over the internet to control your listening experience, so expect a slight delay. The delay experienced can vary depending on your internet speed.

Please see FAQ for more information and Troubleshooting if you encounter any issues. If your issue isn't listed, please create an Issue ticket.

Table of Contents

Download

Download the latest version from the Releases page.

You can build the .exe yourself with the provided nuitka build command in the build.py file.

Requirements

Instructions

After downloading the .zip folder, extract the BeatBind folder somewhere on your computer.

If you extracted it to your Program Files folder, you'll need to run the app in admin mode to be able to write and save your settings and token. I recommend placing it somewhere else.

The app requires the user to input three fields:

Client ID and Client Secret

  1. To obtain the Client ID and Client Secret, head to the following link Spotify for Developers.
  2. Sign-in and click on your profile in the top-right corner, then click on "Dashboard".
  3. Click on the "Create app" button to the right.
  4. Enter any "App name" and "App description" you want.
  5. In the app, you can change the Port field if it's already being used on your local network.
  6. Back on the website, enter the following into "Redirect URI" with the port you chose (e.g., 8888):
    http://localhost:8888/callback
  7. Click on the checkbox and then "Save".

  8. Click on the "Settings" button to the top-right.
  9. Copy your Client ID and Client Secret (press "View client secret") and paste it into the BeatBind app.

Device ID

  1. To obtain your Device ID, press the button "Get Devices" in the BeatBind app once your Client ID and Client Secret are filled in.
  2. Click on the drop-down arrow and select your device of choice.
  3. If you don't see your device listed:
    • Open the Spotify app (not the web player) on that device and play something, then check again.
    • If you still don't see your devices, manually obtain it by heading to this link and then click on the green "Try it" button to the right. Copy and paste the id into the app.

Once you're done, click on Save within the app to save your settings.
Then click on Start & Close to close the window and start listening for your hotkeys!

(You can open the settings again by right-clicking on the app's system tray icon.)

Updating

  1. Copy and save your BeatBind/beatbind-config.json file somewhere
  2. Replace your BeatBind folder with the updated version
  3. Paste inside the BeatBind folder your saved beatbind-config.json file

Troubleshooting

Please go through the below steps before creating an Issue ticket.

  1. Check the log file BeatBind/beatbind.log to see what's the problem.
  2. If it's an error about tokens, delete your .cache file in the folder. This can happen if you changed your Spotify credentials.
  3. Is your issue hotkey related? This app uses the global_hotkeys module by btsdev: https://github.com/btsdev/global_hotkeys. I recommend creating the Issue ticket there so they can solve your issue. Once it's solved, create an Issue ticket here and let me know to update the app.
  4. Exclude the BeatBind folder from your anti-virus software.
  5. If your settings are not saving, please see Why Are My Settings Not Saving?
  6. If your app is not starting/opening, please see Why Is The App Crashing?
  7. If your app is not starting on Windows startup, please see Why Isn't The App Starting on Windows Startup?
  8. If you're getting a "Server listening on localhost has not been accessed error", please see Server Listening On Localhost Has Not Been Accessed Error and Issue #12
  9. Make sure your Client ID and Secret is correct and matches what is displayed in the Spotify developer site.
  10. Check if you have the Spotify app installed, and make sure the Device ID selected is the correct one.
  11. Check if you're able to see the app within the system tray after pressing Start & Close.
  12. After confirming the above and it still doesn’t work, it is likely a port problem and you’re already using the selected port on your network. Choose a different port in the app, and also change the Redirect URI set in the Spotify developer site.

FAQ

Spotify Free Users?

Unfortunately, the endpoints used in Spotify's Web API only works for Spotify premium users, so it's not possible for this app to work for free users. There are other apps online that work locally instead, allowing it to work for free and premium users.

How Do I Disable Certain Hotkeys?

  1. Uncheck all of the Modifiers checkboxes.
  2. In the Key field, press "Backspace" or "Delete" on your keyboard to clear the field.

Where Is My Information Saved?

Your configuration settings are stored locally in BeatBind/beatbind-config.json.

In case you experience any issues, you can the logs in BeatBind/beatbind.log.

Why Are My Settings Not Saving?

You most likely extracted the BeatBind folder into a location where it requires Administrator privileges, such as the Program Files folder. Place the BeatBind folder into a different location, or try running the app in admin mode.

Why Isn't The App Starting on Windows Startup?

This happens if the location of the .exe file was changed. The registry key used to start the app on Windows startup needs to be updated to the new .exe path. Starting the app again will update the path in the registry key and should resolve the issue.

If it still does not resolve the issue, try moving the BeatBind folder into a another location, such as your desktop.

You can check if the registry key was added correctly in the following path of Registry Editor:

Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run

Why Is The App Crashing?

My Hotkeys Stop Registering After Waking From Sleep

There are rare cases where hotkeys stop registering on system wake up from sleep, and pressing Start & Close button again fixes the listener. For a more permanent fix, try disabling Windows Fast Startup.

If the bug keeps occurring after disabling Fast Startup, please create an Issue ticket.

Server Listening On Localhost Has Not Been Accessed Error

Please see the top answer solution from here https://superuser.com/questions/565409/how-to-stop-an-automatic-redirect-from-http-to-https-in-chrome

  1. Go to chrome://net-internals/#hsts. Enter example.com under "Delete domain security policies" and press the "Delete" button.
  2. Now go to chrome://settings/clearBrowserData, tick the box "Cached images" and "files" and press the button "Clear data".