Compare commits
1 Commits
main
...
9096d02e79
| Author | SHA1 | Date | |
|---|---|---|---|
|
9096d02e79
|
4
Cargo.lock
generated
4
Cargo.lock
generated
@@ -521,7 +521,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "icarus_models"
|
||||
version = "0.9.2"
|
||||
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.9.2-91-d121dbb06f-111#d121dbb06fd2605e8789b37245f2e1af083edd00"
|
||||
dependencies = [
|
||||
"josekit",
|
||||
"rand",
|
||||
@@ -1322,7 +1322,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "songparser"
|
||||
version = "0.4.12"
|
||||
version = "0.4.10"
|
||||
dependencies = [
|
||||
"futures",
|
||||
"icarus_envy",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "songparser"
|
||||
version = "0.4.12"
|
||||
version = "0.4.10"
|
||||
edition = "2024"
|
||||
rust-version = "1.90"
|
||||
|
||||
@@ -14,5 +14,5 @@ time = { version = "0.3.44", features = ["macros", "serde"] }
|
||||
uuid = { version = "1.18.1", features = ["v4", "serde"] }
|
||||
rand = { version = "0.9.2" }
|
||||
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.9.2-91-d121dbb06f-111" }
|
||||
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 async fn fetch_next_queue_item(
|
||||
app: &crate::config::App,
|
||||
) -> Result<reqwest::Response, reqwest::Error> {
|
||||
@@ -11,7 +12,9 @@ pub mod fetch_next_queue_item {
|
||||
}
|
||||
|
||||
pub mod response {
|
||||
#[derive(Debug, serde::Deserialize, serde::Serialize)]
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct QueueItem {
|
||||
pub id: uuid::Uuid,
|
||||
pub filename: String,
|
||||
@@ -19,7 +22,7 @@ pub mod fetch_next_queue_item {
|
||||
pub user_id: uuid::Uuid,
|
||||
}
|
||||
|
||||
#[derive(Debug, serde::Deserialize, serde::Serialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct SongQueueItem {
|
||||
pub message: String,
|
||||
pub data: Vec<QueueItem>,
|
||||
|
||||
@@ -39,6 +39,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
};
|
||||
|
||||
loop {
|
||||
println!("Token: {:?}", app.token);
|
||||
|
||||
if app.token.token_expired() {
|
||||
println!("Token expired");
|
||||
app.token = match auth::get_refresh_token(&app).await {
|
||||
|
||||
@@ -107,10 +107,9 @@ pub async fn prep_song(
|
||||
let song = icarus_models::song::Song {
|
||||
directory: icarus_envy::environment::get_root_directory().await.value,
|
||||
filename: icarus_models::song::generate_filename(
|
||||
icarus_models::types::MusicType::FlacExtension,
|
||||
icarus_models::types::MusicTypes::FlacExtension,
|
||||
true,
|
||||
)
|
||||
.unwrap(),
|
||||
),
|
||||
data: song_bytes,
|
||||
..Default::default()
|
||||
};
|
||||
@@ -197,10 +196,6 @@ pub async fn process_coverart(
|
||||
"Saved coverart queue file at: {:?}",
|
||||
queued_coverart.path
|
||||
);
|
||||
println!(
|
||||
"Queued CoverArt file type: {:?}",
|
||||
queued_coverart.coverart.file_type
|
||||
);
|
||||
|
||||
Ok(queued_coverart)
|
||||
}
|
||||
@@ -223,25 +218,17 @@ async fn init_queued_coverart(
|
||||
bytes: Vec<u8>,
|
||||
) -> crate::queued_item::QueuedCoverArt {
|
||||
// TODO: Consider separating song and coverart when saving to the filesystem
|
||||
let covart_type = if file_type == icarus_meta::detection::coverart::constants::PNG_TYPE {
|
||||
icarus_models::types::CoverArtType::PngExtension
|
||||
} else if file_type == icarus_meta::detection::coverart::constants::JPEG_TYPE {
|
||||
icarus_models::types::CoverArtType::JpegExtension
|
||||
} else if file_type == icarus_meta::detection::coverart::constants::JPG_TYPE {
|
||||
icarus_models::types::CoverArtType::JpgExtension
|
||||
let covart_type = if file_type == "png" {
|
||||
icarus_models::types::CoverArtTypes::PngExtension
|
||||
} else if file_type == "jpeg" {
|
||||
icarus_models::types::CoverArtTypes::JpegExtension
|
||||
} else {
|
||||
icarus_models::types::CoverArtType::None
|
||||
// TODO: This doesn't seem right
|
||||
icarus_models::types::CoverArtTypes::JpgExtension
|
||||
};
|
||||
let coverart = icarus_models::coverart::CoverArt {
|
||||
directory: icarus_envy::environment::get_root_directory().await.value,
|
||||
filename: match 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),
|
||||
filename: icarus_models::coverart::generate_filename(covart_type, true),
|
||||
data: bytes,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user