mirror of
https://github.com/djibux/BoilR.git
synced 2026-09-01 05:53:41 +02:00
Refactor out find_art function
This commit is contained in:
+14
-6
@@ -30,8 +30,19 @@ pub async fn run_sync(settings: &Settings) -> Result<(), Box<dyn Error>> {
|
|||||||
let duration = start_time.elapsed();
|
let duration = start_time.elapsed();
|
||||||
println!("Finished synchronizing games in: {:?}", duration);
|
println!("Finished synchronizing games in: {:?}", duration);
|
||||||
if settings.steamgrid_db.enabled {
|
if settings.steamgrid_db.enabled {
|
||||||
|
find_art(settings, user, &shortcut_info.shortcuts).await?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn find_art(
|
||||||
|
settings: &Settings,
|
||||||
|
user: &crate::steam::SteamUsersInfo,
|
||||||
|
shortcut_info: &Vec<ShortcutOwned>,
|
||||||
|
) -> Result<(), Box<dyn Error>> {
|
||||||
let auth_key = &settings.steamgrid_db.auth_key;
|
let auth_key = &settings.steamgrid_db.auth_key;
|
||||||
if let Some(auth_key) = auth_key {
|
Ok(if let Some(auth_key) = auth_key {
|
||||||
let start_time = std::time::Instant::now();
|
let start_time = std::time::Instant::now();
|
||||||
println!("Checking for game images");
|
println!("Checking for game images");
|
||||||
let client = steamgriddb_api::Client::new(auth_key);
|
let client = steamgriddb_api::Client::new(auth_key);
|
||||||
@@ -40,7 +51,7 @@ pub async fn run_sync(settings: &Settings) -> Result<(), Box<dyn Error>> {
|
|||||||
download_images(
|
download_images(
|
||||||
known_images,
|
known_images,
|
||||||
user.steam_user_data_folder.as_str(),
|
user.steam_user_data_folder.as_str(),
|
||||||
&shortcut_info.shortcuts,
|
shortcut_info,
|
||||||
&mut search,
|
&mut search,
|
||||||
&client,
|
&client,
|
||||||
)
|
)
|
||||||
@@ -50,10 +61,7 @@ pub async fn run_sync(settings: &Settings) -> Result<(), Box<dyn Error>> {
|
|||||||
println!("Finished getting images in: {:?}", duration);
|
println!("Finished getting images in: {:?}", duration);
|
||||||
} else {
|
} else {
|
||||||
println!("Steamgrid DB Auth Key not found, please add one as described here: https://github.com/PhilipK/steam_shortcuts_sync#configuration");
|
println!("Steamgrid DB Auth Key not found, please add one as described here: https://github.com/PhilipK/steam_shortcuts_sync#configuration");
|
||||||
}
|
})
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update_platforms(settings: &Settings, new_user_shortcuts: &mut Vec<ShortcutOwned>) {
|
fn update_platforms(settings: &Settings, new_user_shortcuts: &mut Vec<ShortcutOwned>) {
|
||||||
|
|||||||
Reference in New Issue
Block a user