mirror of
https://github.com/idanoo/autobrr
synced 2025-07-22 16:29:12 +00:00
docs: improve freeleech detection in parsing (#1934)
fix(ci): improve freeleech detection in parsing
This commit is contained in:
parent
25574446f7
commit
79d0d6e572
1 changed files with 9 additions and 1 deletions
|
@ -27,10 +27,18 @@ def parse_yaml_file(file_path: str) -> Dict:
|
||||||
if supports_match:
|
if supports_match:
|
||||||
supports = re.findall(r'-\s*(\w+)', supports_match.group(1))
|
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 = 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))
|
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 = {
|
result = {
|
||||||
'name': name_match.group(1).strip() if name_match else '',
|
'name': name_match.group(1).strip() if name_match else '',
|
||||||
'description': desc_match.group(1).strip() if desc_match else '',
|
'description': desc_match.group(1).strip() if desc_match else '',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue