more debugging
This commit is contained in:
parent
820c61143e
commit
38c0a6dba1
1 changed files with 47 additions and 8 deletions
|
|
@ -426,23 +426,39 @@ pub async fn change_mii(
|
||||||
pub async fn generate_mii_images(client: Arc<Client>, bucket: &str, pid: i32, mii_data: &str) {
|
pub async fn generate_mii_images(client: Arc<Client>, bucket: &str, pid: i32, mii_data: &str) {
|
||||||
let user_mii_key = format!("mii/{}", pid);
|
let user_mii_key = format!("mii/{}", pid);
|
||||||
|
|
||||||
|
println!("Starting Mii image generation for PID {}", pid);
|
||||||
|
|
||||||
// Upload normal face images
|
// Upload normal face images
|
||||||
if let Some(png_data) = get_image_png(mii_data).await {
|
if let Some(png_data) = get_image_png(mii_data).await {
|
||||||
|
println!("Fetched PNG for PID {}, uploading...", pid);
|
||||||
let object_content = ObjectContent::from(png_data.clone());
|
let object_content = ObjectContent::from(png_data.clone());
|
||||||
let _ = client.put_object_content(
|
if client.put_object_content(
|
||||||
bucket,
|
bucket,
|
||||||
&format!("{}/normal_face.png", user_mii_key),
|
&format!("{}/normal_face.png", user_mii_key),
|
||||||
object_content
|
object_content
|
||||||
).send().await.ok();
|
).send().await.is_ok() {
|
||||||
|
println!("Uploaded normal_face.png for PID {}", pid);
|
||||||
|
} else {
|
||||||
|
println!("Failed to upload normal_face.png for PID {}", pid);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
println!("Failed to fetch PNG for PID {}", pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(tga_data) = get_image_tga(mii_data).await {
|
if let Some(tga_data) = get_image_tga(mii_data).await {
|
||||||
|
println!("Fetched TGA for PID {}, uploading...", pid);
|
||||||
let object_content = ObjectContent::from(tga_data.clone());
|
let object_content = ObjectContent::from(tga_data.clone());
|
||||||
let _ = client.put_object_content(
|
if client.put_object_content(
|
||||||
bucket,
|
bucket,
|
||||||
&format!("{}/standard.tga", user_mii_key),
|
&format!("{}/standard.tga", user_mii_key),
|
||||||
object_content
|
object_content
|
||||||
).send().await.ok();
|
).send().await.is_ok() {
|
||||||
|
println!("Uploaded standard.tga for PID {}", pid);
|
||||||
|
} else {
|
||||||
|
println!("Failed to upload standard.tga for PID {}", pid);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
println!("Failed to fetch TGA for PID {}", pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Upload expressions
|
// Upload expressions
|
||||||
|
|
@ -456,30 +472,53 @@ pub async fn generate_mii_images(client: Arc<Client>, bucket: &str, pid: i32, mi
|
||||||
|
|
||||||
for expression in expressions.iter() {
|
for expression in expressions.iter() {
|
||||||
let url = format!("https://mii-unsecure.ariankordi.net/miis/image.png?data={}&expression={}&type=face&width=128&instance_count=1", mii_data, expression);
|
let url = format!("https://mii-unsecure.ariankordi.net/miis/image.png?data={}&expression={}&type=face&width=128&instance_count=1", mii_data, expression);
|
||||||
|
println!("Fetching expression '{}' for PID {}", expression, pid);
|
||||||
|
|
||||||
if let Ok(resp) = reqwest::get(&url).await {
|
if let Ok(resp) = reqwest::get(&url).await {
|
||||||
if let Ok(bytes) = resp.bytes().await {
|
if let Ok(bytes) = resp.bytes().await {
|
||||||
|
println!("Fetched expression '{}', uploading...", expression);
|
||||||
let object_content = ObjectContent::from(bytes.to_vec());
|
let object_content = ObjectContent::from(bytes.to_vec());
|
||||||
let _ = client.put_object_content(
|
if client.put_object_content(
|
||||||
bucket,
|
bucket,
|
||||||
&format!("{}/{}.png", user_mii_key, expression),
|
&format!("{}/{}.png", user_mii_key, expression),
|
||||||
object_content
|
object_content
|
||||||
).send().await.ok();
|
).send().await.is_ok() {
|
||||||
|
println!("Uploaded {}.png for PID {}", expression, pid);
|
||||||
|
} else {
|
||||||
|
println!("Failed to upload {}.png for PID {}", expression, pid);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
println!("Failed to read bytes for expression '{}' for PID {}", expression, pid);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
println!("Failed to fetch expression '{}' for PID {}", expression, pid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Upload body
|
// Upload body
|
||||||
let body_url = format!("https://mii-unsecure.ariankordi.net/miis/image.png?data={}&type=all_body&width=270&instance_count=1", mii_data);
|
let body_url = format!("https://mii-unsecure.ariankordi.net/miis/image.png?data={}&type=all_body&width=270&instance_count=1", mii_data);
|
||||||
|
println!("Fetching body image for PID {}", pid);
|
||||||
|
|
||||||
if let Ok(resp) = reqwest::get(&body_url).await {
|
if let Ok(resp) = reqwest::get(&body_url).await {
|
||||||
if let Ok(bytes) = resp.bytes().await {
|
if let Ok(bytes) = resp.bytes().await {
|
||||||
|
println!("Fetched body image, uploading...");
|
||||||
let object_content = ObjectContent::from(bytes.to_vec());
|
let object_content = ObjectContent::from(bytes.to_vec());
|
||||||
let _ = client.put_object_content(
|
if client.put_object_content(
|
||||||
bucket,
|
bucket,
|
||||||
&format!("{}/body.png", user_mii_key),
|
&format!("{}/body.png", user_mii_key),
|
||||||
object_content
|
object_content
|
||||||
).send().await.ok();
|
).send().await.is_ok() {
|
||||||
|
println!("Uploaded body.png for PID {}", pid);
|
||||||
|
} else {
|
||||||
|
println!("Failed to upload body.png for PID {}", pid);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
println!("Failed to read body image bytes for PID {}", pid);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
println!("Failed to fetch body image for PID {}", pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
println!("Finished Mii image generation for PID {}", pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue