Author Topic: RADIO VSIDO - VSIDO's very own Internet radio player  (Read 2656 times)

hakerdefo

  • Posts: 494
    • View Profile
    • Looking at Linux through the Windows of Life
RADIO VSIDO - VSIDO's very own Internet radio player
« on: July 20, 2015, 07:14:28 PM »
EDIT BEGINS (23, July 2015) :
Made changes to mplayer cache for efficient handling of streams.
EDIT ENDS:

Snap's topic here,
What do you use for radio?
inspired this script. Save it somewhere in your $PATH with the name 'radio_vsido' and 'chmod 755' it. I've included 43 radio stations. If you wish to expand the list or include your own favorite stations all you need to do is open the script in your text-editor, have a good look at it and add the new stations to it. If you have a problem understanding the script you can always ask about it here. The script doesn't have any dependencies outside the standard VSIDO install.
Make sure you run the script with the terminal emulator (xfce4-terminal in VSIDO) maximized to be able to view the complete station list. Looking forward to suggestions-views-reviews.

Code: [Select]
#!/bin/bash

RED='\e[41m'
BLUE='\e[44m'
NC='\e[0m'

PLAYER="mplayer -nolirc -really-quiet -cache 512 -cache-min 25"

while :
do
clear
echo ""
echo -e "$BLUE RADIO VSIDO $NC"
echo ""
echo ""
echo -e "Station $BLUE List $NC :"
echo ""
echo -e "$BLUE 01 $NC  7 Inch Soul                     $BLUE 02 $NC  BAGeL Radio"
echo -e "$BLUE 03 $NC  Beat Blender                    $BLUE 04 $NC  Boot Liquor"
echo -e "$BLUE 05 $NC  Black Rock FM                   $BLUE 06 $NC  cliqhop idm"
echo -e "$BLUE 07 $NC  Covers                          $BLUE 08 $NC  Deep Space One"
echo -e "$BLUE 09 $NC  DEF CON Radio                   $BLUE 10 $NC  Digitalis"
echo -e "$BLUE 11 $NC  Doomed                          $BLUE 12 $NC  Drone Zone"
echo -e "$BLUE 13 $NC  Dub Step Beyond                 $BLUE 14 $NC  Earwaves"
echo -e "$BLUE 15 $NC  Folk Forward                    $BLUE 16 $NC  Groove Salad"
echo -e "$BLUE 17 $NC  Illinois Street Lounge          $BLUE 18 $NC  Indie Pop Rocks!"
echo -e "$BLUE 19 $NC  Lush                            $BLUE 20 $NC  Mission Control"
echo -e "$BLUE 21 $NC  PopTron                         $BLUE 22 $NC  Secret Agent"
echo -e "$BLUE 23 $NC  SF 10–33                        $BLUE 24 $NC  Sonic Universe"
echo -e "$BLUE 25 $NC  Space Station Soma              $BLUE 26 $NC  Suburbs of Goa"
echo -e "$BLUE 27 $NC  The Trip                        $BLUE 28 $NC  Underground 80s"
echo -e "$BLUE 29 $NC  BBC Radio 1                     $BLUE 30 $NC  BBC Radio 2"
echo -e "$BLUE 31 $NC  BBC Radio 3                     $BLUE 32 $NC  BBC Radio 4"
echo -e "$BLUE 33 $NC  BBC Radio 4 Extra               $BLUE 34 $NC  BBC World Service"
echo -e "$BLUE 35 $NC  All 60s All the Time            $BLUE 36 $NC  Beatles-A-Rama"
echo -e "$BLUE 37 $NC  RADIO ENERGY                    $BLUE 38 $NC  Radio Paradise"
echo -e "$BLUE 39 $NC  Radio Record                    $BLUE 40 $NC  RADIO ROCK"
echo -e "$BLUE 41 $NC  Radio Swing Worldwide           $BLUE 42 $NC  Smooth Jazz"
echo -e "$BLUE 43 $NC  True Oldies Channel             $RED 44 $BLUE  Exit RADIO VSIDO $NC"
echo ""
echo ""
echo -e "Select a $BLUE station $NC between 1 to 43 and hit $BLUE [Enter] $NC to $BLUE PLAY $NC :"
echo ""
echo -e "Select $RED 44 $NC to $BLUE Exit $NC :"
echo ""
read VSIDO
case $VSIDO in

1)
clear
echo ""
echo -e "$BLUE RADIO VSIDO $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE 7 Inch Soul $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://ice.somafm.com/7soul
continue
;;

