Logs: Added single quotes around movie and show titles.

pull/93/head
desimaniac 6 years ago
parent 295a854b0a
commit a8bb4ece61

@ -39,7 +39,8 @@ def remove_existing_movies(radarr_movies, trakt_movies, callback=None):
continue continue
# check if movie exists in processed_movies # check if movie exists in processed_movies
if tmp['movie']['ids']['tmdb'] 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: if callback:
callback('movie', tmp) callback('movie', tmp)
continue continue

@ -10,33 +10,33 @@ def get_rating(apikey, movie):
ratings_exist = False ratings_exist = False
imdb_id = movie['movie']['ids']['imdb'] imdb_id = movie['movie']['ids']['imdb']
if imdb_id: 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']['title'], movie['movie']['year'], ', '.join(movie['movie']['genres']),
(movie['movie']['country'] or 'N/A').upper(), imdb_id) (movie['movie']['country'] or 'N/A').upper(), imdb_id)
r = requests.get('http://www.omdbapi.com/?i=' + imdb_id + '&apikey=' + apikey) r = requests.get('http://www.omdbapi.com/?i=' + imdb_id + '&apikey=' + apikey)
if r.status_code == 200 and json.loads(r.text)["Response"] == 'True': 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", log.debug("Successfully requested ratings from OMDB for \'%s (%d)\' | Genres: %s | Country: %s" +
movie['movie']['title'], movie['movie']['year'], " | IMDB ID: %s", movie['movie']['title'], movie['movie']['year'],
', '.join(movie['movie']['genres']), (movie['movie']['country'] or 'N/A').upper(), imdb_id) ', '.join(movie['movie']['genres']), (movie['movie']['country'] or 'N/A').upper(), imdb_id)
for source in json.loads(r.text)["Ratings"]: for source in json.loads(r.text)["Ratings"]:
if source['Source'] == 'Rotten Tomatoes': if source['Source'] == 'Rotten Tomatoes':
# noinspection PyUnusedLocal # noinspection PyUnusedLocal
ratings_exist = True 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'], source['Value'], movie['movie']['title'], movie['movie']['year'],
', '.join(movie['movie']['genres']), (movie['movie']['country'] or 'N/A').upper(), ', '.join(movie['movie']['genres']), (movie['movie']['country'] or 'N/A').upper(),
imdb_id) imdb_id)
return int(source['Value'].split('%')[0]) return int(source['Value'].split('%')[0])
if not ratings_exist: 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']['title'], movie['movie']['year'], ', '.join(movie['movie']['genres']),
(movie['movie']['country'] or 'N/A').upper(), imdb_id) (movie['movie']['country'] or 'N/A').upper(), imdb_id)
else: 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'], " | IMDB ID: %s", movie['movie']['title'], movie['movie']['year'],
', '.join(movie['movie']['genres']), (movie['movie']['country'] or 'N/A').upper(), imdb_id) ', '.join(movie['movie']['genres']), (movie['movie']['country'] or 'N/A').upper(), imdb_id)
else: 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']['title'], movie['movie']['year'], ', '.join(movie['movie']['genres']),
(movie['movie']['country'] or 'N/A').upper()) (movie['movie']['country'] or 'N/A').upper())

@ -70,7 +70,8 @@ def remove_existing_series(sonarr_series, trakt_series, callback=None):
continue continue
# check if show exists in processed_series # check if show exists in processed_series
if tmp['show']['ids']['tvdb'] 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: if callback:
callback('show', tmp) callback('show', tmp)
continue continue

@ -129,17 +129,17 @@ class PVR(ABC):
if (req.status_code == 201 or req.status_code == 200) \ if (req.status_code == 201 or req.status_code == 200) \
and (response_json and identifier_field in response_json) \ and (response_json and identifier_field in response_json) \
and response_json[identifier_field] == identifier: 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 return True
elif response_json and ('errorMessage' in response_json or 'message' in response_json): 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'] 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) req.status_code, message)
return False return False
else: 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 return False
except Exception: except Exception:
log.exception("Exception adding %s (%d): ", payload['title'], identifier) log.exception("Exception adding \'%s (%d)\': ", payload['title'], identifier)
return None return None

