mirror of
https://github.com/djibux/BoilR.git
synced 2026-09-01 05:53:41 +02:00
Refactor cached search into steamgriddb mod
This commit is contained in:
+1
-19
@@ -1,3 +1,4 @@
|
|||||||
|
use crate::steamgriddb::{CachedSearch, ImageType};
|
||||||
use std::{
|
use std::{
|
||||||
collections::HashMap,
|
collections::HashMap,
|
||||||
env::{self},
|
env::{self},
|
||||||
@@ -7,7 +8,6 @@ use std::{
|
|||||||
ops::Deref,
|
ops::Deref,
|
||||||
path::Path,
|
path::Path,
|
||||||
};
|
};
|
||||||
mod cached_search;
|
|
||||||
mod egs;
|
mod egs;
|
||||||
mod legendary;
|
mod legendary;
|
||||||
mod platform;
|
mod platform;
|
||||||
@@ -28,8 +28,6 @@ use steam_shortcuts_util::{
|
|||||||
};
|
};
|
||||||
use steamgriddb_api::{search::SearchResult, Client};
|
use steamgriddb_api::{search::SearchResult, Client};
|
||||||
|
|
||||||
use crate::cached_search::CachedSearch;
|
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> Result<(), Box<dyn Error>> {
|
async fn main() -> Result<(), Box<dyn Error>> {
|
||||||
let settings = Settings::new()?;
|
let settings = Settings::new()?;
|
||||||
@@ -146,22 +144,6 @@ fn save_shortcuts(shortcuts: &Vec<Shortcut>, path: &Path) {
|
|||||||
file.write(new_content.as_slice()).unwrap();
|
file.write(new_content.as_slice()).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub enum ImageType {
|
|
||||||
Hero,
|
|
||||||
Grid,
|
|
||||||
Logo,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ImageType {
|
|
||||||
pub fn file_name(&self, app_id: u32) -> String {
|
|
||||||
match self {
|
|
||||||
ImageType::Hero => format!("{}_hero.png", app_id),
|
|
||||||
ImageType::Grid => format!("{}p.png", app_id),
|
|
||||||
ImageType::Logo => format!("{}_logo.png", app_id),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn update_platform_shortcuts<P, T, E>(platform: &P, current_shortcuts: &mut Vec<ShortcutOwned>)
|
fn update_platform_shortcuts<P, T, E>(platform: &P, current_shortcuts: &mut Vec<ShortcutOwned>)
|
||||||
where
|
where
|
||||||
P: Platform<T, E>,
|
P: Platform<T, E>,
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
pub enum ImageType {
|
||||||
|
Hero,
|
||||||
|
Grid,
|
||||||
|
Logo,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ImageType {
|
||||||
|
pub fn file_name(&self, app_id: u32) -> String {
|
||||||
|
match self {
|
||||||
|
ImageType::Hero => format!("{}_hero.png", app_id),
|
||||||
|
ImageType::Grid => format!("{}p.png", app_id),
|
||||||
|
ImageType::Logo => format!("{}_logo.png", app_id),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,2 +1,7 @@
|
|||||||
mod settings;
|
mod settings;
|
||||||
|
mod image_type;
|
||||||
|
mod cached_search;
|
||||||
|
|
||||||
|
pub use image_type::ImageType;
|
||||||
pub use settings::SteamGridDbSettings;
|
pub use settings::SteamGridDbSettings;
|
||||||
|
pub use cached_search::CachedSearch;
|
||||||
Reference in New Issue
Block a user