2)
clear
echo ""
echo -e "$BLUE RADIO VSIDO $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE BAGeL Radio $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://ice.somafm.com/bagel
continue
;;

3)
clear
echo ""
echo -e "$BLUE RADIO VSIDO $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE Beat Blender $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://ice.somafm.com/beatblender
continue
;;

4)
clear
echo ""
echo -e "$BLUE RADIO VSIDO $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE Boot Liquor $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://ice.somafm.com/bootliquor
continue
;;

5)
clear
echo ""
echo -e "$BLUE RADIO VSIDO $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE Black Rock FM $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://ice.somafm.com/brfm
continue
;;

6)
clear
echo ""
echo -e "$BLUE RADIO VSIDO $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE cliqhop idm $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://ice.somafm.com/cliqhop
continue
;;

7)
clear
echo ""
echo -e "$BLUE RADIO VSIDO $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE Covers $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://ice.somafm.com/covers
continue
;;

8)
clear
echo ""
echo -e "$BLUE RADIO VSIDO $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE Deep Space One $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://ice.somafm.com/deepspaceone
continue
;;

9)
clear
echo ""
echo -e "$BLUE RADIO VSIDO $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE DEF CON Radio $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://ice.somafm.com/defcon
continue
;;

10)
clear
echo ""
echo -e "$BLUE RADIO VSIDO $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE Digitalis $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://ice.somafm.com/digitalis
continue
;;

11)
clear
echo ""
echo -e "$BLUE RADIO VSIDO $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE Doomed $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://ice.somafm.com/doomed
continue
;;

12)
clear
echo ""
echo -e "$BLUE RADIO VSIDO $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE Drone Zone $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://ice.somafm.com/dronezone
continue
;;

13)
clear
echo ""
echo -e "$BLUE RADIO VSIDO $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE Dub Step Beyond $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://ice.somafm.com/dubstep
continue
;;

14)
clear
echo ""
echo -e "$BLUE RADIO VSIDO $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE Earwaves $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://ice.somafm.com/earwaves
continue
;;

15)
clear
echo ""
echo -e "$BLUE RADIO VSIDO $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE Folk Forward $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://ice.somafm.com/folkfwd
continue
;;

16)
clear
echo ""
echo -e "$BLUE RADIO VSIDO $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE Groove Salad $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://ice.somafm.com/groovesalad
continue
;;

17)
clear
echo ""
echo -e "$BLUE RADIO VSIDO $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE Illinois Street Lounge $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://ice.somafm.com/illstreet
continue
;;

18)
clear
echo ""
echo -e "$BLUE RADIO VSIDO $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE Indie Pop Rocks! $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://ice.somafm.com/indiepop
continue
;;

19)
clear
echo ""
echo -e "$BLUE RADIO VSIDO $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE Lush $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://ice.somafm.com/lush
continue
;;

20)
clear
echo ""
echo -e "$BLUE RADIO VSIDO $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE Mission Control $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://ice.somafm.com/missioncontrol
continue
;;

21)
clear
echo ""
echo -e "$BLUE RADIO VSIDO $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE PopTron $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://ice.somafm.com/poptron
continue
;;

22)
clear
echo ""
echo -e "$BLUE RADIO VSIDO $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE Secret Agent $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://ice.somafm.com/secretagent
continue
;;

23)
clear
echo ""
echo -e "$BLUE RADIO VSIDO $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE SF 10–33 $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://ice.somafm.com/sf1033
continue
;;

24)
clear
echo ""
echo -e "$BLUE RADIO VSIDO $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE Sonic Universe $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://ice.somafm.com/sonicuniverse
continue
;;

25)
clear
echo ""
echo -e "$BLUE RADIO VSIDO $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE Space Station Soma $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://ice.somafm.com/spacestation
continue
;;

26)
clear
echo ""
echo -e "$BLUE RADIO VSIDO $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE Suburbs of Goa $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://ice.somafm.com/suburbsofgoa
continue
;;

27)
clear
echo ""
echo -e "$BLUE RADIO VSIDO $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE The Trip $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://ice.somafm.com/thetrip
continue
;;

28)
clear
echo ""
echo -e "$BLUE RADIO VSIDO $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE Underground 80s $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://ice.somafm.com/u80s
continue
;;

29)
clear
echo ""
echo -e "$BLUE RADIO VSIDO $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE BBC Radio 1 $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio1_mf_q
continue
;;

