code changes
Some checks failed
Rust Build / Check (pull_request) Failing after 35s
Rust Build / Test Suite (pull_request) Failing after 35s
Rust Build / Rustfmt (pull_request) Failing after 29s
Rust Build / Clippy (pull_request) Failing after 34s
Rust Build / build (pull_request) Failing after 35s
Some checks failed
Rust Build / Check (pull_request) Failing after 35s
Rust Build / Test Suite (pull_request) Failing after 35s
Rust Build / Rustfmt (pull_request) Failing after 29s
Rust Build / Clippy (pull_request) Failing after 34s
Rust Build / build (pull_request) Failing after 35s
This commit is contained in:
36
src/main.rs
36
src/main.rs
@@ -346,7 +346,29 @@ async fn prep_song(
|
|||||||
match api::parsing::parse_response_into_bytes(response).await {
|
match api::parsing::parse_response_into_bytes(response).await {
|
||||||
Ok(song_bytes) => {
|
Ok(song_bytes) => {
|
||||||
let (directory, filename) = generate_song_queue_dir_and_filename().await;
|
let (directory, filename) = generate_song_queue_dir_and_filename().await;
|
||||||
let song_queue_path = save_file_to_fs(&directory, &filename, &song_bytes).await;
|
let song = icarus_models::song::Song {
|
||||||
|
directory: directory,
|
||||||
|
filename: filename,
|
||||||
|
data: song_bytes,
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
let songpath = match song.song_path() {
|
||||||
|
Ok(songpath) => {
|
||||||
|
songpath
|
||||||
|
}
|
||||||
|
Err(_err) => {
|
||||||
|
String::new()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let song_queue_path = match song.save_to_filesystem() {
|
||||||
|
Ok(_) => {
|
||||||
|
std::path::Path::new(&songpath)
|
||||||
|
}
|
||||||
|
Err(_err) => {
|
||||||
|
std::path::Path::new("")
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
println!("Saved at: {song_queue_path:?}");
|
println!("Saved at: {song_queue_path:?}");
|
||||||
|
|
||||||
@@ -376,8 +398,14 @@ async fn prep_song(
|
|||||||
Ok(response) => match api::parsing::parse_response_into_bytes(response).await {
|
Ok(response) => match api::parsing::parse_response_into_bytes(response).await {
|
||||||
Ok(coverart_queue_bytes) => {
|
Ok(coverart_queue_bytes) => {
|
||||||
let (directory, filename) = generate_coverart_queue_dir_and_filename().await;
|
let (directory, filename) = generate_coverart_queue_dir_and_filename().await;
|
||||||
let coverart_queue_path = save_file_to_fs(&directory, &filename, &coverart_queue_bytes).await;
|
let coverart = icarus_models::coverart::CoverArt {
|
||||||
|
path: directory + "/" + &filename,
|
||||||
|
data: coverart_queue_bytes,
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
// let coverart_queue_path = save_file_to_fs(&directory, &filename, &coverart_queue_bytes).await;
|
||||||
|
coverart.save_to_filesystem().unwrap();
|
||||||
|
let coverart_queue_path = std::path::Path::new(&coverart.path);
|
||||||
println!("Saved coverart queue file at: {coverart_queue_path:?}");
|
println!("Saved coverart queue file at: {coverart_queue_path:?}");
|
||||||
|
|
||||||
let c_path = util::path_buf_to_string(&coverart_queue_path);
|
let c_path = util::path_buf_to_string(&coverart_queue_path);
|
||||||
@@ -454,7 +482,7 @@ pub async fn generate_coverart_queue_dir_and_filename() -> (String, String) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Check to see if this is available in icarus_models
|
// TODO: Check to see if this is available in icarus_models
|
||||||
pub async fn save_file_to_fs(
|
async fn save_file_to_fs(
|
||||||
directory: &String,
|
directory: &String,
|
||||||
filename: &String,
|
filename: &String,
|
||||||
data: &[u8],
|
data: &[u8],
|
||||||
|
Reference in New Issue
Block a user