|
|
|
@ -5,7 +5,7 @@ import requests
|
|
|
|
|
log = logger.get_logger(__name__)
|
|
|
|
|
def get_rating(apikey,movie):
|
|
|
|
|
imdbID = movie['movie']['ids']['imdb']
|
|
|
|
|
|
|
|
|
|
if(imdbID):
|
|
|
|
|
log.debug("Requesting ratings from OMDB for %s (%d) | Genres: %s | Country: %s | imdbID: %s",movie['movie']['title'], movie['movie']['year'],
|
|
|
|
|
', '.join(movie['movie']['genres']), movie['movie']['country'].upper(),imdbID)
|
|
|
|
|
r = requests.get('http://www.omdbapi.com/?i=' + imdbID + '&apikey=' + apikey)
|
|
|
|
@ -22,5 +22,9 @@ def get_rating(apikey,movie):
|
|
|
|
|
log.debug("Error encountered when requesting ratings from OMDB for %s (%d) | Genres: %s | Country: %s | imdbID: %s",
|
|
|
|
|
movie['movie']['title'], movie['movie']['year'],
|
|
|
|
|
', '.join(movie['movie']['genres']), movie['movie']['country'].upper(), imdbID)
|
|
|
|
|
else:
|
|
|
|
|
log.debug("Skipping %s (%d) | Genres: %s | Country: %s as it does not have an imdbID",
|
|
|
|
|
movie['movie']['title'], movie['movie']['year'],
|
|
|
|
|
', '.join(movie['movie']['genres']), movie['movie']['country'].upper())
|
|
|
|
|
|
|
|
|
|
return -1
|
|
|
|
|