From afef0ff2c375447013a39886e1e5b6e2b43e5186 Mon Sep 17 00:00:00 2001 From: Sam Chau Date: Tue, 14 Jan 2025 06:44:41 +1030 Subject: [PATCH] feat: add size condition support in FormatConverter for min and max size specifications --- backend/app/compile/format_compiler.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/backend/app/compile/format_compiler.py b/backend/app/compile/format_compiler.py index 427d3cb..2a77156 100644 --- a/backend/app/compile/format_compiler.py +++ b/backend/app/compile/format_compiler.py @@ -86,6 +86,18 @@ class FormatConverter: condition['qualityModifier']) fields = [{'name': 'value', 'value': value}] + elif condition_type == 'size': + implementation = 'SizeSpecification' + min_size = condition.get('minSize') + max_size = condition.get('maxSize') + fields = [{ + 'name': 'min', + 'value': min_size + }, { + 'name': 'max', + 'value': max_size + }] + elif condition_type == 'language': implementation = 'LanguageSpecification' language_name = condition['language'].lower() @@ -103,7 +115,7 @@ class FormatConverter: except Exception: return None - # still need to do size, year, release type + # still need to do year, release type else: return None