mirror of
https://codeberg.org/icewind/ugc-scaper.git
synced 2026-06-03 18:24:10 +02:00
guess region from format
This commit is contained in:
parent
cf17647408
commit
a46314d91a
1 changed files with 9 additions and 2 deletions
|
|
@ -151,11 +151,12 @@ impl Parser for TeamParser {
|
||||||
.map(String::from)
|
.map(String::from)
|
||||||
});
|
});
|
||||||
|
|
||||||
let format = select_text(root, &self.selector_team_format)
|
let format_text = select_text(root, &self.selector_team_format)
|
||||||
.ok_or(ParseError::ElementNotFound {
|
.ok_or(ParseError::ElementNotFound {
|
||||||
selector: SELECTOR_TEAM_FORMAT,
|
selector: SELECTOR_TEAM_FORMAT,
|
||||||
role: "team format",
|
role: "team format",
|
||||||
})?
|
})?;
|
||||||
|
let format = format_text
|
||||||
.parse::<GameMode>()
|
.parse::<GameMode>()
|
||||||
.map_err(|e| ParseError::InvalidText {
|
.map_err(|e| ParseError::InvalidText {
|
||||||
text: e.text,
|
text: e.text,
|
||||||
|
|
@ -191,6 +192,12 @@ impl Parser for TeamParser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if region.is_none() {
|
||||||
|
region = format_text
|
||||||
|
.split(' ')
|
||||||
|
.find_map(|part| Region::from_str(part).ok());
|
||||||
|
}
|
||||||
|
|
||||||
let description = select_text(root, &self.selector_team_description)
|
let description = select_text(root, &self.selector_team_description)
|
||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
.replace('\n', " ");
|
.replace('\n', " ");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue