Merge branch 'develop'

pull/54/head
l3uddz 7 years ago
commit 5c0661a260

@ -10,16 +10,32 @@ log = logger.get_logger(__name__)
def sonarr_series_tag_id_from_network(profile_tags, network_tags, network): def sonarr_series_tag_id_from_network(profile_tags, network_tags, network):
try: try:
tags = []
for tag_name, tag_networks in network_tags.items(): for tag_name, tag_networks in network_tags.items():
for tag_network in tag_networks: for tag_network in tag_networks:
if tag_network.lower() in network.lower() and tag_name.lower() in profile_tags: if tag_network.lower() in network.lower() and tag_name.lower() in profile_tags:
log.debug("Using %s tag for network: %s", tag_name, network) log.debug("Using %s tag for network: %s", tag_name, network)
return [profile_tags[tag_name.lower()]] tags.append(profile_tags[tag_name.lower()])
if tags:
return tags
except Exception: except Exception:
log.exception("Exception determining tag to use for network %s: ", network) log.exception("Exception determining tag to use for network %s: ", network)
return None return None
def sonarr_readable_tag_from_ids(profile_tag_ids, chosen_tag_ids):
try:
tags = []
for tag_name, tag_id in profile_tag_ids.items():
if tag_id in chosen_tag_ids:
tags.append(tag_name)
if tags:
return tags
except Exception:
log.exception("Exception building readable tag name list from ids %s: ", chosen_tag_ids)
return None
def sonarr_series_to_tvdb_dict(sonarr_series): def sonarr_series_to_tvdb_dict(sonarr_series):
series = {} series = {}
try: try:

@ -157,13 +157,14 @@ def shows(list_type, add_limit=0, add_delay=2.5, no_search=False, notifications=
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'], use_tags) log.info("ADDED %s (%d) with tags: %s", series['show']['title'], series['show']['year'],
helpers.sonarr_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'],
use_tags) helpers.sonarr_readable_tag_from_ids(profile_tags, use_tags))
# stop adding shows, if added_shows >= add_limit # stop adding shows, if added_shows >= add_limit
if add_limit and added_shows >= add_limit: if add_limit and added_shows >= add_limit:

Loading…
Cancel
Save