Skip to content

Instantly share code, notes, and snippets.

@shmup
Last active September 26, 2023 18:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shmup/5f963115b7dfc02647fc0d732275a277 to your computer and use it in GitHub Desktop.
Save shmup/5f963115b7dfc02647fc0d732275a277 to your computer and use it in GitHub Desktop.
overlap a music with a scanner
#!/usr/bin/env bash
# overlap a music with a scanner
# needs mpv or vlc
DRONE_URL="https://somafm.com/darkzone256.pls"
DRONE_VOL=70
SCANNER_URL="https://somafm.com/nossl/scanner.pls"
SCANNER_VOL=100
original_settings=$(stty -g)
if command -v mpv &> /dev/null; then
walkman="mpv"
quiet_arg="--really-quiet"
elif command -v vlc &> /dev/null; then
walkman="cvlc"
quiet_arg="--quiet"
else
echo "needs mpv or vlc"
exit 1
fi
$walkman --volume=$DRONE_VOL $DRONE_URL &
darkzone=$!
$walkman $quiet_arg --volume=$SCANNER_VOL $SCANNER_URL &
scanner=$!
cleanup() {
kill $darkzone $scanner
stty "$original_settings"
}
trap cleanup INT TERM
wait $darkzone $scanner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment