1
Fork 0

schematic download

This commit is contained in:
Andy Killorin 2023-12-29 12:58:17 -06:00
parent c4e7ac9f8b
commit f9531a6961
Signed by: ank
GPG key ID: B6241CA3B552BCA4
2 changed files with 11 additions and 1 deletions

View file

@ -44,3 +44,4 @@ memoize = "0.4.2"
tracing-appender = "0.2.3" tracing-appender = "0.2.3"
ron = "0.8.1" ron = "0.8.1"
crossbeam = "0.8.3" crossbeam = "0.8.3"
reqwest = "0.11.23"

View file

@ -104,7 +104,16 @@ async fn omni_inner(state: SharedControl, req: GoogleOmniForm) -> anyhow::Result
let mut schedule = state.tasks.lock().await; let mut schedule = state.tasks.lock().await;
let position = { Vec3::new(req.x.parse()?,req.y.parse()?,req.z.parse()?) }; let position = { Vec3::new(req.x.parse()?,req.y.parse()?,req.z.parse()?) };
match req.operation { match req.operation {
GoogleOmniFormMode::Schematic => Err(anyhow!("unimplemented"))?, GoogleOmniFormMode::Schematic => {
let schematic = req.schematic.context("no schematic uploaded")?.get(0).context("zero schematics")?.to_owned();
let schematic = reqwest::get(format!("https://docs.google.com/uc?export=download&id={schematic}")).await?;
let schematic = rustmatica::Litematic::from_bytes(&schematic.bytes().await?)?;
info!("schematic \"{}\" downloaded", &schematic.name);
info!("{} blocks", schematic.total_blocks());
info!("{} regions", schematic.regions.len());
},
GoogleOmniFormMode::RemoveVein => { GoogleOmniFormMode::RemoveVein => {
let block = req.block.context("missing block name")?; let block = req.block.context("missing block name")?;
info!("new remove {block} command from the internet at {position}"); info!("new remove {block} command from the internet at {position}");