WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: mplayer radio script  (Read 3444 times)

Offline vinnie

  • Hero Member
  • *****
  • Posts: 1187
  • HandMace informatic works
mplayer radio script
« on: March 21, 2013, 08:14:09 AM »
I made this little script to lazily put in play radio that I like.
It is very simple:
1) put all radio playlist file (.M3u .Pls ...) in one directory
2) enter the absolute path of this directory into the script (variable DIRRADIO)
3) run the script and chose radio :)


Code: [Select]
#!/bin/sh

#insert absolute path to radio playlist file
DIRRADIO="./radio/"
PLAYLIST=`find $DIRRADIO -type f -maxdepth 1`
LISTRADIO=`echo -e "$PLAYLIST" | sed -e 's/^.*\///g' | sed -e 's/\..*$//g'`
NUMBRADIO=`echo -e "$LISTRADIO" | sed '/./=' | sed '/./N; s/\n/\t/'`


echo -e "\nSTATION\tRADIO"
echo -e "$NUMBRADIO"
echo
read -p "Choose station: " STAZIONE


RADIO=`echo -e "$LISTRADIO" | sed -n "$STAZIONE"p`
echo -e "You have chosen: $RADIO\n"

PLAYRADIO=`echo -e "$PLAYLIST" | sed -n "$STAZIONE"p`
mplayer -playlist $PLAYRADIO