add a third variant for cs keys...
This commit is contained in:
parent
a5609bc344
commit
e11a699de7
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@ -5,7 +5,7 @@
|
|||||||
"name": "Debug",
|
"name": "Debug",
|
||||||
"type": "lldb-mi",
|
"type": "lldb-mi",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"target": "./target/debug/gog-backup",
|
"target": "./target/debug/gog-sync",
|
||||||
"cwd": "${workspaceRoot}"
|
"cwd": "${workspaceRoot}"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
Binary file not shown.
17
src/gog.rs
17
src/gog.rs
@ -134,7 +134,7 @@ impl<'a> Gog<'a> {
|
|||||||
let mut config: Config = match configfiles.load("config.json") {
|
let mut config: Config = match configfiles.load("config.json") {
|
||||||
Ok(value) => value,
|
Ok(value) => value,
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
error!("Configuration error, generating new one...");
|
error!("Configuration error, generating new one");
|
||||||
|
|
||||||
Config {
|
Config {
|
||||||
game_storage: String::from(storage_path),
|
game_storage: String::from(storage_path),
|
||||||
@ -340,9 +340,16 @@ impl<'a> Gog<'a> {
|
|||||||
|
|
||||||
fn parse_cd_keys(&self, content_title: &str, raw_cd_keys: &str) -> BTreeMap<String, String> {
|
fn parse_cd_keys(&self, content_title: &str, raw_cd_keys: &str) -> BTreeMap<String, String> {
|
||||||
let mut cd_keys = BTreeMap::new();
|
let mut cd_keys = BTreeMap::new();
|
||||||
|
let mut raw_cd_keys_fix = raw_cd_keys.to_owned();
|
||||||
|
|
||||||
if raw_cd_keys.contains("<br>") {
|
if raw_cd_keys_fix.contains("<span>") {
|
||||||
let splitted_keys = raw_cd_keys.split("<br>");
|
raw_cd_keys_fix = raw_cd_keys_fix.replace("</span><span>", "<br>")
|
||||||
|
.replace("<span>", "")
|
||||||
|
.replace("</span>", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
if raw_cd_keys_fix.contains("<br>") {
|
||||||
|
let splitted_keys = raw_cd_keys_fix.split("<br>");
|
||||||
|
|
||||||
let mut key_names: Vec<String> = Vec::new();
|
let mut key_names: Vec<String> = Vec::new();
|
||||||
let mut key_values: Vec<String> = Vec::new();
|
let mut key_values: Vec<String> = Vec::new();
|
||||||
@ -361,8 +368,8 @@ impl<'a> Gog<'a> {
|
|||||||
let key_value = key_values[index].clone();
|
let key_value = key_values[index].clone();
|
||||||
cd_keys.insert(key_name.clone(), key_value);
|
cd_keys.insert(key_name.clone(), key_value);
|
||||||
}
|
}
|
||||||
} else if !raw_cd_keys.is_empty() {
|
} else if !raw_cd_keys_fix.is_empty() {
|
||||||
cd_keys.insert(content_title.to_owned(), raw_cd_keys.trim().to_owned());
|
cd_keys.insert(content_title.to_owned(), raw_cd_keys_fix.trim().to_owned());
|
||||||
}
|
}
|
||||||
|
|
||||||
return cd_keys;
|
return cd_keys;
|
||||||
|
Loading…
Reference in New Issue
Block a user