mirror of
https://github.com/Dictionarry-Hub/profilarr.git
synced 2026-01-28 21:40:58 +01:00
feat: add support for 'edition' and 'quality_modifier' condition types in FormatConverter
This commit is contained in:
@@ -51,14 +51,15 @@ class FormatConverter:
|
||||
target_app: TargetApp) -> Optional[Specification]:
|
||||
condition_type = condition['type']
|
||||
|
||||
if condition_type in ['release_title', 'release_group']:
|
||||
if condition_type in ['release_title', 'release_group', 'edition']:
|
||||
pattern_name = condition['pattern']
|
||||
pattern = self.patterns.get(pattern_name)
|
||||
if not pattern:
|
||||
return None
|
||||
implementation = ('ReleaseTitleSpecification'
|
||||
if condition_type == 'release_title' else
|
||||
'ReleaseGroupSpecification')
|
||||
'ReleaseGroupSpecification' if condition_type
|
||||
== 'release_group' else 'EditionSpecification')
|
||||
fields = [{'name': 'value', 'value': pattern}]
|
||||
|
||||
elif condition_type == 'source':
|
||||
@@ -77,6 +78,14 @@ class FormatConverter:
|
||||
target_app)
|
||||
fields = [{'name': 'value', 'value': value}]
|
||||
|
||||
elif condition_type == 'quality_modifier':
|
||||
if target_app == TargetApp.SONARR:
|
||||
return None
|
||||
implementation = 'QualityModifierSpecification'
|
||||
value = ValueResolver.get_quality_modifier(
|
||||
condition['qualityModifier'])
|
||||
fields = [{'name': 'value', 'value': value}]
|
||||
|
||||
elif condition_type == 'language':
|
||||
implementation = 'LanguageSpecification'
|
||||
language_name = condition['language'].lower()
|
||||
@@ -94,6 +103,7 @@ class FormatConverter:
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
# still need to do size, year, release type
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user