Mint Serena 64 bit using the Mate desktop environment. Most of the following scripts will run on this machine, although some have only been tested with the Gnome desktop. Extra software requirements can be met by the Ubuntu and safe PPA repositories. Scripts may be re-written or added to from time to time, the date serves as the version number. Syntax highlighting on these pages is provided by GVim's "Convert to HTML" option.

DAB Radio


#!/bin/bash
# Filename: dab-radio.sh
# Version.: 07022018
# Author..: robz
# Basic DAB radio via a cheap DVB-T dongle using a "zenity" gui and the command
# line version of "vlc player", see man vlc. The utility "wmctrl" places the gui
# top left of the screen. The initial scanning for radio stations I used the
# "w_scan" utility to create a playlist text file.

text="Make a selection"
optn=":dvb-frequency=522000000 :dvb-bandwidth=8 :dvb-ts-id=4168 \
:dvb-code-rate-hp=2/3 :dvb-modulation=64QAM :dvb-transmission=8 \
:dvb-guard=1/32 :program="

get_mplex () {
prog=$(zenity --list --radiolist --height=400 --width=200 --hide-header \
--title='robz DAB Radio' --text="$text" --column '' --column '' --column '' \
--hide-column=3 --print-column=ALL --ok-label='Play' \
FALSE 'BBC Radio 1' '6720' \
FALSE 'BBC Radio 1 Extra' '5888' \
FALSE 'BBC Radio 2' '6784' \
FALSE 'BBC Radio 3' '6848' \
FALSE 'BBC Radio 4' '6912' \
FALSE 'BBC Radio 4 Extra' '5824' \
FALSE 'BBC World Service' '6016' \
FALSE 'BBC Radio 5 Live' '5632' \
FALSE 'BBC Radio 5 Sport' '5696' \
FALSE 'BBC Radio 6 Music' '5760' \
FALSE 'BBC Manchester' '6152' \
FALSE 'BBC Lancashire' '6216'
)
}

while true; do
    (sleep .5 && wmctrl -r "robz DAB Radio" -e 1,0,0,200,400) &
    get_mplex
    text="<b>Playing: $(cut -d'|' -f1 <<< $prog)</b>"
    prog="$(cut -d'|' -f2 <<< $prog)"
    pkill -9 vlc
    if [ "$prog" = '' ]; then exit; fi
    (cvlc dvb-t:// $optn$prog > /dev/null 2>&1) &
done


No comments: