Script to change settings

Solved!
Reply
Highlighted

Script to change settings

jlengrand
Casual Listener

Hi there!

 

I am using Spotify desktop on my MBP.

 

At the office, we use a proxy and I have configured spotify to go through the proxy. At home, I don't use anything. 

 

This means that every day, I have to go back to my settings, disable / enable the proxy and restart spotify. This is very annoying.

So annoying in fact that I started using the web player at home . . . 

 

I'd like to know if there is a way to change the settings of spotify without having to go through the UI. For example in a file, or something equivalent. 

That would allow me to write a simple script to enable / disable the proxy. 

 

Any other suggestions are welcome of course. 

 

Thanks, 

Julien

1 ACCEPTED SOLUTION

Accepted Solutions
Solution!

Re: Script to change settings

jlengrand
Casual Listener

Alright, so after diving deep into the rabbit hole I finally found a way. 

 

It appears that on Mac, the settings file for Spotify is located in 

$HOME/Library/Application Support/Spotify/prefs.
 
When the proxy is deactivated, you can see the line : network.proxy.mode=1.
 
To activate the proxy, you can change the settings to mode 2 instead (network.proxy.mode=2).
 
Now all is left ot do is to automate this.
 
You can find a complete script on Github
 
In short, the script
  1. Checks the preference file exists
  2. proxy line of the file (depending you want it on or off)
  3. Restarts Spotify in case it was running

 

Hope this is useful for someone :).

 

Cheers!

 
1 Reply
Solution!

Re: Script to change settings

jlengrand
Casual Listener

Alright, so after diving deep into the rabbit hole I finally found a way. 

 

It appears that on Mac, the settings file for Spotify is located in 

$HOME/Library/Application Support/Spotify/prefs.
 
When the proxy is deactivated, you can see the line : network.proxy.mode=1.
 
To activate the proxy, you can change the settings to mode 2 instead (network.proxy.mode=2).
 
Now all is left ot do is to automate this.
 
You can find a complete script on Github
 
In short, the script
  1. Checks the preference file exists
  2. proxy line of the file (depending you want it on or off)
  3. Restarts Spotify in case it was running

 

Hope this is useful for someone :).

 

Cheers!

 
SUGGESTED POSTS