From 79d0d6e572e6d662414c5421386d6f9b96be67d1 Mon Sep 17 00:00:00 2001 From: soup Date: Wed, 8 Jan 2025 08:38:46 +0100 Subject: [PATCH] docs: improve freeleech detection in parsing (#1934) fix(ci): improve freeleech detection in parsing --- scripts/update-indexers.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/update-indexers.py b/scripts/update-indexers.py index 3b2cc9a..0a42b78 100644 --- a/scripts/update-indexers.py +++ b/scripts/update-indexers.py @@ -27,10 +27,18 @@ def parse_yaml_file(file_path: str) -> Dict: if supports_match: supports = re.findall(r'-\s*(\w+)', supports_match.group(1)) - # Look for freeleech in vars section + # Look for freeleech in multiple places: + # 1. In vars section has_freeleech = bool(re.search(r'vars:.*?-\s*freeleech\s*$', content, re.MULTILINE | re.DOTALL)) has_freeleech_percent = bool(re.search(r'vars:.*?-\s*freeleechPercent\s*$', content, re.MULTILINE | re.DOTALL)) + # 2. In mappings section - check what the fields map to + mappings_freeleech = bool(re.search(r'mappings:.*?(?:freeleech|freeleechPercent):\s*(?!.*?percent|.*?\d+%)', content, re.MULTILINE | re.DOTALL)) + mappings_freeleech_percent = bool(re.search(r'mappings:.*?(?:freeleech|freeleechPercent):\s*(?:.*?percent|.*?\d+%)', content, re.MULTILINE | re.DOTALL)) + + has_freeleech = has_freeleech or mappings_freeleech + has_freeleech_percent = has_freeleech_percent or mappings_freeleech_percent + result = { 'name': name_match.group(1).strip() if name_match else '', 'description': desc_match.group(1).strip() if desc_match else '',