A collaborative music bot, written in bash! (in an afternoon to win a bet!)
- A PulseAudio server
The bot is used to play music to a PulseAudio server with the following modules enabled in default.pa:
load-module module-esound-protocol-tcp
load-module module-native-protocol-tcp
pulseaudio
(to export the sound to the PulseAudio server, and to have access topactl
)socat
youtube-dl
- A music player
cvlc
is used here, the bot has also been tested withmplayer
andmpv
- Any way of opening a raw read/write socket to a given IP and port.
Examples:
nc <IP> <PORT>
(doesn't seems to handle CTRL+D correctly)
socat TCP:<IP>:<PORT> -
(seems to work just fine with CTRL+D)
- Download
music_bot.sh
on the server - Edit
music_bot.sh
and change the configuration variables at the beginning of the file - Create the folder specified in
BOT_MUSIC_DIRECTORY
on the server chmod +x music_bot.sh
./music_bot.sh
nc <SERVER IP> <PORT SPECIFIED IN BOT_LISTEN_PORT>
from any client- Enjoy!