Here's a simple script that mutes your master audio if spotify starts playing an ad. Then unmutes once the ad is over.
git clone https://www.github.com/verma16Ayush/spotad.git
pip install -r requirements.txt
- Go to https://developer.spotify.com/dashboard and sign in with your Spotify account.
- Click on the
'CREATE AN APP'
option and provide an app name and app description as you'd like. - Go to
'EDIT SETTINGS'
and fill in the Redirect URIs placeholder withhttp://localhost:8080/
, and click on Save. - Copy the
Client ID
andClient Secret
and paste it in the corresponding placeholders in'.env'
file. - Paste your spotify username in the username placeholder in
'.env'
file
Once above steps are done you can play music and run this in the background. Or better yet, make this script a daemon. You might need to add a hashbang at the top. Follow this
Tested only on Ubuntu 20.04