#!/usr/pkg/bin/bash # topshout -- tune in top shoutcast station # copyright 2004 jc@jcomeau.com GPL licensed genre=$1 if [ -z "$genre" ]; then declare genre=Rock fi SHOUTCAST="http://shoutcast.com" SHOUTCAST_URL="$SHOUTCAST/directory/?maxbitrate=56&sgenre=$genre" LINK_MARKER="/sbin/shoutcast-playlist.pls" top="$(lynx -source "$SHOUTCAST_URL" | grep "$LINK_MARKER" | \ head -n 1 | cut -d '"' -f 6)" link="$(lynx -dump "$SHOUTCAST$top" | zcat -f | \ grep '^File1=' | cut -d '=' -f 2)" [ "$(pidof esd)" ] || esd & # mpg123 wants stream URLs to end in slash [ "${link:-1}" = "/" ] || declare link="$link/" mpg123 -o esd "$link"