mirror of
https://github.com/djibux/BoilR.git
synced 2026-09-01 14:03:42 +02:00
Disallow indexing (#320)
* Remove indexing * Introduce replace_with_dosdevices * Remove all direct indexing
This commit is contained in:
@@ -19,8 +19,8 @@ impl<'a> CachedSearch<'a> {
|
||||
}
|
||||
|
||||
pub fn save(&self) {
|
||||
if let Err(err) = save_search_map(&self.search_map){
|
||||
eprintln!("Failed saving searchmap : {:?}",err);
|
||||
if let Err(err) = save_search_map(&self.search_map) {
|
||||
eprintln!("Failed saving searchmap : {:?}", err);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,14 +46,14 @@ impl<'a> CachedSearch<'a> {
|
||||
}
|
||||
println!("Searching for {}", query.as_ref());
|
||||
let search = self.client.search(query.as_ref()).await?;
|
||||
if search.is_empty() {
|
||||
return Ok(None);
|
||||
let first_id = search.get(0).map(|f| f.id);
|
||||
match first_id {
|
||||
Some(assumed_id) => {
|
||||
self.search_map.insert(app_id, (query.into(), assumed_id));
|
||||
Ok(Some(assumed_id))
|
||||
}
|
||||
None => Ok(None),
|
||||
}
|
||||
let first_item = &search[0];
|
||||
let assumed_id = first_item.id;
|
||||
self.search_map.insert(app_id, (query.into(), assumed_id));
|
||||
|
||||
Ok(Some(assumed_id))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,9 +62,7 @@ fn get_search_map() -> SearchMap {
|
||||
if path.exists() {
|
||||
std::fs::read_to_string(path)
|
||||
.ok()
|
||||
.and_then(|string| {
|
||||
serde_json::from_str::<SearchMap>(&string).ok()
|
||||
})
|
||||
.and_then(|string| serde_json::from_str::<SearchMap>(&string).ok())
|
||||
.unwrap_or_default()
|
||||
} else {
|
||||
SearchMap::new()
|
||||
|
||||
@@ -242,10 +242,15 @@ async fn search_for_images_to_download<T: SearchSettings>(
|
||||
.await;
|
||||
match image_search_result {
|
||||
Ok(images) => {
|
||||
let images = images
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(index, image)| (image, shortcuts[index], image_ids[index]));
|
||||
let images = images.iter().enumerate().filter_map(|(index, image)| {
|
||||
if let (Some(shortcut), Some(image_id)) =
|
||||
(shortcuts.get(index), image_ids.get(index))
|
||||
{
|
||||
Some((image, shortcut, image_id))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
});
|
||||
let download_for_this_type = stream::iter(images)
|
||||
.filter_map(|(image, shortcut, game_id)| {
|
||||
let extension = image
|
||||
@@ -257,7 +262,7 @@ async fn search_for_images_to_download<T: SearchSettings>(
|
||||
async move {
|
||||
let image_url = match image {
|
||||
Ok(img) => Some(img.url.clone()),
|
||||
Err(_) => get_steam_image_url(game_id, &image_type).await,
|
||||
Err(_) => get_steam_image_url(*game_id, &image_type).await,
|
||||
};
|
||||
image_url.map(|url| ToDownload {
|
||||
path,
|
||||
|
||||
Reference in New Issue
Block a user