speed and stuff
This commit is contained in:
parent
f28aa893d8
commit
69a299495d
|
@ -20,12 +20,10 @@ pub async fn run(args: env::Args) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
for result in search_info.result {
|
for result in search_info.result {
|
||||||
let text;
|
let mut title = &result.title.english.unwrap_or_default();
|
||||||
if result.title.english != "" {
|
if title == "" {
|
||||||
text = result.title.english;
|
title = &result.title.japanese.as_ref().unwrap();
|
||||||
} else {
|
|
||||||
text = result.title.japanese;
|
|
||||||
}
|
}
|
||||||
println!("{}: {}", result.id, text);
|
println!("{}: {}", result.id, &title);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,11 +21,11 @@ pub async fn run(args: env::Args) {
|
||||||
handles.push(tokio::spawn(async move {
|
handles.push(tokio::spawn(async move {
|
||||||
let sauce_info = utils::get_sauce_info(cloned_client, sauce).await.unwrap();
|
let sauce_info = utils::get_sauce_info(cloned_client, sauce).await.unwrap();
|
||||||
let mut text = format!("Sauce: {}\nTitle: ", sauce_info.id);
|
let mut text = format!("Sauce: {}\nTitle: ", sauce_info.id);
|
||||||
let english_title = sauce_info.title.english;
|
let japanese_title = &sauce_info.title.japanese.unwrap_or_default();
|
||||||
let japanese_title = sauce_info.title.japanese;
|
let english_title = &sauce_info.title.english.unwrap_or_default();
|
||||||
if english_title != "" {
|
if english_title.as_str() != "" {
|
||||||
text.push_str(&english_title);
|
text.push_str(&english_title);
|
||||||
if japanese_title != "" {
|
if japanese_title.as_str() != "" {
|
||||||
text.push_str(&format!("\nJapanese Title: {}", &japanese_title));
|
text.push_str(&format!("\nJapanese Title: {}", &japanese_title));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -2,9 +2,9 @@ use serde::Deserialize;
|
||||||
|
|
||||||
#[derive(Deserialize, Debug)]
|
#[derive(Deserialize, Debug)]
|
||||||
pub struct GalleryTitleInfo {
|
pub struct GalleryTitleInfo {
|
||||||
pub english: String,
|
pub english: Option<String>,
|
||||||
pub japanese: String,
|
pub japanese: Option<String>,
|
||||||
pub pretty: String,
|
pub pretty: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Debug)]
|
#[derive(Deserialize, Debug)]
|
||||||
|
|
|
@ -13,11 +13,6 @@ fn fix_gallery(body: &mut serde_json::Value) -> Result<(), serde_json::Error> {
|
||||||
body["id"].as_str().unwrap().parse::<usize>().unwrap()
|
body["id"].as_str().unwrap().parse::<usize>().unwrap()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
for title in ["english", "japanese", "pretty"].iter() {
|
|
||||||
if body["title"][title].is_null() {
|
|
||||||
body["title"][title] = serde_json::json!("")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue