Last active
September 26, 2023 18:21
-
-
Save shmup/5f963115b7dfc02647fc0d732275a277 to your computer and use it in GitHub Desktop.
overlap a music with a scanner
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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