Add proxy to mpd service

Raspberry Pi related support

Add proxy to mpd service

Postby mlaky » 21 Mar 2019, 16:36

Hi!

I'm listen webradios on work behind firewall, so I need to add proxy to mpd service (input section in mpd.conf).
How to add this correctly? (because if I add proxy to /etc/mpd.conf it's dissapear after reboot)?

Best regards,
Mlaky
mlaky
 
Posts: 9
Joined: 16 Mar 2019, 13:12

Re: Add proxy to mpd service

Postby janui » 21 Mar 2019, 17:16

Hi mlaky,
If you want to add one or more single lines in /etc/mpd.conf use this:
Code: Select all
redis-cli hset mpdconf parameter value
It will appear in mpd.conf as:
Code: Select all
parameter = "value"
Remove it with this:
Code: Select all
redis-cli hdel mpdconf parameter

If you need to add a block of lines, create a file called:
Code: Select all
/home/your-extra-mpd.conf
Its contents will be included in /etc/mpd.conf
janui
User avatar
janui
 
Posts: 704
Joined: 20 Dec 2014, 12:55
Location: Ollanda

Re: Add proxy to mpd service

Postby janui » 22 Mar 2019, 17:18

Hi mlaky,
You can configure curl to use a proxy without changing mpd.conf. Create a file called:
Code: Select all
~/.curlrc
With the contents:
Code: Select all
proxy = <proxy_host>:<proxy_port>

Search for "~/.curlrc proxy" for more information.
janui
User avatar
janui
 
Posts: 704
Joined: 20 Dec 2014, 12:55
Location: Ollanda

Re: Add proxy to mpd service

Postby mlaky » 26 Mar 2019, 11:33

janui wrote:Hi mlaky,
If you want to add one or more single lines in /etc/mpd.conf use this:
Code: Select all
redis-cli hset mpdconf parameter value
It will appear in mpd.conf as:
Code: Select all
parameter = "value"
Remove it with this:
Code: Select all
redis-cli hdel mpdconf parameter

If you need to add a block of lines, create a file called:
Code: Select all
/home/your-extra-mpd.conf
Its contents will be included in /etc/mpd.conf
janui


I try this and it's working! :)

The only thing is that I use deprecated property for proxy in mpd.conf - http_proxy_host

Better way will be to use proxy property inside input section (after curl property)

Do you know how to add that with redis-cli?
mlaky
 
Posts: 9
Joined: 16 Mar 2019, 13:12

Re: Add proxy to mpd service

Postby mlaky » 26 Mar 2019, 11:33

janui wrote:Hi mlaky,
You can configure curl to use a proxy without changing mpd.conf. Create a file called:
Code: Select all
~/.curlrc
With the contents:
Code: Select all
proxy = <proxy_host>:<proxy_port>

Search for "~/.curlrc proxy" for more information.
janui


I try this but this not work. :?
mlaky
 
Posts: 9
Joined: 16 Mar 2019, 13:12

Re: Add proxy to mpd service

Postby janui » 26 Mar 2019, 13:39

Hi mlaky,
mlaky wrote:...Better way will be to use proxy property inside input section (after curl property)...Do you know how to add that with redis-cli?...
There is some code in RuneAudio for proxy support. It has no UI and has not been switched on for several years. It looks like it will work for the MPD input section, but it is also used for all sorts of other curl commands. So it may cause other problems, you will (at least) need to test dirble, lastfm, artistinfo and albumart. These are the commands to set it up:
Code: Select all
redis-cli hset proxy enable 1
redis-cli hset proxy host <YourProxyHost>
redis-cli hset proxy user <ProxyHostUser>
redis-cli hset proxy pass <ProxyHostPassword>
Replace <YourProxyHost>, <ProxyHostUser> and <ProxyHostPassword> with your own values.
You can set it up without a user and password, then set <ProxyHostUser> and <ProxyHostPassword> to null, like this:
Code: Select all
redis-cli hset proxy host ''
redis-cli hset proxy user ''
Check it with:
Code: Select all
redis-cli hgetall proxy
Switch it off with:
Code: Select all
redis-cli hset proxy enable 0
Great if it still works.
janui
User avatar
janui
 
Posts: 704
Joined: 20 Dec 2014, 12:55
Location: Ollanda

support RuneAudio Donate with PayPal


Return to Raspberry Pi

Who is online

Users browsing this forum: No registered users and 10 guests