Sonarr: Set seriesType to 'anime' when series is of Anime genre

Closes #63
pull/105/head
desimaniac 5 years ago
parent 129e9bb803
commit e0a6caebc1

@ -43,7 +43,7 @@ class Sonarr(PVR):
@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_tvdb_id, series_title, series_title_slug, profile_id, root_folder, tag_ids=None, 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 = self._prepare_add_object_payload(series_title, series_title_slug, profile_id, root_folder)
payload = dict_merge(payload, { 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, 'tags': [] if not tag_ids or not isinstance(tag_ids, list) else tag_ids,
'seasons': [], 'seasons': [],
'seasonFolder': True, 'seasonFolder': True,
'seriesType': series_type,
'addOptions': { 'addOptions': {
'searchForMissingEpisodes': search_missing 'searchForMissingEpisodes': search_missing
} }

@ -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']) 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) 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 # add show to sonarr
if sonarr.add_series(trakt_show['ids']['tvdb'], if sonarr.add_series(trakt_show['ids']['tvdb'],
series_title, series_title,
@ -204,6 +212,7 @@ def show(show_id, folder=None, no_search=False):
cfg.sonarr.root_folder, cfg.sonarr.root_folder,
use_tags, use_tags,
not no_search, not no_search,
series_type,
): ):
if profile_tags is not None: if profile_tags is not None:
log.info("ADDED: \'%s (%s)\' with Sonarr Tags: %s", series_title, series_year, 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: else:
series_year = '????' 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 # build list of genres
series_genres = (', '.join(series['show']['genres'])).title() if series['show']['genres'] else 'N/A' 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, cfg.sonarr.root_folder,
use_tags, use_tags,
not no_search, not no_search,
series_type,
): ):
if profile_tags is not None: if profile_tags is not None:
log.info("ADDED: \'%s (%s)\' with Sonarr Tags: %s", series_title, series_year, log.info("ADDED: \'%s (%s)\' with Sonarr Tags: %s", series_title, series_year,

Loading…
Cancel
Save