A script in bash to switch MPD outputs to turn on and off RTP multicast across the LAN.
Simple bash script to turn off rtp by swapping pulseaudio pref files in
user config directory. Also toggles MPD.
Because RTP takes up bandwidth across your LAN.
Related: If you're having trouble with RTP and UFW, [see my UFW setup script](https://github.com/uriel1998/ufw-iptables-archer), or try using the following commands:
sudo iptables -A ufw-before-input -p igmp -d 188.8.131.52/4 -j ACCEPT
sudo iptables -A ufw-before-output -p igmp -d 184.108.40.206/4 -j ACCEPT
sudo ufw allow in proto udp from 220.127.116.11/4
sudo ufw allow in proto udp to 18.104.22.168/4
Related: If you're having problems with UFW clobbering your wifi, you can
filter it at the router level if you're using DD-WRT. Try this code in your
iptables -I FORWARD -m pkttype --pkt-type multicast -i br0 -j DROP
(via https://www.dd-wrt.com/phpBB2/viewtopic.php?t=39743&sid=9c70ab89bc1f41f3ca142036fe3c83b4 )
or if that doesn't work, try *this*
ebtables -A FORWARD -o "interface to block" --pkttype-type multicast -j DROP
ebtables -A OUTPUT -o "interface to block" --pkttype-type multicast -j DROP
(via https://www.dd-wrt.com/wiki/index.php/Setting_up_IPTV_without_impact_to_LAN_and_Wireless_traffic )
They should all be available in your distro.
Copy it. run it as necessary. I call it by a combination of a tasker task and SSH plugin.
If you have user configurations in $HOME/.config/pulse, you will want to
merge them into the included files. **$HOME/.config/pulse/default.pa will be overwritten.**
Remember, the user config can be only overriding values (if you include the default),
which I've done in these snippets.
You'll need to put in the appropriate pulseaudio switches as well.
You will want to edit the switcher script with the appropriate MPD outputs.
Use mpc to determine what outputs you switch to and from
Output 1 (Icecast Radio) is disabled
Output 2 (My Pulse Output) is enabled
Output 3 (MPD RTP) is disabled
```/usr/bin/ssh -F $HOME/.ssh/config -i $HOME/.ssh/my_rsa_key -q MPD_HOST 2> /dev/null < $HOME/rtpoff
```/usr/bin/ssh -F $HOME/.ssh/config -i $HOME/.ssh/my_rsa_key -q MPD_HOST 2> /dev/null < $HOME/rtpon
You're using those above to funnel a command into SSH, the command in question should be the only thing in those files.
* Use sed so that it's not clobbering user default.pa if you have additonal stuff in there.
* Detect MPD outputs so you don't have to hardcode them