provide titleSlug to sonarr & radarr

pull/54/head
l3uddz 7 years ago
parent 1cb17ff6ff
commit 08a216ef55

@ -76,14 +76,15 @@ class Radarr:
return None return None
@backoff.on_predicate(backoff.expo, lambda x: x is None, max_tries=4, on_backoff=backoff_handler) @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: try:
# generate payload # generate payload
payload = { payload = {
'tmdbId': movie_tmdbid, 'title': movie_title, 'year': movie_year, 'tmdbId': movie_tmdbid, 'title': movie_title, 'year': movie_year,
'qualityProfileId': profile_id, 'images': [], 'qualityProfileId': profile_id, 'images': [],
'monitored': True, 'rootFolderPath': root_folder, 'monitored': True, 'rootFolderPath': root_folder,
'minimumAvailability': 'released', 'titleSlug': '', 'minimumAvailability': 'released', 'titleSlug': movie_title_slug,
'addOptions': {'ignoreEpisodesWithFiles': False, 'ignoreEpisodesWithoutFiles': False, 'addOptions': {'ignoreEpisodesWithFiles': False, 'ignoreEpisodesWithoutFiles': False,
'searchForMovie': search_missing} 'searchForMovie': search_missing}
} }

@ -76,11 +76,11 @@ class Sonarr:
return None return None
@backoff.on_predicate(backoff.expo, lambda x: x is None, max_tries=4, on_backoff=backoff_handler) @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: try:
# generate payload # generate payload
payload = { payload = {
'tvdbId': series_tvdbid, 'title': series_title, 'tvdbId': series_tvdbid, 'title': series_title, 'titleSlug': series_title_slug,
'qualityProfileId': profile_id, 'images': [], 'qualityProfileId': profile_id, 'images': [],
'seasons': [], 'seasonFolder': True, 'seasons': [], 'seasonFolder': True,
'monitored': True, 'rootFolderPath': root_folder, 'monitored': True, 'rootFolderPath': root_folder,

@ -106,9 +106,8 @@ def shows(list_type, add_limit=0, add_delay=2.5, no_search=False):
series['show']['country'].upper()) series['show']['country'].upper())
# add show to sonarr # add show to sonarr
if sonarr.add_series(series['show']['ids']['tvdb'], series['show']['title'], profile_id, if sonarr.add_series(series['show']['ids']['tvdb'], series['show']['title'],
cfg.sonarr.root_folder, series['show']['ids']['slug'], profile_id, cfg.sonarr.root_folder, not no_search):
not no_search):
log.info("ADDED %s (%d)", series['show']['title'], series['show']['year']) log.info("ADDED %s (%d)", series['show']['title'], series['show']['year'])
added_shows += 1 added_shows += 1
else: 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()) ', '.join(movie['movie']['genres']), movie['movie']['country'].upper())
# add movie to radarr # add movie to radarr
if radarr.add_movie(movie['movie']['ids']['tmdb'], movie['movie']['title'], movie['movie']['year'], 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']) log.info("ADDED %s (%d)", movie['movie']['title'], movie['movie']['year'])
added_movies += 1 added_movies += 1
else: else:

Loading…
Cancel
Save