cleaning up entering the movie

This commit is contained in:
Alex Epstein 2017-06-30 01:12:59 -04:00
parent c8e689bfae
commit dd49c9564d
1 changed files with 2 additions and 1 deletions

View File

@ -47,7 +47,8 @@ checkInternet()
getMovieInfo()
{
apiKey=946f500a # try not to abuse this it is a key that came from the ruby-scripts repo I link to.
movie="$1+$2+$3+$4+$5+$6+$7+$8+$9" ## format the inputs to use for the api
movie=$(echo $1 $2 $3 $4 $5 $6 $7 $8 $9 | tr " " + ) ## format the inputs to use for the api
export PYTHONIOENCODING=utf8 #necessary for python in some cases
movieInfo=$(httpGet "http://www.omdbapi.com/?t=$movie&apikey=$apiKey") > /dev/null # query the server and get the JSON response
checkResponse=$(echo $movieInfo | python -c "import sys, json; print json.load(sys.stdin)['Response']")
if [[ $checkResponse == "False" ]];then { echo "No movie found" ; return 1 ;} fi ## check to see if the movie was found