This commit is contained in:
Quaternions 2024-08-16 18:45:28 -07:00
parent 90a92447b6
commit 05c3e411f6

View File

@ -704,7 +704,7 @@ async fn create_asset_medias(config:CreateAssetMediasConfig)->AResult<()>{
let context=CloudContext::new(config.api_key); let context=CloudContext::new(config.api_key);
let cookie_context=CookieContext::new(config.cookie); let cookie_context=CookieContext::new(config.cookie);
let expected_price=Some(config.expected_price.unwrap_or(0)); let expected_price=Some(config.expected_price.unwrap_or(0));
futures::stream::iter(config.input_files.into_iter() let asset_id_list=futures::stream::iter(config.input_files.into_iter()
//step 1: read file, make create request //step 1: read file, make create request
.map(|path|{ .map(|path|{
let description=&config.description; let description=&config.description;
@ -772,18 +772,21 @@ async fn create_asset_medias(config:CreateAssetMediasConfig)->AResult<()>{
*dom.root().children().first().ok_or(DownloadDecalError::NoFirstInstance)? *dom.root().children().first().ok_or(DownloadDecalError::NoFirstInstance)?
).ok_or(DownloadDecalError::NoFirstInstance)?; ).ok_or(DownloadDecalError::NoFirstInstance)?;
match instance.properties.get("Texture").ok_or(DownloadDecalError::NoTextureProperty)?{ match instance.properties.get("Texture").ok_or(DownloadDecalError::NoTextureProperty)?{
rbx_dom_weak::types::Variant::String(s)=>Ok(s.clone()), rbx_dom_weak::types::Variant::Content(url)=>Ok(url.clone().into_string()),
_=>Err(DownloadDecalError::TexturePropertyInvalid), _=>Err(DownloadDecalError::TexturePropertyInvalid),
} }
}.await{ }.await{
Ok(yeah)=>Some(yeah), Ok(asset_url)=>Some((asset_response.displayName,asset_url)),
Err(e)=>{ Err(e)=>{
eprintln!("get_asset error: {}",e); eprintln!("get_asset error: {}",e);
None None
}, },
} }
} }
}); }).collect::<Vec<(String,String)>>().await;
for (file_name,asset_url) in asset_id_list{
println!("{}={}",file_name,asset_url);
}
Ok(()) Ok(())
} }