30)
clear
echo ""
echo -e "$BLUE RADIO VSIDO $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE BBC Radio 2 $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio2_mf_q
continue
;;

31)
clear
echo ""
echo -e "$BLUE RADIO VSIDO $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE BBC Radio 3 $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://open.live.bbc.co.uk/mediaselector/5/select/version/2.0/mediaset/http-icy-aac-lc-a/format/pls/vpid/bbc_radio_three.pls
continue
;;

32)
clear
echo ""
echo -e "$BLUE RADIO VSIDO $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE BBC Radio 4 $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio4fm_mf_q
continue
;;

33)
clear
echo ""
echo -e "$BLUE RADIO VSIDO $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE BBC Radio 4 Extra $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio4extra_mf_q
continue
;;

34)
clear
echo ""
echo -e "$BLUE RADIO VSIDO $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE BBC World Service $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://wsdownload.bbc.co.uk/worldservice/meta/live/shoutcast/mp3/eieuk.pls
continue
;;

35)
clear
echo ""
echo -e "$BLUE RADIO VSIDO $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE All 60s All the Time $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://streaming303.radionomy.com:80/keepfree60s
continue
;;

36)
clear
echo ""
echo -e "$BLUE RADIO VSIDO $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE Beatles-A-Rama $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://streaming303.radionomy.com:80/beatlesarama
continue
;;

37)
clear
echo ""
echo -e "$BLUE RADIO VSIDO $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE RADIO ENERGY $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://stream.radioreklama.bg:80/nrj.ogg
continue
;;

38)
clear
echo ""
echo -e "$BLUE RADIO VSIDO $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE Radio Paradise $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://stream-uk1.radioparadise.com:80/mp3-192
continue
;;

39)
clear
echo ""
echo -e "$BLUE RADIO VSIDO $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE Radio Record $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://air.radiorecord.ru:8101/rr_128
continue
;;

40)
clear
echo ""
echo -e "$BLUE RADIO VSIDO $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE RADIO ROCK $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://stream.radioreklama.bg:80/radio1rock.ogg
continue
;;

41)
clear
echo ""
echo -e "$BLUE RADIO VSIDO $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE Radio Swing Worldwide $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://streaming303.radionomy.com:80/radioswingworldwide
continue
;;

42)
clear
echo ""
echo -e "$BLUE RADIO VSIDO $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE Smooth Jazz $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://hestia.cdnstream.com:80/1256_128
continue
;;

43)
clear
echo ""
echo -e "$BLUE RADIO VSIDO $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE True Oldies Channel $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://streaming304.radionomy.com:80/trueoldies
continue
;;

44)
clear
echo ""
echo -e "$BLUE 'When I die, just keep playing the records' $RED Jimi Hendrix $NC"
echo ""
sleep 3
clear
break
exit 0
;;

*)
clear
echo ""
echo -e "$RED Wrong Choice!!! $NC"
echo ""
sleep 3
clear
continue
;;

esac
done


Cheers!!!
You Can't Always Git What You Want

PackRat

  • Posts: 1816
    • View Profile
Re: RADIO VSIDO - VSIDO's very own Internet radio player
« Reply #1 on: July 20, 2015, 10:56:01 PM »
You're on a roll.

Works pretty well. Bit of a lag for some stations; BBC doesn't seem to work - or maybe I'm not waiting long enough.

Nice exit comment.
I am tired of talk that comes to nothing.
-- Chief Joseph

...the sun, the darkness, the winds are all listening to what we have to say.
-- Geronimo

Snap

  • Posts: 462
    • View Profile
Re: RADIO VSIDO - VSIDO's very own Internet radio player
« Reply #2 on: July 21, 2015, 03:29:59 AM »
Interesting script, hackerdefo. I'll borrow some of your ideas if you don't mind.  :P

Here's the one I tweaked: jazzradio.sh

Code: [Select]
#!/bin/bash

#  FILE: jazzradio.sh
#  DESCRIPTION: jazzradio.com channel selector
#  REQUIREMENTS: Mplayer
#  Based on radio.sh by Due204 ---- http://www.taringa.net/posts/linux/17497695/Mplayer-en-el-conky.html
#  Adapted by Snap

 
function menu()

{

    echo  "Choose a channel number"

    echo  " "

    echo  "1  Classic Jazz"

    echo  "2  Gypsy Jazz"

    echo  "3  Paris Cafe"

    echo  "4  Bebop"

    echo  "5  Swing n Bigband"

    echo  "6  Sinatra Style"

    echo  "7  Timeless Classics"

    echo  "8  Blues"

    echo  "9  Exit"

    echo  " "

    read RADIO


}



