1 (15.08.2014 16:16:06 отредактировано m@xim)

Cлушаем онлайн радио используя всем известный mplayer.

http://i.imgur.com/FVp1e8V.gif

#!/bin/bash
########################################################
# cli_radio                                            #
# based on IceFox radio-select script                  #                                                    
########################################################
# set colors
RED='\e[41m'
BLUE='\e[44m'
CYAN='\e[46m'
NC='\e[0m'
# set player
PLAYER="/usr/bin/mplayer"
# verify if $PLAYER is installed
if [ -e $PLAYER ]; then
    # stop current $PLAYER session
    if [ "$(pidof mplayer)" ]; then
        killall mplayer
    fi
    while true; do
    clear
    echo ""
    echo " ·····················································"
    echo " ·             select a station and play             ·"
    echo " ·                                                   ·"
    echo -e " · $CYAN[space]$NC to pause, $CYAN[q]$NC to stop, $CYAN[Ctrl]+[c]$NC to quit ·"
    echo " ·····················································"
    echo ""
    echo " ·································································"
    echo -e " ·  $BLUE  1 $NC  Groove Salad                    $BLUE  2 $NC  Lush             ·"
    echo -e " ·  $BLUE  3 $NC  Earwaves                        $BLUE  4 $NC  Deap Space One   ·"
    echo -e " ·  $BLUE  5 $NC  Drone Zone                      $BLUE  6 $NC  Pop Tron         ·"
    echo -e " ·  $BLUE  7 $NC  Def Con                         $BLUE  8 $NC  Dub Step Beyond  ·"
    echo -e " ·  $BLUE  9 $NC  Space Station Soma              $BLUE 10 $NC  Mission Control  ·"
    echo -e " ·  $BLUE 11 $NC  Indie Pop Rocks!                $BLUE 12 $NC  Folk Forward     ·"
    echo -e " ·  $BLUE 13 $NC  BAGel Radio                     $BLUE 14 $NC  Digitalis        ·"
    echo -e " ·  $BLUE 15 $NC  Sonic Universe                  $BLUE 16 $NC  Secret Agent     ·"
    echo -e " ·  $BLUE 17 $NC  Suberbs of Goa                  $BLUE 18 $NC  Boot Liquor      ·"
    echo -e " ·  $BLUE 19 $NC  Illinois St. Lounge             $BLUE 20 $NC  The Trip         ·"
    echo -e " ·  $BLUE 21 $NC  cliqhop idm                     $BLUE 22 $NC  Covers           ·"
    echo -e " ·  $BLUE 23 $NC  Beat Blender                    $BLUE 24 $NC  Doomed           ·"
    echo -e " ·  $BLUE 25 $NC  Black Rock FM                   $BLUE 26 $NC  SF 10-33         ·"
    echo -e " ·  $BLUE 27 $NC  custom link...                  $BLUE 28 $NC  custom link...   ·"
    echo " ·································································"
    echo ""
    echo -e " select a $BLUE number $NC from 1 to 26 then hit $CYAN[Enter]$NC"
    echo ""
    read choix
    case $choix in
        1)
            $PLAYER http://uwstream1.somafm.com:80
            ;;
        2)
            $PLAYER http://sfstream1.somafm.com:8800
            ;;
        3)
            $PLAYER http://sfstream1.somafm.com:5100
            ;;
        4)
            $PLAYER http://sfstream1.somafm.com:2800
            ;;
        5)
            $PLAYER http://uwstream2.somafm.com:80
            ;;
        6)
            $PLAYER http://sv1.vestaradio.com:7420
            ;;
        7)
            $PLAYER http://sfstream1.somafm.com:2200
            ;;
        8)
            $PLAYER http://sfstream1.somafm.com:6200
            ;;
        9)
            $PLAYER http://uwstream2.somafm.com:2666
            ;;
        10)
            $PLAYER http://sfstream1.somafm.com:2020
            ;;
        11)
            $PLAYER http://sfstream1.somafm.com:8090
            ;;
        12)
            $PLAYER http://sfstream1.somafm.com:7400
            ;;
        13)
            $PLAYER http://sfstream1.somafm.com:9090
            ;;
        14)
            $PLAYER http://sfstream1.somafm.com:8900
            ;;
        15)
            $PLAYER http://sfstream1.somafm.com:8850
            ;;
        16)
            $PLAYER http://uwstream2.somafm.com:9016
            ;;
        17)
            $PLAYER http://sfstream1.somafm.com:8850
            ;;
        18)
            $PLAYER http://sfstream1.somafm.com:7000
            ;;
        19)
            $PLAYER http://sfstream1.somafm.com:8500
            ;;
        20)
            $PLAYER http://sfstream1.somafm.com:2504
            ;;
        21)
            $PLAYER http://uwstream2.somafm.com:2668
            ;;
        22)
            $PLAYER http://sfstream1.somafm.com:8700
            ;;
        23)
            $PLAYER http://sfstream1.somafm.com:8384
            ;;
        24)
            $PLAYER http://sfstream1.somafm.com:8300
            ;;
        25)
            $PLAYER http://sfstream1.somafm.com:8040
            ;;
        26)
            $PLAYER http://uwstream2.somafm.com:2040
            ;;
        27)
            echo ""
            echo "put your custom link here"
            echo ""
            read customlink
            $PLAYER $customlink
            ;;
        28)
            echo ""
            echo "put your custom link here"
            echo ""
            read customlink
            $PLAYER $customlink
            ;;
        *)
            echo -e "$RED wrong choice $NC"
            echo "try again..."
            echo ""
            sleep 2
            clear
            ;;
    esac
    done
else
    echo " this script need mplayer"
    echo " install it or change the PLAYER"
    echo "exiting ..."
    exit 0
fi
Fedora Workstation

2 (01.07.2012 17:22:28 отредактировано verg)

Прикрутим к Yakuake =)
Команда запуска этого скрипта для кнопки "Меню запуска приложений"  или "Cсылки на приложение" KDE4:
(одна строка)

qdbus org.kde.yakuake /yakuake/sessions addSession && qdbus org.kde.yakuake /yakuake/sessions runCommand 'sh /путь_до_скрипта/скрипт_radio' &&  qdbus org.kde.yakuake /yakuake/window org.kde.yakuake.toggleWindowState

(Для удобства: снять галку "Включить отклик запуска")

Или скриптом:

#!/bin/bash
qdbus org.kde.yakuake /yakuake/sessions addSession
qdbus org.kde.yakuake /yakuake/sessions runCommand 'sh /путь_до_скрипта_radio/скрипт_radio'
qdbus org.kde.yakuake /yakuake/window org.kde.yakuake.toggleWindowState

И не забыть сделать его исполняемым.