mirror of
https://github.com/djibux/BoilR.git
synced 2026-09-01 14:03:42 +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::{
|
||||
collections::HashMap,
|
||||
env::{self},
|
||||
@@ -7,7 +8,6 @@ use std::{
|
||||
ops::Deref,
|
||||
path::Path,
|
||||
};
|
||||
mod cached_search;
|
||||
mod egs;
|
||||
mod legendary;
|
||||
mod platform;
|
||||
@@ -28,8 +28,6 @@ use steam_shortcuts_util::{
|
||||
};
|
||||
use steamgriddb_api::{search::SearchResult, Client};
|
||||
|
||||
use crate::cached_search::CachedSearch;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn Error>> {
|
||||
let settings = Settings::new()?;
|
||||
@@ -146,22 +144,6 @@ fn save_shortcuts(shortcuts: &Vec<Shortcut>, path: &Path) {
|
||||
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>)
|
||||
where
|
||||
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 image_type;
|
||||
mod cached_search;
|
||||
|
||||
pub use image_type::ImageType;
|
||||
pub use settings::SteamGridDbSettings;
|
||||
pub use cached_search::CachedSearch;
|
||||
Reference in New Issue
Block a user