support multiple tags per show.

show tag names in log messages instead of tag id's.
pull/6/head
l3uddz 7 years ago
parent cfd051c184
commit 3c48c53006

@ -10,16 +10,32 @@ log = logger.get_logger(__name__)
def sonarr_series_tag_id_from_network(profile_tags, network_tags, network):
try:
tags = []
for tag_name, tag_networks in network_tags.items():
for tag_network in tag_networks:
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)
return [profile_tags[tag_name.lower()]]
tags.append(profile_tags[tag_name.lower()])
if tags:
return tags
except Exception:
log.exception("Exception determining tag to use for network %s: ", network)
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):
series = {}
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'],
series['show']['ids']['slug'], profile_id, cfg.sonarr.root_folder, use_tags,
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:
callback_notify({'event': 'add_show', 'list_type': list_type, 'show': series['show']})
added_shows += 1
else:
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
if add_limit and added_shows >= add_limit:

Loading…
Cancel
Save