@ -153,7 +153,7 @@ def show(show_id, folder=None, no_search=False):
log.error("Aborting due to failure to retrieve Trakt show") log.error("Aborting due to failure to retrieve Trakt show")
return None return None
else: 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']) trakt_show['year'])
# determine which tags to use when adding this series # 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 # add show to sonarr
if sonarr.add_series(trakt_show['ids']['tvdb'], trakt_show['title'], trakt_show['ids']['slug'], profile_id, 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): 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)) sonarr_helper.readable_tag_from_ids(profile_tags, use_tags))
else: 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)) sonarr_helper.readable_tag_from_ids(profile_tags, use_tags))
return 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'], if sonarr.add_series(series['show']['ids']['tvdb'], series['show']['title'],
series['show']['ids']['slug'], profile_id, cfg.sonarr.root_folder, use_tags, series['show']['ids']['slug'], profile_id, cfg.sonarr.root_folder, use_tags,
not no_search): 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)) sonarr_helper.readable_tag_from_ids(profile_tags, use_tags))
if notifications: if notifications:
callback_notify({'event': 'add_show', 'list_type': list_type, 'show': series['show']}) callback_notify({'event': 'add_show', 'list_type': list_type, 'show': series['show']})
added_shows += 1 added_shows += 1
else: 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)) sonarr_helper.readable_tag_from_ids(profile_tags, use_tags))
# stop adding shows, if added_shows >= add_limit # 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") log.error("Aborting due to failure to retrieve Trakt movie")
return None return None
else: 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']) trakt_movie['year'])
# add movie to radarr # add movie to radarr
if radarr.add_movie(trakt_movie['ids']['tmdb'], trakt_movie['title'], trakt_movie['year'], if radarr.add_movie(trakt_movie['ids']['tmdb'], trakt_movie['title'], trakt_movie['year'],
trakt_movie['ids']['slug'], profile_id, cfg.radarr.root_folder, trakt_movie['ids']['slug'], profile_id, cfg.radarr.root_folder,
cfg.radarr.minimum_availability, not no_search): 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: 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 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']: 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) movie_rating = rating_helper.get_rating(cfg['omdb']['api_key'], sorted_movie)
if movie_rating == -1: 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 continue
if (rating is None or movie_rating is None) or movie_rating >= rating: 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']['year'], ', '.join(sorted_movie['movie']['genres']),
(sorted_movie['movie']['country'] or 'N/A').upper()) (sorted_movie['movie']['country'] or 'N/A').upper())
# add movie to radarr # add movie to radarr
if radarr.add_movie(sorted_movie['movie']['ids']['tmdb'], sorted_movie['movie']['title'], if radarr.add_movie(sorted_movie['movie']['ids']['tmdb'], sorted_movie['movie']['title'],
sorted_movie['movie']['year'], sorted_movie['movie']['ids']['slug'], profile_id, sorted_movie['movie']['year'], sorted_movie['movie']['ids']['slug'], profile_id,
cfg.radarr.root_folder, cfg.radarr.minimum_availability, not no_search): 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: if notifications:
callback_notify({'event': 'add_movie', 'list_type': list_type, callback_notify({'event': 'add_movie', 'list_type': list_type,
'movie': sorted_movie['movie']}) 'movie': sorted_movie['movie']})
added_movies += 1 added_movies += 1
else: 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']) sorted_movie['movie']['year'])
else: else:
log.debug("Minimum Rotten Tomatoes score of %d%% was not met.", rating) 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 # stop adding movies, if added_movies >= add_limit
if add_limit and added_movies >= add_limit: if add_limit and added_movies >= add_limit:
break break
@ -609,7 +609,7 @@ def callback_remove_recommended(media_type, media_info):
media_info) media_info)
return 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']): if trakt.remove_recommended_item(media_type, media_info[media_type]['ids']['trakt']):
log.info("Removed rejected recommended %s: %s", media_type, media_name) 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 data['event'] == 'add_movie':
if cfg.notifications.verbose: if cfg.notifications.verbose:
notify.send( 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 return
elif data['event'] == 'add_show': elif data['event'] == 'add_show':
if cfg.notifications.verbose: if cfg.notifications.verbose:
notify.send( 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 return
elif data['event'] == 'abort': elif data['event'] == 'abort':
notify.send(message="Aborted adding Trakt %s %s due to: %s" % (data['list_type'], data['type'], data['reason'])) notify.send(message="Aborted adding Trakt %s %s due to: %s" % (data['list_type'], data['type'], data['reason']))

Loading…
Cancel
Save