diff --git a/media/sonarr.py b/media/sonarr.py index 387a43d..4406a8e 100644 --- a/media/sonarr.py +++ b/media/sonarr.py @@ -43,7 +43,7 @@ class Sonarr(PVR): @backoff.on_predicate(backoff.expo, lambda x: x is None, max_tries=4, on_backoff=backoff_handler) def add_series(self, series_tvdb_id, series_title, series_title_slug, profile_id, root_folder, tag_ids=None, - search_missing=False): + search_missing=False, series_type='standard'): payload = self._prepare_add_object_payload(series_title, series_title_slug, profile_id, root_folder) payload = dict_merge(payload, { @@ -51,6 +51,7 @@ class Sonarr(PVR): 'tags': [] if not tag_ids or not isinstance(tag_ids, list) else tag_ids, 'seasons': [], 'seasonFolder': True, + 'seriesType': series_type, 'addOptions': { 'searchForMissingEpisodes': search_missing } diff --git a/traktarr.py b/traktarr.py index 1038e45..64415a7 100755 --- a/traktarr.py +++ b/traktarr.py @@ -196,6 +196,14 @@ def show(show_id, folder=None, no_search=False): use_tags = sonarr_helper.series_tag_id_from_network(profile_tags, cfg.sonarr.tags, trakt_show['network']) readable_tags = sonarr_helper.readable_tag_from_ids(profile_tags, use_tags) + # series type + if any('anime' in s.lower() for s in trakt_show['genres']): + series_type = 'anime' + else: + series_type = 'standard' + + log.debug("Set series type for \'%s (%s)\' to: %s", series_title, series_year, series_type.title()) + # add show to sonarr if sonarr.add_series(trakt_show['ids']['tvdb'], series_title, @@ -204,6 +212,7 @@ def show(show_id, folder=None, no_search=False): cfg.sonarr.root_folder, use_tags, not no_search, + series_type, ): if profile_tags is not None: log.info("ADDED: \'%s (%s)\' with Sonarr Tags: %s", series_title, series_year, @@ -417,6 +426,14 @@ def shows(list_type, add_limit=0, add_delay=2.5, sort='votes', genre=None, folde else: series_year = '????' + # series type + if any('anime' in s.lower() for s in series['show']['genres']): + series_type = 'anime' + else: + series_type = 'standard' + + log.debug("Set series type for \'%s (%s)\' to: %s", series_title, series_year, series_type.title()) + # build list of genres series_genres = (', '.join(series['show']['genres'])).title() if series['show']['genres'] else 'N/A' @@ -462,6 +479,7 @@ def shows(list_type, add_limit=0, add_delay=2.5, sort='votes', genre=None, folde cfg.sonarr.root_folder, use_tags, not no_search, + series_type, ): if profile_tags is not None: log.info("ADDED: \'%s (%s)\' with Sonarr Tags: %s", series_title, series_year,