Compare commits
5 Commits
v0.4.1
...
60069d9e14
Author | SHA1 | Date | |
---|---|---|---|
60069d9e14
|
|||
d4e7aba4a8
|
|||
e247870e4d
|
|||
038f8dbd9a
|
|||
ea6f65a206
|
4
Cargo.lock
generated
4
Cargo.lock
generated
@@ -533,8 +533,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "icarus_models"
|
||||
version = "0.5.6"
|
||||
source = "git+ssh://git@git.kundeng.us/phoenix/icarus_models.git?tag=v0.5.6#2d6b550ae6721b41ecc3039799f6a5e873869077"
|
||||
version = "0.6.6"
|
||||
source = "git+ssh://git@git.kundeng.us/phoenix/icarus_models.git?tag=v0.6.6-65-eac7562b80-111#eac7562b80b9f82d21ab737d1e84ba4f12e472dd"
|
||||
dependencies = [
|
||||
"josekit",
|
||||
"rand",
|
||||
|
@@ -14,5 +14,5 @@ time = { version = "0.3.41", features = ["macros", "serde"] }
|
||||
uuid = { version = "1.17.0", features = ["v4", "serde"] }
|
||||
rand = { version = "0.9.1" }
|
||||
icarus_meta = { git = "ssh://git@git.kundeng.us/phoenix/icarus_meta.git", tag = "v0.3.0" }
|
||||
icarus_models = { git = "ssh://git@git.kundeng.us/phoenix/icarus_models.git", tag = "v0.5.6" }
|
||||
icarus_models = { git = "ssh://git@git.kundeng.us/phoenix/icarus_models.git", tag = "v0.6.6-65-eac7562b80-111" }
|
||||
icarus_envy = { git = "ssh://git@git.kundeng.us/phoenix/icarus_envy.git", tag = "v0.4.1-main-8f0d123db5-006" }
|
||||
|
38
src/main.rs
38
src/main.rs
@@ -346,7 +346,29 @@ async fn prep_song(
|
||||
match api::parsing::parse_response_into_bytes(response).await {
|
||||
Ok(song_bytes) => {
|
||||
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:?}");
|
||||
|
||||
@@ -376,8 +398,14 @@ async fn prep_song(
|
||||
Ok(response) => match api::parsing::parse_response_into_bytes(response).await {
|
||||
Ok(coverart_queue_bytes) => {
|
||||
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:?}");
|
||||
|
||||
let c_path = util::path_buf_to_string(&coverart_queue_path);
|
||||
@@ -417,7 +445,7 @@ async fn prep_song(
|
||||
// TODO: Consider having something like this in icarus_models
|
||||
pub async fn generate_song_queue_dir_and_filename() -> (String, String) {
|
||||
let mut song = icarus_models::song::Song::default();
|
||||
song.filename = song.generate_filename(icarus_models::types::MusicTypes::FlacExtension, true);
|
||||
song.filename = icarus_models::song::generate_filename(icarus_models::types::MusicTypes::FlacExtension, true);
|
||||
|
||||
song.directory = icarus_envy::environment::get_root_directory().await.value;
|
||||
|
||||
@@ -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
|
||||
pub async fn save_file_to_fs(
|
||||
async fn save_file_to_fs(
|
||||
directory: &String,
|
||||
filename: &String,
|
||||
data: &[u8],
|
||||
|
Reference in New Issue
Block a user