def get_movies(movietype): movies = [] url = movietype + '.json?apikey=%s' % (RT_KEY) results = get_JSON_response(BASE_URL + url, folder="RottenTomatoes") if not results or "movies" not in results: return [] for item in results["movies"]: if "alternate_ids" not in item: continue imdb_id = str(item["alternate_ids"]["imdb"]) poster = "http://content6.flixster.com/" + item["posters"]["original"][93:] if SETTING("infodialog_onclick") != "false": path = 'plugin://script.extendedinfo/?info=extendedinfo&&imdb_id=%s' % imdb_id else: search_string = "%s %s trailer" % (item["title"], str(item["year"])) path = "plugin://script.extendedinfo/?info=playtrailer&&title=%s&&imdb_id=%s" % (search_string, imdb_id) movies.append({'title': item["title"], 'imdb_id': imdb_id, 'thumb': poster, 'poster': poster, 'Runtime': item["runtime"], 'duration': item["runtime"], 'duration(h)': format_time(item["runtime"], "h"), 'duration(m)': format_time(item["runtime"], "m"), 'year': item["year"], 'path': path, 'Premiered': item["release_dates"].get("theater", ""), 'mpaa': item["mpaa_rating"], 'Rating': item["ratings"]["audience_score"] / 10.0, 'Plot': item["synopsis"]}) return local_db.merge_with_local_movie_info(movies, False)
def handle_trakt_movies(results): movies = [] for movie in results: if SETTING("infodialog_onclick") != "false": path = 'plugin://script.extendedinfo/?info=extendedinfo&&id=%s' % str(fetch(movie["movie"]["ids"], 'tmdb')) else: path = "plugin://script.extendedinfo/?info=playtrailer&&id=" + str(fetch(movie["movie"]["ids"], 'tmdb')) movie = {'title': movie["movie"]["title"], 'Runtime': movie["movie"]["runtime"], 'duration': movie["movie"]["runtime"], 'duration(h)': format_time(movie["movie"]["runtime"], "h"), 'duration(m)': format_time(movie["movie"]["runtime"], "m"), 'Tagline': movie["movie"]["tagline"], 'Trailer': convert_youtube_url(movie["movie"]["trailer"]), 'year': movie["movie"]["year"], 'id': movie["movie"]["ids"]["tmdb"], 'imdb_id': movie["movie"]["ids"]["imdb"], 'path': path, 'mpaa': movie["movie"]["certification"], 'Plot': movie["movie"]["overview"], 'Premiered': movie["movie"]["released"], 'Rating': round(movie["movie"]["rating"], 1), 'Votes': movie["movie"]["votes"], 'Watchers': movie["watchers"], 'genre': " / ".join(movie["movie"]["genres"]), 'poster': movie["movie"]["images"]["poster"]["full"], 'fanart': movie["movie"]["images"]["fanart"]["full"], 'thumb': movie['movie']["images"]["poster"]["thumb"]} movies.append(movie) movies = local_db.merge_with_local_movie_info(online_list=movies, library_first=False) return movies