if [ -z $1 ]; then

    menu

else

    RADIO=`echo "$1"`

fi



if [ "$RADIO" = "1" ]; then

    mplayer -playlist http://listen.jazzradio.com/public3/classicjazz.pls?0b8c8413445830acd1b22421 > /tmp/mplayer.log

elif [ "$RADIO" = "2" ]; then

    mplayer -playlist http://listen.jazzradio.com/public3/gypsyjazz.pls?0b8c8413445830acd1b22421 > /tmp/mplayer.log

elif [ "$RADIO" = "3" ]; then

    mplayer -playlist http://listen.jazzradio.com/public3/pariscafe.pls?0b8c8413445830acd1b22421 > /tmp/mplayer.log

elif [ "$RADIO" = "4" ]; then

    mplayer -playlist http://listen.jazzradio.com/public3/bebop.pls?0b8c8413445830acd1b22421 > /tmp/mplayer.log

elif [ "$RADIO" = "5" ]; then

    mplayer -playlist http://listen.jazzradio.com/public3/swingnbigband.pls?0b8c8413445830acd1b22421 > /tmp/mplayer.log

elif [ "$RADIO" = "6" ]; then

    mplayer -playlist http://listen.jazzradio.com/public3/sinatrastyle.pls?0b8c8413445830acd1b22421 > /tmp/mplayer.log

elif [ "$RADIO" = "7" ]; then

    mplayer -playlist http://listen.jazzradio.com/public3/timelessclassics.pls?0b8c8413445830acd1b22421 > /tmp/mplayer.log

elif [ "$RADIO" = "8" ]; then

    mplayer -playlist http://listen.jazzradio.com/public3/blues.pls?0b8c8413445830acd1b22421 > /tmp/mplayer.log

elif [ "$RADIO" = "9" ]; then

    exit

else

    echo "You have selected a wrong channel"; sleep 1;

    echo "Please, enter a valid channel number"; sleep 1; clear; $0

fi

Don't know why -quiet doesn't work with these channels. I need to use -playlist.

Notice it exports data to a temp file to grab info for conky. It works as it should but still haven't managed to display it on conky yet.

Snap

  • Posts: 462
    • View Profile
Re: RADIO VSIDO - VSIDO's very own Internet radio player
« Reply #3 on: July 21, 2015, 03:52:08 AM »
As PackRat said, some radios lag. Removing the cahe fixes it. What's the purpose of the cache here? Slow network connections?

Snap

  • Posts: 462
    • View Profile
Re: RADIO VSIDO - VSIDO's very own Internet radio player
« Reply #4 on: July 21, 2015, 08:41:34 AM »
I just remembered there were some od these in the Crunchbang forums. Here's another interesting radio script for mplayer (and other players). It takes a long while searching for the stations matching the keywords and the output is huge, but if you want to sort out stations to make a favorites list this can be a way:

http://crunchbang.org/forums/viewtopic.php?pid=396202#p396202

It doesn't float my boat as an easy streamer/player, but for grabbing station urls it might be a nice ttool.

hakerdefo

  • Posts: 494
    • View Profile
    • Looking at Linux through the Windows of Life
Re: RADIO VSIDO - VSIDO's very own Internet radio player
« Reply #5 on: July 21, 2015, 07:17:51 PM »
Some good news for you Snap.
Here is something for you.
RADIO JAZZ

Code: [Select]
#!/bin/bash

RED='\e[41m'
BLUE='\e[44m'
NC='\e[0m'

PLAYER="mplayer -nolirc -quiet -cache 512 -cache-min 25"

while :
do
clear
echo ""
echo -e "$BLUE RADIO JAZZ $NC"
echo ""
echo ""
echo -e "Station $BLUE List $NC :"
echo ""
echo -e "$BLUE 01 $NC  Classic Jazz                    $BLUE 02 $NC  Gypsy Jazz"
echo -e "$BLUE 03 $NC  Paris Cafe                      $BLUE 04 $NC  Bebop"
echo -e "$BLUE 05 $NC  Swing n Bigband                 $BLUE 06 $NC  Sinatra Style"
echo -e "$BLUE 07 $NC  Timeless Classics               $BLUE 08 $NC  Blues"
echo -e "$RED 09 $BLUE  Exit RADIO JAZZ $NC"
echo ""
echo ""
echo -e "Select a $BLUE station $NC between 1 to 8 and hit $BLUE [Enter] $NC to $BLUE PLAY $NC :"
echo ""
echo -e "Select $RED 9 $NC to $BLUE Exit $NC RADIO JAZZ :"
echo ""
read JAZZ
case $JAZZ in

