#!/bin/bash
#
# FLVGET Plugin for "BoFunk" version 1.1
# http://www.bofunk.com/
#
# This plugin is released under GPL free license.
#
# Pablo Chinea <khertz@gmail.com>
#################################################

if [[ $1 == '-q' ]]
then
	echo "FLVGET_PLUGIN|BoFunk|bofunk.com"
	exit 0
fi

url=$(wget -q "$1" -O - | grep "download.php" | cut -d"'" -f2 | cut -d'=' -f2)
ext=$(echo "$url" | cut -d'.' -f4)
filename=$(echo "$1" | sed -e 's/.*\/\(.*\)$/\1/' -e "s/html/$ext/")

echo "$url|$filename"

