Code formatting and cleanup
This commit is contained in:
+10
-8
@@ -32,7 +32,7 @@ mod response {
|
|||||||
#[derive(Debug, serde::Deserialize)]
|
#[derive(Debug, serde::Deserialize)]
|
||||||
pub struct Response {
|
pub struct Response {
|
||||||
pub message: String,
|
pub message: String,
|
||||||
pub data: Vec<uuid::Uuid>
|
pub data: Vec<uuid::Uuid>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -210,17 +210,21 @@ impl Upload {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn queue_coverart(&self, token: &icarus_models::token::AccessToken, coverart: &icarus_models::coverart::CoverArt) -> Result<uuid::Uuid, reqwest::Error> {
|
pub async fn queue_coverart(
|
||||||
|
&self,
|
||||||
|
token: &icarus_models::token::AccessToken,
|
||||||
|
coverart: &icarus_models::coverart::CoverArt,
|
||||||
|
) -> Result<uuid::Uuid, reqwest::Error> {
|
||||||
let coverartpath = coverart.path.clone();
|
let coverartpath = coverart.path.clone();
|
||||||
let file = tokio::fs::File::open(&coverartpath).await.unwrap();
|
let file = tokio::fs::File::open(&coverartpath).await.unwrap();
|
||||||
let stream = tokio_util::codec::FramedRead::new(file, tokio_util::codec::BytesCodec::new());
|
let stream = tokio_util::codec::FramedRead::new(file, tokio_util::codec::BytesCodec::new());
|
||||||
let file_body = reqwest::Body::wrap_stream(stream);
|
let file_body = reqwest::Body::wrap_stream(stream);
|
||||||
|
|
||||||
let file_name = std::path::Path::new(&coverartpath)
|
let file_name = std::path::Path::new(&coverartpath)
|
||||||
.file_name()
|
.file_name()
|
||||||
.and_then(|name| name.to_str())
|
.and_then(|name| name.to_str())
|
||||||
.map(String::from)
|
.map(String::from)
|
||||||
.unwrap_or("file".to_string());
|
.unwrap_or("file".to_string());
|
||||||
|
|
||||||
let form = reqwest::multipart::Form::new().part(
|
let form = reqwest::multipart::Form::new().part(
|
||||||
"file",
|
"file",
|
||||||
@@ -262,8 +266,6 @@ impl Upload {
|
|||||||
},
|
},
|
||||||
Err(err) => Err(err),
|
Err(err) => Err(err),
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ok(uuid::Uuid::nil())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn init_form(
|
fn init_form(
|
||||||
|
|||||||
Reference in New Issue
Block a user