#!/bin/bash #Company: PowerCraft Technology #Author: Copyright Jelle de Jong #Note: Please send me an email if you enhanced this script #Version: 0.0.3 #Date: 31-07-2006 / 10-02-2007 / 22-02-2008 #System: Ubuntu/Debian GNU/Linux #Information: man cut, man tail, man mpg123 #Category Thunar scripts #Name: Play Internetradio #Description: Get the information out of a playlist and try to play the stream #Command: xfce4-terminal --disable-server --hide-toolbars --execute /usr/share/pct-thunar-scripts/scripts/play-internetradio %F #Patterns: *.pls; *.PLS; *.m3u; *.M3U; #Audio Files: True # Did the script work for you? # Yes # Yes, but with some errors # Yes, but I had to change some things # Not at all # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA. TEXTDOMAINDIR=/usr/share/locale TEXTDOMAIN=${0##*/} NAME=$"Play Internetradio" DESCRIPTION=$"Get the information out of a playlist and try to play the stream" cecho() { case "$1" in "black") echo -ne "\E[30m" ;; "red") echo -ne "\E[31m" ;; "green") echo -ne "\E[32m" ;; "yellow") echo -ne "\E[33m" ;; "blue") echo -ne "\E[34m" ;; "magenta") echo -ne "\E[35m" ;; "cyan") echo -ne "\E[36m" ;; *) echo -ne "\E[30m" exit ;; esac echo "$2" "$3" tput sgr0 } cecho "green" $"program:" echo "$0" cecho "green" $"description:" echo "$DESCRIPTION" echo $"processing file(s):" for I in "$@" do cecho "blue" "$I" done for I in "$@" do cecho "green" $"starting with: " echo "$I" #whereis padsp if [ -e /usr/bin/padsp ] then padsp="padsp" fi #streamone=`cat -A "$I" | grep "File" | cut -f 2 -d '=' | tail -n 1 | cut -f 1 -d '$' | cut -f 1 -d '^'` streamone=$(cat -A ".shoutcastlive.pls" | grep "File") streamone=${streamone#*=} streamone=$(echo "$streamone" | tail -n 1 | cut -f 1 -d '$' | cut -f 1 -d '^') #streamtwo=`echo "$streamtwo" | tac | cut -b 1` #if [ "$streamtwo" = "/" ] #then #streamtwo="" #else #streamtwo="/" #fi streamthree=`echo "$streamone" | grep "stream"` if [ "$streamthree" != "" ] then streamone=`cat -A "$I" | head -n 3 | cut -f 2 -d '=' | tail -n 1 | cut -f 1 -d '^'` streamtwo="" fi m3ufile=`cat -A "$I" | grep "M3U" | tail -n 1 | cut -f 1 -d '$'` if [ "$m3ufile" != "" ] then m3ufile=`cat -A "$I" | grep "http://" | head -n 1 | cut -f 1 -d '$'` streamone=`echo $m3ufile` streamtwo="" #cecho "green" "create a backup file" #cp $I /mnt/hda3/muziek/shoutcast.m3u fi #cecho "green" "choose a option" #cecho "blue" "[1] Play in gxine" #cecho "blue" "[2] Play in terminal" #cecho "blue" "[3] Exit" #read option option=2 if [ "$option" = "1" ] then cecho "blue" $"command: exec gxine $streamone$streamtwo --no-splash --add" gxine "$streamone""$streamtwo" --no-splash --add fi if [ "$option" = "2" ] then cecho "cyan" $"command: screen -S radio-screen mpg123 --output alsa --control --gapless --no-icy-meta --buffer 1536 $streamone$streamtwo" #~ while true; do cecho "green" $"trying to start the stream, please standby..." #$padsp aoss mpg123 -C -b 512 -k 128 "$streamone""$streamtwo" #aoss mpg123 --control --skip 128 --buffer 1024 -@ "$streamone""$streamtwo" # mpg123 --test-cpu # --cpu mmx screen -S radio-screen mpg123 --output alsa --control --gapless --no-icy-meta --buffer 1536 "$streamone""$streamtwo" #mpg123 --audiodevice /dev/dsp -C -b 512 -k 128 "$streamone""$streamtwo" #mpg123 --audiodevice /dev/dsp1 -C -b 512 -k 128 "$streamone""$streamtwo" sleep 1 #~ done fi if [ "$option" = "3" ] then exit 0 fi cecho "green" $"completed" cecho "blue" "---------------" done echo $"done, closing after 10 seconds" echo "" sleep 10 exit 0