From 08a216ef55e883e124b1240c2b46bc63a1136006 Mon Sep 17 00:00:00 2001 From: l3uddz Date: Tue, 6 Mar 2018 23:18:43 +0000 Subject: [PATCH] provide titleSlug to sonarr & radarr --- media/radarr.py | 5 +++-- media/sonarr.py | 4 ++-- traktarr.py | 7 +++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/media/radarr.py b/media/radarr.py index ca9015e..14fca3e 100644 --- a/media/radarr.py +++ b/media/radarr.py @@ -76,14 +76,15 @@ class Radarr: return None @backoff.on_predicate(backoff.expo, lambda x: x is None, max_tries=4, on_backoff=backoff_handler) - def add_movie(self, movie_tmdbid, movie_title, movie_year, profile_id, root_folder, search_missing=False): + def add_movie(self, movie_tmdbid, movie_title, movie_year, movie_title_slug, profile_id, root_folder, + search_missing=False): try: # generate payload payload = { 'tmdbId': movie_tmdbid, 'title': movie_title, 'year': movie_year, 'qualityProfileId': profile_id, 'images': [], 'monitored': True, 'rootFolderPath': root_folder, - 'minimumAvailability': 'released', 'titleSlug': '', + 'minimumAvailability': 'released', 'titleSlug': movie_title_slug, 'addOptions': {'ignoreEpisodesWithFiles': False, 'ignoreEpisodesWithoutFiles': False, 'searchForMovie': search_missing} } diff --git a/media/sonarr.py b/media/sonarr.py index 38b41c1..7857c98 100644 --- a/media/sonarr.py +++ b/media/sonarr.py @@ -76,11 +76,11 @@ class Sonarr: return None @backoff.on_predicate(backoff.expo, lambda x: x is None, max_tries=4, on_backoff=backoff_handler) - def add_series(self, series_tvdbid, series_title, profile_id, root_folder, search_missing=False): + def add_series(self, series_tvdbid, series_title, series_title_slug, profile_id, root_folder, search_missing=False): try: # generate payload payload = { - 'tvdbId': series_tvdbid, 'title': series_title, + 'tvdbId': series_tvdbid, 'title': series_title, 'titleSlug': series_title_slug, 'qualityProfileId': profile_id, 'images': [], 'seasons': [], 'seasonFolder': True, 'monitored': True, 'rootFolderPath': root_folder, diff --git a/traktarr.py b/traktarr.py index 95e702b..d07eb1f 100644 --- a/traktarr.py +++ b/traktarr.py @@ -106,9 +106,8 @@ def shows(list_type, add_limit=0, add_delay=2.5, no_search=False): series['show']['country'].upper()) # add show to sonarr - if sonarr.add_series(series['show']['ids']['tvdb'], series['show']['title'], profile_id, - cfg.sonarr.root_folder, - not no_search): + if sonarr.add_series(series['show']['ids']['tvdb'], series['show']['title'], + series['show']['ids']['slug'], profile_id, cfg.sonarr.root_folder, not no_search): log.info("ADDED %s (%d)", series['show']['title'], series['show']['year']) added_shows += 1 else: @@ -204,7 +203,7 @@ def movies(list_type, add_limit=0, add_delay=2.5, no_search=False): ', '.join(movie['movie']['genres']), movie['movie']['country'].upper()) # add movie to radarr if radarr.add_movie(movie['movie']['ids']['tmdb'], movie['movie']['title'], movie['movie']['year'], - profile_id, cfg.radarr.root_folder, not no_search): + movie['movie']['ids']['slug'], profile_id, cfg.radarr.root_folder, not no_search): log.info("ADDED %s (%d)", movie['movie']['title'], movie['movie']['year']) added_movies += 1 else: