From a8bb4ece61fa2a75d27722a9a4c2640d277c086a Mon Sep 17 00:00:00 2001 From: desimaniac <5501908+desimaniac@users.noreply.github.com> Date: Fri, 14 Jun 2019 12:18:12 -0500 Subject: [PATCH] Logs: Added single quotes around movie and show titles. --- helpers/radarr.py | 3 ++- helpers/rating.py | 14 +++++++------- helpers/sonarr.py | 3 ++- media/pvr.py | 8 ++++---- traktarr.py | 32 ++++++++++++++++---------------- 5 files changed, 31 insertions(+), 29 deletions(-) diff --git a/helpers/radarr.py b/helpers/radarr.py index bf6df50..ff2dd7a 100644 --- a/helpers/radarr.py +++ b/helpers/radarr.py @@ -39,7 +39,8 @@ def remove_existing_movies(radarr_movies, trakt_movies, callback=None): continue # check if movie exists in processed_movies if tmp['movie']['ids']['tmdb'] in processed_movies: - log.debug("Removing existing movie: %s", tmp['movie']['title']) + log.debug("Removing existing movie: \'%s (%s)\'", tmp['movie']['title'], + str(tmp['movie']['year']) if tmp['movie']['year'] else '????') if callback: callback('movie', tmp) continue diff --git a/helpers/rating.py b/helpers/rating.py index 5eeb706..ac43ca5 100644 --- a/helpers/rating.py +++ b/helpers/rating.py @@ -10,33 +10,33 @@ def get_rating(apikey, movie): ratings_exist = False imdb_id = movie['movie']['ids']['imdb'] if imdb_id: - log.debug("Requesting info from OMDB for %s (%d) | Genres: %s | Country: %s | IMDB ID: %s", + log.debug("Requesting info from OMDB for \'%s (%d)\' | Genres: %s | Country: %s | IMDB ID: %s", movie['movie']['title'], movie['movie']['year'], ', '.join(movie['movie']['genres']), (movie['movie']['country'] or 'N/A').upper(), imdb_id) r = requests.get('http://www.omdbapi.com/?i=' + imdb_id + '&apikey=' + apikey) if r.status_code == 200 and json.loads(r.text)["Response"] == 'True': - log.debug("Successfully requested ratings from OMDB for %s (%d) | Genres: %s | Country: %s | IMDB ID: %s", - movie['movie']['title'], movie['movie']['year'], + log.debug("Successfully requested ratings from OMDB for \'%s (%d)\' | Genres: %s | Country: %s" + + " | IMDB ID: %s", movie['movie']['title'], movie['movie']['year'], ', '.join(movie['movie']['genres']), (movie['movie']['country'] or 'N/A').upper(), imdb_id) for source in json.loads(r.text)["Ratings"]: if source['Source'] == 'Rotten Tomatoes': # noinspection PyUnusedLocal ratings_exist = True - log.debug("Rotten Tomatoes score of %s for %s (%d) | Genres: %s | Country: %s | IMDB ID: %s ", + log.debug("Rotten Tomatoes score of %s for \'%s (%d)\' | Genres: %s | Country: %s | IMDB ID: %s ", source['Value'], movie['movie']['title'], movie['movie']['year'], ', '.join(movie['movie']['genres']), (movie['movie']['country'] or 'N/A').upper(), imdb_id) return int(source['Value'].split('%')[0]) if not ratings_exist: - log.debug("No Rotten Tomatoes score found for %s (%d) | Genres: %s | Country: %s | IMDB ID: %s ", + log.debug("No Rotten Tomatoes score found for \'%s (%d)\' | Genres: %s | Country: %s | IMDB ID: %s ", movie['movie']['title'], movie['movie']['year'], ', '.join(movie['movie']['genres']), (movie['movie']['country'] or 'N/A').upper(), imdb_id) else: - log.debug("Error encountered when requesting ratings from OMDB for %s (%d) | Genres: %s | Country: %s" + + log.debug("Error encountered when requesting ratings from OMDB for \'%s (%d)\' | Genres: %s | Country: %s" + " | IMDB ID: %s", movie['movie']['title'], movie['movie']['year'], ', '.join(movie['movie']['genres']), (movie['movie']['country'] or 'N/A').upper(), imdb_id) else: - log.debug("Skipping %s (%d) | Genres: %s | Country: %s as it does not have an IMDB ID", + log.debug("Skipping \'%s (%d)\' | Genres: %s | Country: %s as it does not have an IMDB ID", movie['movie']['title'], movie['movie']['year'], ', '.join(movie['movie']['genres']), (movie['movie']['country'] or 'N/A').upper()) diff --git a/helpers/sonarr.py b/helpers/sonarr.py index 99d34ca..e52c471 100644 --- a/helpers/sonarr.py +++ b/helpers/sonarr.py @@ -70,7 +70,8 @@ def remove_existing_series(sonarr_series, trakt_series, callback=None): continue # check if show exists in processed_series if tmp['show']['ids']['tvdb'] in processed_series: - log.debug("Removing existing show: %s", tmp['show']['title']) + log.debug("Removing existing show: \'%s (%s)\'", tmp['show']['title'], + str(tmp['show']['year']) if tmp['show']['year'] else '????') if callback: callback('show', tmp) continue diff --git a/media/pvr.py b/media/pvr.py index 45d95a0..b2429b5 100644 --- a/media/pvr.py +++ b/media/pvr.py @@ -129,17 +129,17 @@ class PVR(ABC): if (req.status_code == 201 or req.status_code == 200) \ and (response_json and identifier_field in response_json) \ and response_json[identifier_field] == identifier: - log.debug("Successfully added %s (%d)", payload['title'], identifier) + log.debug("Successfully added \'%s (%d)\'", payload['title'], identifier) return True elif response_json and ('errorMessage' in response_json or 'message' in response_json): message = response_json['errorMessage'] if 'errorMessage' in response_json else response_json['message'] - log.error("Failed to add %s (%d) - status_code: %d, reason: %s", payload['title'], identifier, + log.error("Failed to add \'%s (%d)\' - status_code: %d, reason: %s", payload['title'], identifier, req.status_code, message) return False else: - log.error("Failed to add %s (%d), unexpected response:\n%s", payload['title'], identifier, req.text) + log.error("Failed to add \'%s (%d)\', unexpected response:\n%s", payload['title'], identifier, req.text) return False except Exception: - log.exception("Exception adding %s (%d): ", payload['title'], identifier) + log.exception("Exception adding \'%s (%d)\': ", payload['title'], identifier) return None diff --git a/traktarr.py b/traktarr.py index 57a290d..717ef1a 100755 --- a/traktarr.py +++ b/traktarr.py @@ -153,7 +153,7 @@ def show(show_id, folder=None, no_search=False): log.error("Aborting due to failure to retrieve Trakt show") return None else: - log.info("Retrieved Trakt show information for %s: %s (%d)", show_id, trakt_show['title'], + log.info("Retrieved Trakt show information for %s: \'%s (%d)\'", show_id, trakt_show['title'], trakt_show['year']) # determine which tags to use when adding this series @@ -162,10 +162,10 @@ def show(show_id, folder=None, no_search=False): # add show to sonarr if sonarr.add_series(trakt_show['ids']['tvdb'], trakt_show['title'], trakt_show['ids']['slug'], profile_id, cfg.sonarr.root_folder, use_tags, not no_search): - log.info("ADDED %s (%d) with tags: %s", trakt_show['title'], trakt_show['year'], + log.info("ADDED \'%s (%d)\' with tags: %s", trakt_show['title'], trakt_show['year'], sonarr_helper.readable_tag_from_ids(profile_tags, use_tags)) else: - log.error("FAILED adding %s (%d) with tags: %s", trakt_show['title'], trakt_show['year'], + log.error("FAILED adding \'%s (%d)\' with tags: %s", trakt_show['title'], trakt_show['year'], sonarr_helper.readable_tag_from_ids(profile_tags, use_tags)) return @@ -314,13 +314,13 @@ def shows(list_type, add_limit=0, add_delay=2.5, sort='votes', genre=None, folde if sonarr.add_series(series['show']['ids']['tvdb'], series['show']['title'], series['show']['ids']['slug'], profile_id, cfg.sonarr.root_folder, use_tags, not no_search): - log.info("ADDED %s (%d) with tags: %s", series['show']['title'], series['show']['year'], + log.info("ADDED \'%s (%d)\' with tags: %s", series['show']['title'], series['show']['year'], sonarr_helper.readable_tag_from_ids(profile_tags, use_tags)) if notifications: callback_notify({'event': 'add_show', 'list_type': list_type, 'show': series['show']}) added_shows += 1 else: - log.error("FAILED adding %s (%d) with tags: %s", series['show']['title'], series['show']['year'], + log.error("FAILED adding \'%s (%d)\' with tags: %s", series['show']['title'], series['show']['year'], sonarr_helper.readable_tag_from_ids(profile_tags, use_tags)) # stop adding shows, if added_shows >= add_limit @@ -383,16 +383,16 @@ def movie(movie_id, folder=None, minimum_availability='released', no_search=Fals log.error("Aborting due to failure to retrieve Trakt movie") return None else: - log.info("Retrieved Trakt movie information for %s: %s (%d)", movie_id, trakt_movie['title'], + log.info("Retrieved Trakt movie information for %s: \'%s (%d)\'", movie_id, trakt_movie['title'], trakt_movie['year']) # add movie to radarr if radarr.add_movie(trakt_movie['ids']['tmdb'], trakt_movie['title'], trakt_movie['year'], trakt_movie['ids']['slug'], profile_id, cfg.radarr.root_folder, cfg.radarr.minimum_availability, not no_search): - log.info("ADDED %s (%d)", trakt_movie['title'], trakt_movie['year']) + log.info("ADDED \'%s (%d)\'", trakt_movie['title'], trakt_movie['year']) else: - log.error("FAILED adding %s (%d)", trakt_movie['title'], trakt_movie['year']) + log.error("FAILED adding \'%s (%d)\'", trakt_movie['title'], trakt_movie['year']) return @@ -554,27 +554,27 @@ def movies(list_type, add_limit=0, add_delay=2.5, sort='votes', rating=None, gen if rating is not None and 'omdb' in cfg and 'api_key' in cfg['omdb'] and cfg['omdb']['api_key']: movie_rating = rating_helper.get_rating(cfg['omdb']['api_key'], sorted_movie) if movie_rating == -1: - log.info("SKIPPED %s (%d)", sorted_movie['movie']['title'], sorted_movie['movie']['year']) + log.info("SKIPPED \'%s (%d)\'", sorted_movie['movie']['title'], sorted_movie['movie']['year']) continue if (rating is None or movie_rating is None) or movie_rating >= rating: - log.info("Adding: %s (%d) | Genres: %s | Country: %s", sorted_movie['movie']['title'], + log.info("Adding: \'%s (%d)\' | Genres: %s | Country: %s", sorted_movie['movie']['title'], sorted_movie['movie']['year'], ', '.join(sorted_movie['movie']['genres']), (sorted_movie['movie']['country'] or 'N/A').upper()) # add movie to radarr if radarr.add_movie(sorted_movie['movie']['ids']['tmdb'], sorted_movie['movie']['title'], sorted_movie['movie']['year'], sorted_movie['movie']['ids']['slug'], profile_id, cfg.radarr.root_folder, cfg.radarr.minimum_availability, not no_search): - log.info("ADDED %s (%d)", sorted_movie['movie']['title'], sorted_movie['movie']['year']) + log.info("ADDED \'%s (%d)\'", sorted_movie['movie']['title'], sorted_movie['movie']['year']) if notifications: callback_notify({'event': 'add_movie', 'list_type': list_type, 'movie': sorted_movie['movie']}) added_movies += 1 else: - log.error("FAILED adding %s (%d)", sorted_movie['movie']['title'], + log.error("FAILED adding \'%s (%d)\'", sorted_movie['movie']['title'], sorted_movie['movie']['year']) else: log.debug("Minimum Rotten Tomatoes score of %d%% was not met.", rating) - log.info("SKIPPED %s (%d)", sorted_movie['movie']['title'], sorted_movie['movie']['year']) + log.info("SKIPPED \'%s (%d)\'", sorted_movie['movie']['title'], sorted_movie['movie']['year']) # stop adding movies, if added_movies >= add_limit if add_limit and added_movies >= add_limit: break @@ -609,7 +609,7 @@ def callback_remove_recommended(media_type, media_info): media_info) return - media_name = '%s (%d)' % (media_info[media_type]['title'], media_info[media_type]['year']) + media_name = '\'%s (%d)\'' % (media_info[media_type]['title'], media_info[media_type]['year']) if trakt.remove_recommended_item(media_type, media_info[media_type]['ids']['trakt']): log.info("Removed rejected recommended %s: %s", media_type, media_name) @@ -624,12 +624,12 @@ def callback_notify(data): if data['event'] == 'add_movie': if cfg.notifications.verbose: notify.send( - message="Added %s movie: %s (%d)" % (data['list_type'], data['movie']['title'], data['movie']['year'])) + message="Added %s movie: \'%s (%d)\'" % (data['list_type'], data['movie']['title'], data['movie']['year'])) return elif data['event'] == 'add_show': if cfg.notifications.verbose: notify.send( - message="Added %s show: %s (%d)" % (data['list_type'], data['show']['title'], data['show']['year'])) + message="Added %s show: \'%s (%d)\'" % (data['list_type'], data['show']['title'], data['show']['year'])) return elif data['event'] == 'abort': notify.send(message="Aborted adding Trakt %s %s due to: %s" % (data['list_type'], data['type'], data['reason']))