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

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

id=$(echo "$1" | sed -e 's/.*\/\(.*\)$/\1/')
url=$(wget -q "http://vimeo.com/moogaloop/clip:$id" -O - | tr '&' '\n' | grep video_file | cut -d'=' -f2 | sed -e 's/%3A/:/g' -e 's/%2F/\//g')
filename=$id.flv

echo "$url|$filename"

