mirror of
https://github.com/alexanderepstein/Bash-Snippets
synced 2018-11-08 02:59:35 +01:00
cleaning up entering the movie
This commit is contained in:
parent
c8e689bfae
commit
dd49c9564d
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user