librespot icon indicating copy to clipboard operation
librespot copied to clipboard

Volume control

Open tatoosh opened this issue 6 years ago • 5 comments

Is there a solution to control music Volumen by command line ?

tatoosh avatar Jan 27 '18 09:01 tatoosh

I don't think librespot is the place for this. You might have a look at spotipy (https://github.com/plamere/spotipy) to create a python scrip to control the volume..

thekr1s avatar Jan 28 '18 00:01 thekr1s

Just to add for reference spotcontrol.

ComlOnline avatar Jan 29 '18 17:01 ComlOnline

@thekr1s thx for the link, but i can't find volume control for spotipy @ComlOnline: great, but it's not python just 'go' - any other suggestions?

tatoosh avatar Feb 09 '18 13:02 tatoosh

@thekr1s got it working :)

python volume.py 80 -> sets volume to 80%

here my working python code_

import pprint
import sys

import spotipy
import spotipy.util as util

scope = 'user-modify-playback-state'
username = 'YOURUSER'
token = util.prompt_for_user_token(username,scope,client_id='mine!',client_secret='mine!',redirect_uri='http://localhost:8888/callback/')
volume  = int(sys.argv[1])

if token:
    sp = spotipy.Spotify(auth=token)
    sp.trace = False
    results = sp.volume(volume)
    print results
else:
    print "Can't get token for", username

tatoosh avatar Feb 09 '18 14:02 tatoosh

@tatoosh, Great that you got it working.

thekr1s avatar Feb 18 '18 22:02 thekr1s