def display_movie_info(the_id): feedback = Feedback() movie = omdb.get_movie(the_id) title_args = json_args({ "command": "imdb_movie", "id": the_id }) if "Title" in movie and "Year" in movie and "Runtime" in movie and "imdbRating" in movie: feedback.add_item(("%s (%s)" % (movie["Title"], movie["Year"])), ("%s, Rating: %s" % (movie["Runtime"], movie["imdbRating"])), title_args, "yes", "", "images/imdb.png") elif "Title" in movie and "Year" in movie and "Runtime" in movie: feedback.add_item(("%s (%s)" % (movie["Title"], movie["Year"])), ("%s" % (movie["Runtime"])), title_args, "yes", "", "images/imdb.png") elif "Title" in movie and "Year" in movie and "imdbRating" in movie: feedback.add_item(("%s (%s)" % (movie["Title"], movie["Year"])), ("Rating: %s" % (movie["imdbRating"])), title_args, "yes", "", "images/imdb.png") elif "Title" in movie and "Year" in movie: feedback.add_item(("%s (%s)" % (movie["Title"], movie["Year"])), "Title", title_args, "yes", "", "images/imdb.png") elif "Title" in movie: feedback.add_item(movie["Title"], "Title", title_args, "yes", "", "images/imdb.png") if "Genre" in movie: feedback.add_item(movie["Genre"], "Genre", "", "no", the_id, "images/genre.png") if "Released" in movie: feedback.add_item(movie["Released"], "Release date", "", "no", the_id, "images/release_date.png") if "Director" in movie and movie["Director"] != "" and movie["Director"] != "N/A": feedback.add_item(movie["Director"], "Director", json_args({ "command": "lucky_imdb", "query": movie["Director"] }), "yes", "", "images/director.png") if "Writer" in movie and movie["Writer"] != "" and movie["Writer"] != "N/A": feedback.add_item(movie["Writer"], "Writer", json_args({ "command": "lucky_imdb", "query": movie["Writer"] }), "yes", "", "images/writer.png") if "Actors" in movie: feedback.add_item("Show actors...", movie["Actors"], "", "no", ("%s actors" % (the_id)), "images/actors.png") if "Plot" in movie and movie["Plot"] != "" and movie["Plot"] != "N/A": escaped_plot = movie["Plot"].replace("'", "").replace("\"", "") feedback.add_item("Show plot...", movie["Plot"], json_args({ "command": "quicklook_text", "text": escaped_plot }), "yes", "", "images/plot.png") if "Poster" in movie: feedback.add_item("Show poster...", "", json_args({ "command": "quicklook_poster", "url": movie["Poster"] }), "yes", "", "images/poster.png") if "Title" in movie: trailer_query = "%s official trailer" % (movie["Title"]) feedback.add_item("View trailer...", "", json_args({ "command": "trailer", "query": trailer_query }), "yes", "", "images/youtube.png") feedback.add_item("Show on IMDb...", "", title_args, "yes", "", "images/imdb.png") return feedback
def display_actors(the_id): feedback = Feedback() movie = omdb.get_movie(the_id) feedback.add_item("Back...", "", "", "no", the_id, "images/back.png") if "Actors" in movie: actors = movie["Actors"].split(", ") for actor in actors: feedback.add_item(actor, "Show on IMDb...", json_args({ "command": "lucky_imdb", "query": actor }), "yes", "", "images/imdb.png") return feedback
def display_actors(the_id): feedback = Feedback() movie = omdb.get_movie(the_id) feedback.add_item("Back...", "", "", "no", the_id, "images/back.png") if "Actors" in movie: actors = movie["Actors"].split(", ") for actor in actors: feedback.add_item( actor, "Show on IMDb...", json_args({ "command": "lucky_imdb", "query": actor }), "yes", "", "images/imdb.png") return feedback
def display_movie_info(the_id): feedback = Feedback() movie = omdb.get_movie(the_id) title_args = json_args({"command": "imdb_movie", "id": the_id}) if "Title" in movie and "Year" in movie and "Runtime" in movie and "imdbRating" in movie: feedback.add_item( ("%s (%s)" % (movie["Title"], movie["Year"])), ("%s, Rating: %s" % (movie["Runtime"], movie["imdbRating"])), title_args, "yes", "", "images/imdb.png") elif "Title" in movie and "Year" in movie and "Runtime" in movie: feedback.add_item(("%s (%s)" % (movie["Title"], movie["Year"])), ("%s" % (movie["Runtime"])), title_args, "yes", "", "images/imdb.png") elif "Title" in movie and "Year" in movie and "imdbRating" in movie: feedback.add_item(("%s (%s)" % (movie["Title"], movie["Year"])), ("Rating: %s" % (movie["imdbRating"])), title_args, "yes", "", "images/imdb.png") elif "Title" in movie and "Year" in movie: feedback.add_item(("%s (%s)" % (movie["Title"], movie["Year"])), "Title", title_args, "yes", "", "images/imdb.png") elif "Title" in movie: feedback.add_item(movie["Title"], "Title", title_args, "yes", "", "images/imdb.png") if "Genre" in movie: feedback.add_item(movie["Genre"], "Genre", "", "no", the_id, "images/genre.png") if "Released" in movie: feedback.add_item(movie["Released"], "Release date", "", "no", the_id, "images/release_date.png") if "Director" in movie and movie["Director"] != "" and movie[ "Director"] != "N/A": feedback.add_item( movie["Director"], "Director", json_args({ "command": "lucky_imdb", "query": movie["Director"] }), "yes", "", "images/director.png") if "Writer" in movie and movie["Writer"] != "" and movie["Writer"] != "N/A": feedback.add_item( movie["Writer"], "Writer", json_args({ "command": "lucky_imdb", "query": movie["Writer"] }), "yes", "", "images/writer.png") if "Actors" in movie: feedback.add_item("Show actors...", movie["Actors"], "", "no", ("%s actors" % (the_id)), "images/actors.png") if "Plot" in movie and movie["Plot"] != "" and movie["Plot"] != "N/A": escaped_plot = movie["Plot"].replace("'", "").replace("\"", "") feedback.add_item( "Show plot...", movie["Plot"], json_args({ "command": "quicklook_text", "text": escaped_plot }), "yes", "", "images/plot.png") if "Poster" in movie: feedback.add_item( "Show poster...", "", json_args({ "command": "quicklook_poster", "url": movie["Poster"] }), "yes", "", "images/poster.png") if "Title" in movie: trailer_query = "%s official trailer" % (movie["Title"]) feedback.add_item( "View trailer...", "", json_args({ "command": "trailer", "query": trailer_query }), "yes", "", "images/youtube.png") feedback.add_item("Show on IMDb...", "", title_args, "yes", "", "images/imdb.png") return feedback