diff --git a/README.md b/README.md index e696014..f152fb5 100644 --- a/README.md +++ b/README.md @@ -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`. diff --git a/src/gog.rs b/src/gog.rs index d5af4aa..1027c08 100644 --- a/src/gog.rs +++ b/src/gog.rs @@ -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); } } }