1)
clear
echo ""
echo -e "$BLUE RADIO JAZZ $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE Classic Jazz $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://pub1.jazzradio.com:80/jr_classicjazz?0b8c8413445830acd1b22421 > /tmp/mplayer.log
rm /tmp/mplayer.log
continue
;;

2)
clear
echo ""
echo -e "$BLUE RADIO JAZZ $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE Gypsy Jazz $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://pub1.jazzradio.com:80/jr_gypsyjazz?0b8c8413445830acd1b22421 > /tmp/mplayer.log
rm /tmp/mplayer.log
continue
;;

3)
clear
echo ""
echo -e "$BLUE RADIO JAZZ $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE Paris Cafe $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://pub1.jazzradio.com:80/jr_pariscafe?0b8c8413445830acd1b22421 > /tmp/mplayer.log
rm /tmp/mplayer.log
continue
;;

4)
clear
echo ""
echo -e "$BLUE RADIO JAZZ $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE Bebop $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://pub1.jazzradio.com:80/jr_bebop?0b8c8413445830acd1b22421 > /tmp/mplayer.log
rm /tmp/mplayer.log
continue
;;

5)
clear
echo ""
echo -e "$BLUE RADIO JAZZ $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE Swing n Bigband $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://pub1.jazzradio.com:80/jr_swingnbigband?0b8c8413445830acd1b22421 > /tmp/mplayer.log
rm /tmp/mplayer.log
continue
;;

6)
clear
echo ""
echo -e "$BLUE RADIO JAZZ $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE Sinatra Style $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://pub1.jazzradio.com:80/jr_sinatrastyle?0b8c8413445830acd1b22421 > /tmp/mplayer.log
rm /tmp/mplayer.log
continue
;;

7)
clear
echo ""
echo -e "$BLUE RADIO JAZZ $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE Timeless Classics $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://pub1.jazzradio.com:80/jr_timelessclassics?0b8c8413445830acd1b22421 > /tmp/mplayer.log
rm /tmp/mplayer.log
continue
;;

8)
clear
echo ""
echo -e "$BLUE RADIO JAZZ $NC"
echo ""
echo -e "Now $BLUE Playing $NC Station: $BLUE Blues $NC"
echo ""
echo -e "Press $BLUE [Space] $NC to pause Press $BLUE [Q] $NC to stop"
echo ""
$PLAYER http://pub1.jazzradio.com:80/jr_blues?0b8c8413445830acd1b22421 > /tmp/mplayer.log
rm /tmp/mplayer.log
continue
;;

9)
clear
echo ""
echo -e "$BLUE 'Jazz washes away the dust of every day life' $RED Art Blakey $NC"
echo ""
sleep 3
clear
break
exit 0
;;

*)
clear
echo ""
echo -e "$RED Wrong Choice!!! $NC"
echo ""
sleep 3
clear
continue
;;

esac
done


Save it somewhere in your $PATH with the name 'radio_jazz' and 'chmod 755' it. And just do 'radio_jazz' in your terminal whenever you are in the mood for the music.
Wait, that's not all. I've something more. Save the following script somewhere in your $PATH with the name 'jazz_conky' and 'chmod 755 it.

Code: [Select]
#!/bin/bash

if [ ! -f /tmp/mplayer.log ]; then

echo "Stopped"

else

NOW_PLAYING=$(cat /tmp/mplayer.log | grep "StreamTitle" | tail -1 | cut -c 24- | sed 's/\;//g' | rev | cut -c 2- | rev)

echo "$NOW_PLAYING"

fi


Next open your '.conkyrc' in a text editor of choice and add this line to it
Code: [Select]
Radio Jazz: ${texeci 3 /full/path/to/jazz_conky}Of-course you have to replace '/full/path/to/jazz_conky' in the above line with the actual full path to 'jazz_conky' script. Save changes made to '.conkyrc'.
Next time you play RADIO JAZZ you'll have currently playing track displayed in your conky.
Cheers!!!
You Can't Always Git What You Want

Snap

  • Posts: 462
    • View Profile
Re: RADIO VSIDO - VSIDO's very own Internet radio player
« Reply #6 on: July 21, 2015, 08:11:46 PM »
A truckload of thanks, hackerdefo. This stuff is much better than my poor attempts. Great job.

