#!/bin/bash
## Trakt
trakt_user="xxx"
trakt_pass="sha1(xxx)"
trakt_api="xxx"
trakt_url="http://api.trakt.tv/movie/library/$trakt_api"
title="$(echo "$3" | sed 's/ (.*//')"
year="$(echo "$3" | sed 's/^.* (\([0-9]*\)).*/\1/')"
if [ "$title" == "$3" ]; then
title="$(echo "$3" | sed 's/\./ /g;s/ 20.*//')"
year="$(echo "$3" | sed 's/^.*\.20\([0-9][0-9]\).*/20\1/')"
fi
echo -n "$3 [$title ($year)]: "
echo '
{
"username": "'"$trakt_user"'",
"password": "'"$trakt_pass"'",
"movies": [
{
"imdb_id": "",
"title": "'"$title"'",
"year": '$year'
}
]
}' | curl -s --data-binary @- "$trakt_url"
echo
Add a code snippet to your website: www.paste.org