find all installer downloads, not only the first one

This commit is contained in:
Sebastian Hugentobler 2017-03-21 11:32:43 +01:00
parent 7be923459e
commit 3f184ade1f
2 changed files with 21 additions and 19 deletions

View File

@ -1,12 +1,14 @@
# GOG-SYNC
A small tool to synchronize the stuff in a [GOG](https://www.gog.com/)library
A small tool to synchronize the stuff in a [GOG](https://www.gog.com/) library
with a local folder.
It builds on the work of the [unofficial GOG API Documentation](https://gogapidocs.readthedocs.io/en/latest/).
This is the first time I am building something with rust, so beware :)
**Please note that this is alpha software, you should not trust it.**
# Configuration
The configuration file is in the config folder as described by the xdg specification
with a prefix of `gog-sync`.

View File

@ -311,26 +311,26 @@ impl<'a> Gog<'a> {
for system in systems.keys() {
for real_downloads in systems.get(system) {
for real_download in real_downloads.as_array() {
let download = &real_download[0];
for download in real_download {
if !download.is_object() ||
!download.as_object().unwrap().contains_key("manualUrl") {
error!("Skipping an installer for {}", game.title);
continue;
}
if !download.is_object() ||
!download.as_object().unwrap().contains_key("manualUrl") {
error!("Skipping an installer for {}", game.title);
continue;
let installer = Installer {
manual_url: String::from(download["manualUrl"]
.as_str()
.unwrap()),
version: String::from(download["version"]
.as_str()
.unwrap_or("")),
os: system.clone(),
language: String::from(installer_language),
};
game.installers.push(installer);
}
let installer = Installer {
manual_url: String::from(download["manualUrl"]
.as_str()
.unwrap()),
version: String::from(download["version"]
.as_str()
.unwrap_or("")),
os: system.clone(),
language: String::from(installer_language),
};
game.installers.push(installer);
}
}
}