Check the bottom right:

Snap

  • Posts: 462
    • View Profile
Re: RADIO VSIDO - VSIDO's very own Internet radio player
« Reply #7 on: July 22, 2015, 08:42:37 AM »
Hey, hackerdefo. May I abuse you a bit more?  :P

I tweaked your script a bit and added a couple of stations from your former vsido radio. One of them is Folk Forward. I really liked it! The things is...



For all the other stations conky displays the info correctly, but for Folk Forward (I guess the other channels from somafm too) the streamurl part gets in the way. It needs a different setup. I modded the script to forward a different temp file ~/tmp/folkforward.log for this station and modified the jazz-conky script (now remamed as radio-conky) like this:

Code: [Select]
#!/bin/bash
#by hackerdefo

if [ ! -f ~/tmp/mplayer.log ]; then

echo " "

else

NOW_PLAYING=$(cat ~/tmp/mplayer.log | grep "StreamTitle" | tail -1 | cut -c 24- | sed 's/\;//g' | rev | cut -c 2- | rev)

echo "$NOW_PLAYING"

fi

if [ ! -f ~/tmp/folkforward.log ]; then

echo " "

else

NOW_PLAYING1=$(cat ~/tmp/folkforward.log | grep "StreamTitle" | tail -1 | cut -c 24- | sed 's/\;//g' | rev | cut -c 2- | rev)

echo "$NOW_PLAYING1"

fi

Tried to tweak the grep and sed part for NOW_PLAYING1 but I'm all lost here. I guess I'll need to study these two commands deeply. Would you please, shed some light on the syntax for this line?

BTW, I also added these two lines in the exit section in order to clean up conky after a login or reboot. Otherwise it keeps displaying the last song it was running in the last session. I want conky to display nothing if the radio is not running.

Code: [Select]
9)
rm ~/tmp/mplayer.log
rm ~/tmp/folkforward.log
clear
echo ""
echo -e "$BLUE 'Jazz washes away the dust of every day life' $RED Art Blakey $NC"
echo ""
sleep 3
clear
break
exit 0
;;

Snap

  • Posts: 462
    • View Profile
Re: RADIO VSIDO - VSIDO's very own Internet radio player
« Reply #8 on: July 22, 2015, 09:19:12 AM »
One more tweak. Instead of having conkyradio running at all times from the session startup even if the radio is not running, the radio script now launches this secondary conky and kills it at exit.

At the very bottom of the script...

Code: [Select]
esac
conky -c ~/.conkyradio
done


hakerdefo

  • Posts: 494
    • View Profile
    • Looking at Linux through the Windows of Life
Re: RADIO VSIDO - VSIDO's very own Internet radio player
« Reply #9 on: July 22, 2015, 06:35:43 PM »
Snap, different streams provide stream related information in different ways. They all don't follow a particular standard so it becomes next to impossible to parse every stream with one command. However the good news for you is that if you want to parse stream info from jazzradio, somafm, radionomy and other quality stations then the following script, let's call it radio-conky, should do it,

Code: [Select]
#!/bin/bash

if [ ! -f /tmp/mplayer.log ]; then

echo "Stopped"

else

NOW_PLAYING=$(cat /tmp/mplayer.log | grep "StreamTitle" | tail -1 | sed -e 's/;.*//' -e 's/.*=//' -e "s/'//g")

echo "$NOW_PLAYING"

fi


Just make sure that in the main radio script the log file for every station is '/tmp/mplayer.log'. No need for different log files. The above radio-conky with it's 'sed' magic should extract stream info for most stations.
Cheers!!!
You Can't Always Git What You Want

Snap

  • Posts: 462
    • View Profile
Re: RADIO VSIDO - VSIDO's very own Internet radio player
« Reply #10 on: July 23, 2015, 05:55:28 AM »
Man, that's great. Thanks a few bunches.

Quote
However the good news for you is that if you want to parse stream info from jazzradio, somafm, radionomy and other quality stations then the following script, let's call it radio-conky, should do it

Yep, that's all I need. Hardly ever play any other radios than a few from jazzradio and now Folk Forward from somafm. Big thanks for that too. You discovered to me that station and I've been playing it exclusively for the last few days.

Snap

  • Posts: 462
    • View Profile
Re: RADIO VSIDO - VSIDO's very own Internet radio player
« Reply #11 on: July 23, 2015, 10:40:26 AM »
Is there a way to use system notifications (xfce4-notifyd) instead of conky? That would be great.

Gone to surf the web on that topic.