Compare commits
8 Commits
main
...
3c8c2aff0d
| Author | SHA1 | Date | |
|---|---|---|---|
|
3c8c2aff0d
|
|||
|
be18ba8254
|
|||
|
6d2de0a21a
|
|||
|
b0394c54bb
|
|||
|
259b4ace2d
|
|||
|
e59ba4486d
|
|||
|
af2b53cd5a
|
|||
|
74c4172772
|
6
Cargo.lock
generated
6
Cargo.lock
generated
@@ -520,8 +520,8 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "icarus_models"
|
name = "icarus_models"
|
||||||
version = "0.9.2"
|
version = "0.8.3"
|
||||||
source = "git+ssh://git@git.kundeng.us/phoenix/icarus_models.git?tag=v0.9.2#05525618514409101c1d6474dafb201386d14a30"
|
source = "git+ssh://git@git.kundeng.us/phoenix/icarus_models.git?tag=v0.8.3#0a27b8ccb1ac40361df8d3131f567f37f06cdc08"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"josekit",
|
"josekit",
|
||||||
"rand",
|
"rand",
|
||||||
@@ -1322,7 +1322,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "songparser"
|
name = "songparser"
|
||||||
version = "0.4.12"
|
version = "0.4.10"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"futures",
|
"futures",
|
||||||
"icarus_envy",
|
"icarus_envy",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "songparser"
|
name = "songparser"
|
||||||
version = "0.4.12"
|
version = "0.4.10"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
rust-version = "1.90"
|
rust-version = "1.90"
|
||||||
|
|
||||||
@@ -14,5 +14,5 @@ time = { version = "0.3.44", features = ["macros", "serde"] }
|
|||||||
uuid = { version = "1.18.1", features = ["v4", "serde"] }
|
uuid = { version = "1.18.1", features = ["v4", "serde"] }
|
||||||
rand = { version = "0.9.2" }
|
rand = { version = "0.9.2" }
|
||||||
icarus_meta = { git = "ssh://git@git.kundeng.us/phoenix/icarus_meta.git", tag = "v0.4.3" }
|
icarus_meta = { git = "ssh://git@git.kundeng.us/phoenix/icarus_meta.git", tag = "v0.4.3" }
|
||||||
icarus_models = { git = "ssh://git@git.kundeng.us/phoenix/icarus_models.git", tag = "v0.9.2" }
|
icarus_models = { git = "ssh://git@git.kundeng.us/phoenix/icarus_models.git", tag = "v0.8.3" }
|
||||||
icarus_envy = { git = "ssh://git@git.kundeng.us/phoenix/icarus_envy.git", tag = "v0.5.0" }
|
icarus_envy = { git = "ssh://git@git.kundeng.us/phoenix/icarus_envy.git", tag = "v0.5.0" }
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
pub mod fetch_next_queue_item {
|
pub mod fetch_next_queue_item {
|
||||||
|
|
||||||
pub async fn fetch_next_queue_item(
|
pub async fn fetch_next_queue_item(
|
||||||
app: &crate::config::App,
|
app: &crate::config::App,
|
||||||
) -> Result<reqwest::Response, reqwest::Error> {
|
) -> Result<reqwest::Response, reqwest::Error> {
|
||||||
@@ -11,7 +12,9 @@ pub mod fetch_next_queue_item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub mod response {
|
pub mod response {
|
||||||
#[derive(Debug, serde::Deserialize, serde::Serialize)]
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct QueueItem {
|
pub struct QueueItem {
|
||||||
pub id: uuid::Uuid,
|
pub id: uuid::Uuid,
|
||||||
pub filename: String,
|
pub filename: String,
|
||||||
@@ -19,7 +22,7 @@ pub mod fetch_next_queue_item {
|
|||||||
pub user_id: uuid::Uuid,
|
pub user_id: uuid::Uuid,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, serde::Deserialize, serde::Serialize)]
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct SongQueueItem {
|
pub struct SongQueueItem {
|
||||||
pub message: String,
|
pub message: String,
|
||||||
pub data: Vec<QueueItem>,
|
pub data: Vec<QueueItem>,
|
||||||
|
|||||||
@@ -39,6 +39,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
|
println!("Token: {:?}", app.token);
|
||||||
|
|
||||||
if app.token.token_expired() {
|
if app.token.token_expired() {
|
||||||
println!("Token expired");
|
println!("Token expired");
|
||||||
app.token = match auth::get_refresh_token(&app).await {
|
app.token = match auth::get_refresh_token(&app).await {
|
||||||
|
|||||||
@@ -107,10 +107,9 @@ pub async fn prep_song(
|
|||||||
let song = icarus_models::song::Song {
|
let song = icarus_models::song::Song {
|
||||||
directory: icarus_envy::environment::get_root_directory().await.value,
|
directory: icarus_envy::environment::get_root_directory().await.value,
|
||||||
filename: icarus_models::song::generate_filename(
|
filename: icarus_models::song::generate_filename(
|
||||||
icarus_models::types::MusicType::FlacExtension,
|
icarus_models::types::MusicTypes::FlacExtension,
|
||||||
true,
|
true,
|
||||||
)
|
),
|
||||||
.unwrap(),
|
|
||||||
data: song_bytes,
|
data: song_bytes,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
@@ -197,10 +196,6 @@ pub async fn process_coverart(
|
|||||||
"Saved coverart queue file at: {:?}",
|
"Saved coverart queue file at: {:?}",
|
||||||
queued_coverart.path
|
queued_coverart.path
|
||||||
);
|
);
|
||||||
println!(
|
|
||||||
"Queued CoverArt file type: {:?}",
|
|
||||||
queued_coverart.coverart.file_type
|
|
||||||
);
|
|
||||||
|
|
||||||
Ok(queued_coverart)
|
Ok(queued_coverart)
|
||||||
}
|
}
|
||||||
@@ -223,35 +218,29 @@ async fn init_queued_coverart(
|
|||||||
bytes: Vec<u8>,
|
bytes: Vec<u8>,
|
||||||
) -> crate::queued_item::QueuedCoverArt {
|
) -> crate::queued_item::QueuedCoverArt {
|
||||||
// TODO: Consider separating song and coverart when saving to the filesystem
|
// TODO: Consider separating song and coverart when saving to the filesystem
|
||||||
let covart_type = if file_type == icarus_meta::detection::coverart::constants::PNG_TYPE {
|
let covart_type = if file_type == "png" {
|
||||||
icarus_models::types::CoverArtType::PngExtension
|
icarus_models::types::CoverArtTypes::PngExtension
|
||||||
} else if file_type == icarus_meta::detection::coverart::constants::JPEG_TYPE {
|
} else if file_type == "jpeg" {
|
||||||
icarus_models::types::CoverArtType::JpegExtension
|
icarus_models::types::CoverArtTypes::JpegExtension
|
||||||
} else if file_type == icarus_meta::detection::coverart::constants::JPG_TYPE {
|
|
||||||
icarus_models::types::CoverArtType::JpgExtension
|
|
||||||
} else {
|
} else {
|
||||||
icarus_models::types::CoverArtType::None
|
// TODO: This doesn't seem right
|
||||||
|
icarus_models::types::CoverArtTypes::JpgExtension
|
||||||
};
|
};
|
||||||
let coverart = icarus_models::coverart::CoverArt {
|
let coverart = icarus_models::coverart::CoverArt {
|
||||||
directory: icarus_envy::environment::get_root_directory().await.value,
|
directory: icarus_envy::environment::get_root_directory().await.value,
|
||||||
filename: match icarus_models::coverart::generate_filename(covart_type, true) {
|
filename: icarus_models::coverart::generate_filename(covart_type, true),
|
||||||
Ok(filename) => filename,
|
|
||||||
Err(err) => {
|
|
||||||
eprintln!("Error generating CoverArt filename: {err:?}");
|
|
||||||
panic!("Error initializing queued CoverArt");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
file_type: String::from(file_type),
|
|
||||||
data: bytes,
|
data: bytes,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
coverart.save_to_filesystem().unwrap();
|
coverart.save_to_filesystem().unwrap();
|
||||||
let coverart_queue_fs_path = coverart.get_path().unwrap();
|
let coverart_queue_fs_path = coverart.get_path().unwrap();
|
||||||
crate::queued_item::QueuedCoverArt {
|
let queued_coverart = crate::queued_item::QueuedCoverArt {
|
||||||
id: *coverart_queue_id,
|
id: *coverart_queue_id,
|
||||||
coverart,
|
coverart,
|
||||||
path: coverart_queue_fs_path,
|
path: coverart_queue_fs_path,
|
||||||
}
|
};
|
||||||
|
|
||||||
|
queued_coverart
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn cleanup(
|
pub async fn cleanup(
|
||||||
|
|||||||
Reference in New Issue
Block a user