#!/bin/sh

# Params
#  1. full media file path

if [ "x$1" = "x" ]; then
   exit 1;
fi

FILE=`echo $1|sed "s/ /%20/g"`
MOVIENAME=`basename $FILE`

TEMP=`mktemp`
TEMP2=`mktemp`

curl -s -o $TEMP -D $TEMP2 http://imdbapi.org/?title=$MOVIENAME'&type=json&plot=none&episode=0&limit=9&yg=0&mt=none&lang=en-US&offset=0&aka=simple&release=simple'

cat $TEMP | sed 's/}/}\n/g;s/"\([a-z]*\)":/\n"\1":/g'

rm -f $TEMP

exit 0
