Transform your music experience with G-Assist! This plugin lets you control Spotify using simple voice commands or the G-Assist interface. Whether you want to play your favorite tracks, manage playlists, or control playback, managing your Spotify has never been easier.
- Control Spotify playback (play, pause, next, previous)
- Toggle shuffle mode
- Adjust volume levels
- Queue tracks for playback
- Access and manage your playlists
- Interactive setup wizard for first-time configuration
- Seamlessly integrates with your G-Assist setup
Make sure you have:
- Windows PC
- Python 3.8 or higher installed on your computer
- Spotify Account (Free or Premium)
- Spotify Developer Account
- G-Assist installed on your system
💡 Tip: Some Spotify Web API functions are only available to Premium subscribers. Check the API documentation for details!
- Sign up for Spotify at https://accounts.spotify.com/en/login
- Create a Developer Account at https://developer.spotify.com/
- Accept the developer terms of service
- Go to https://developer.spotify.com/dashboard
- Click "Create App" and enter:
- App Name: G-Assist Spotify Plugin
- App Description: Spotify integration for G-Assist
- Redirect URI:
http://127.0.0.1:8888/callback - Select "Web API" in Permissions
- Accept the Developer Terms of Service and create the app
The Redirect URI MUST be exactly: http://127.0.0.1:8888/callback
| ❌ Won't Work | ✅ Use This |
|---|---|
http://localhost:8888/callback |
http://127.0.0.1:8888/callback |
https://127.0.0.1:8888/callback |
http://127.0.0.1:8888/callback |
http://127.0.0.1:8888/callback/ |
http://127.0.0.1:8888/callback |
Spotify requires an exact string match. Using localhost instead of 127.0.0.1 will cause an "INVALID_CLIENT: Invalid redirect URI" error.
Create a config.json file with your app credentials:
{
"client_id": "<Your Client ID>",
"client_secret": "<Your Client Secret>"
}💡 Note: The setup wizard will guide you through this configuration on first use if the file is empty.
From the plugins/examples directory, run:
setup.bat spotifyThis installs dependencies to the libs/ folder and copies the G-Assist SDK.
To deploy the plugin to G-Assist:
setup.bat spotify -deploy💡 Tip: Make sure all G-Assist clients are closed when deploying!
Once installed, you can control Spotify through G-Assist. Try these commands:
- Start Playback:
Hey Spotify, play my music! - Play a song:
Hey Spotify, play Life Itself by Glass Animals - Play an album:
Hey Spotify, play reputation by Taylor Swift - Play an artist:
Hey Spotify, play Taylor Swift
- Pause playback:
Hey Spotify, pause it - Skip track:
Hey Spotify, go to the next song - Skip to previous track:
Hey Spotify, go to the previous song - Toggle shuffle:
Hey Spotify, turn shuffle [on/off] - Volume control:
Hey Spotify, set the volume to 30 - Queue a track:
Hey Spotify, add Heat Waves by Glass Animals to the queue
- Get current playback:
Hey Spotify, what song is playing? - Get top playlists:
Hey Spotify, what are my top 5 playlists
The plugin uses fully automated OAuth 2.0 authentication. No manual steps required!
-
First-time Setup
- Run any Spotify command (e.g.,
Hey Spotify, what are my top playlists?) - A browser window will open automatically
- Log in to Spotify and authorize the app
- That's it! The plugin automatically:
- Catches the OAuth callback on 127.0.0.1:8888
- Exchanges the code for access/refresh tokens
- Saves tokens to
auth.json - Retries your original command
💡 No URL copying needed! The plugin handles everything automatically.
- Run any Spotify command (e.g.,
-
Subsequent Uses
- The plugin automatically uses your saved tokens
- If tokens expire, they are automatically refreshed
- No manual intervention needed
-
Troubleshooting Authentication
- If you see authentication errors, delete
%PROGRAMDATA%\NVIDIA Corporation\nvtopps\rise\plugins\spotify\auth.json - The plugin will re-authenticate automatically on next use
- Check the log file at
%PROGRAMDATA%\NVIDIA Corporation\nvtopps\rise\plugins\spotify\spotify-plugin.logfor detailed error messages - Make sure port 8888 is not blocked by firewall
- If you see authentication errors, delete
💡 Tip: The entire OAuth flow is automated - just authorize once in the browser and you're done!
The plugin includes these main functions:
spotify_start_playback: Start playing musicspotify_pause_playback: Pause the current trackspotify_next_track: Skip to next trackspotify_previous_track: Go to previous trackspotify_shuffle_playback: Toggle shuffle modespotify_set_volume: Adjust volumespotify_get_currently_playing: Get current track infospotify_queue_track: Add a track to queuespotify_get_user_playlists: List your playlists
The plugin logs all activity to:
%PROGRAMDATA%\NVIDIA Corporation\nvtopps\rise\plugins\spotify\spotify-plugin.log
Check this file for detailed error messages and debugging information.
| Problem | Solution |
|---|---|
| Plugin not working | Verify files are deployed and restart G-Assist |
| Can't authenticate | Double-check client ID/secret in config.json, delete auth.json |
| "INVALID_CLIENT: Invalid redirect URI" | Redirect URI doesn't match exactly. Must be http://127.0.0.1:8888/callback (not localhost, not https, no trailing slash) |
| Port 8888 in use | Check if another app is using port 8888, or update redirect_port in config.json |
| No active device found | Open Spotify and start playing something first |
The Spotify plugin is built using the G-Assist SDK (gassist_sdk) and communicates with Spotify's Web API for music playback control and user information retrieval.
The plugin uses the SDK's decorator-based command registration:
from gassist_sdk import Plugin
plugin = Plugin(name="spotify", version="2.0.0", description="Control Spotify playback")
@plugin.command("spotify_start_playback")
def spotify_start_playback(name: str = "", type: str = "track", artist: str = ""):
# Implementation
pass- Stored in
config.json - Location:
%PROGRAMDATA%\NVIDIA Corporation\nvtopps\rise\plugins\spotify\config.json - Required fields:
{ "client_id": "your_client_id", "client_secret": "your_client_secret" }
spotify_start_playback(): Start/resume playback- Supports tracks, albums, and artists
- Handles device selection and search
- Parameters: type, name, artist
spotify_pause_playback(): Pause playbackspotify_next_track(): Skip to next trackspotify_previous_track(): Go to previous trackspotify_shuffle_playback(): Toggle shuffle modespotify_set_volume(): Adjust volume (0-100)spotify_queue_track(): Add track to queue
spotify_get_currently_playing(): Get current track infospotify_get_user_playlists(): List user playlists
spotify_api(): Core function for making authenticated API callsget_device_id(): Get active playback devicedo_oauth_flow(): Perform OAuth 2.0 authorizationrefresh_token(): Refresh expired access tokens
- First command triggers setup wizard if not configured
do_oauth_flow(): Opens browser, starts local callback server- User authorizes in browser, callback receives auth code
- Code exchanged for access/refresh tokens
- Tokens saved to
auth.jsonfor future use - Automatic token refresh on 401 errors
- Stored in
auth.json - Location:
%PROGRAMDATA%\NVIDIA Corporation\nvtopps\rise\plugins\spotify\auth.json - Contains access_token and refresh_token
- Log file:
%PROGRAMDATA%\NVIDIA Corporation\nvtopps\rise\plugins\spotify\spotify-plugin.log - Log level: INFO
- Format:
%(asctime)s - %(levelname)s - %(message)s
- API errors are logged with status codes and response bodies
- User-friendly error messages returned to G-Assist
- Automatic re-authentication on 401 errors
- Premium-required (403) errors handled gracefully
- Create a new function with the
@plugin.command()decorator - Add proper error handling and logging
- Update
manifest.jsonwith the new function definition:{ "name": "new_command", "description": "Description of what the command does", "tags": ["relevant", "tags"], "properties": { "parameter_name": { "type": "string", "description": "Description of the parameter" } } }
-
Local test - Run directly to check for syntax errors:
python plugin.py
-
Deploy - From
plugins/examplesdirectory:setup.bat spotify -deploy
-
Plugin emulator - Test commands without G-Assist:
python -m plugin_emulator -d "C:\ProgramData\NVIDIA Corporation\nvtopps\rise\plugins"Then select the spotify plugin and test commands interactively.
-
G-Assist test - Open G-Assist and try voice commands like "Hey Spotify, what's playing?"
We'd love your help making this plugin even better! Check out CONTRIBUTING.md for guidelines on how to contribute.
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
- Built using the Spotify Web API
- We use some amazing open-source software to make this work. See ATTRIBUTIONS.md for the full list.