Only send to *darr the qualities that change

We only send to Sonarr & Radarr the qualities in a quality definition
that the script supports and changes.
pull/5/head
Robert Dailey 4 years ago
parent dc5ef2b25a
commit 93ffbdbbc1

@ -42,15 +42,25 @@ class Radarr(Server):
# --------------------------------------------------------------------------------------------------
# PUT /qualityDefinition/update
def update_quality_definition(self, server_definition, guide_definition):
new_definition = deepcopy(server_definition)
for quality, min, max, preferred in guide_definition:
entry = self.find_quality_definition_entry(new_definition, quality)
new_definition = []
for quality, min_value, max_value, preferred in guide_definition:
entry = self.find_quality_definition_entry(server_definition, quality)
if not entry:
print(f'WARN: Quality definition lacks entry for {quality}; it will be skipped.')
continue
entry['minSize'] = min
entry['maxSize'] = max
entry = deepcopy(entry)
entry['minSize'] = min_value
entry['maxSize'] = max_value
entry['preferredSize'] = preferred
new_definition.append(entry)
self.logger.debug('Setting Quality '
f'[Name: {entry["quality"]["name"]}] '
f'[Source: {entry["quality"]["source"]}] '
f'[Min: {entry["minSize"]}] '
f'[Max: {entry["maxSize"]}] '
f'[Preferred: {entry["preferredSize"]}] '
)
self.request('put', '/qualityDefinition/update', new_definition)

@ -125,15 +125,23 @@ class Sonarr(Server):
# --------------------------------------------------------------------------------------------------
# PUT /qualityDefinition/update
def update_quality_definition(self, sonarr_definition, guide_definition):
new_definition = deepcopy(sonarr_definition)
for quality, min, max in guide_definition:
entry = self.find_quality_definition_entry(new_definition, quality)
def update_quality_definition(self, server_definition, guide_definition):
new_definition = []
for quality, min_value, max_value in guide_definition:
entry = self.find_quality_definition_entry(server_definition, quality)
if not entry:
print(f'WARN: Quality definition lacks entry for {quality}; it will be skipped.')
continue
entry['minSize'] = min
entry['maxSize'] = max
entry = deepcopy(entry)
entry['minSize'] = min_value
entry['maxSize'] = max_value
new_definition.append(entry)
self.logger.debug('Setting Quality '
f'[Name: {entry["quality"]["name"]}] '
f'[Min: {entry["minSize"]}] '
f'[Max: {entry["maxSize"]}] '
)
self.request('put', '/qualityDefinition/update', new_definition)

Loading…
Cancel
Save