Last active
July 7, 2024 10:11
-
-
Save maalos/ba2954a610c750993d832561b21fbf60 to your computer and use it in GitHub Desktop.
Listen to Black Hornet Radio in your terminal! (Czech radio station with rock, metal and barely any ads)
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
#!/bin/bash | |
# DEPENDENCIES | |
# ffmpeg, jp2a, imagemagick, wget, bash, figlet | |
TEMP_PATH="/home/$USER/.bhr_temp" | |
mkdir -p $TEMP_PATH | |
function reload() { | |
html_content=$(curl -s 'https://bhradio.cz/plugin/program-white/dnes-hrajeme.php') | |
image_url=$(echo "$html_content" | grep -oP '(?<=<img src=").*?(?=")') | |
artist_song=$(echo "$html_content" | grep -oP '(?<=<strong>On AIR:</strong> <span class="onair-white">).*?(?= </span>)') | |
[ "$image_url" == "/porady/bhr_logo_sm.png" ] && image_url="https://bhradio.cz/porady/bhr_logo_sm.png" | |
wget $image_url -q -O "$TEMP_PATH/image" | |
convert "$TEMP_PATH/image" "$TEMP_PATH/image.jpg" | |
clear | |
jp2a "$TEMP_PATH/image.jpg" --fill --colors --height=$((`tput lines` - 7)) | |
figlet -t -k $artist_song | |
} | |
ffplay https://icecast2.play.cz/bhradio-192.mp3 -loglevel panic -autoexit -nodisp & | |
while true; do | |
reload | |
sleep 10 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment