|
|
|
@ -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)
|
|
|
|
|
|
|
|
|
|