#!/bin/sh
# eg: ./bliptv.sh http://blip.tv/play/hKxdjY1Lm5Bu
case $1 in
*/play/*)
	echo looking up rss channel information
	loc=`curl -s -i "$1" |grep '^Location: ' |sed 's/Location: //;s/\r//'`
	url=`echo $loc |sed 's/.*file=\([^&]*\).*/\1/;s/%3A/:/g;s/%2F/\//g'`
	echo "$url"
	curl -s "$url" |awk '/<title>/;/<\/?item>/;/<link>/;/<media:content/;/<media:keyword/' |sed 's/^[ \t]*//'
	;;
*/file/*)
	echo download link should be available on the webpage
	curl -s "$1" |grep '>Download</a' |sed 's/^[ \t]*//'
	;;
*) echo unknown ;;
esac
