icarus_models -> simodels
Rust CI / Rustfmt (pull_request) Successful in 2m51s
Rust CI / Check (pull_request) Successful in 3m42s
Rust CI / Test Suite (pull_request) Successful in 4m53s
Rust CI / build (pull_request) Successful in 4m11s
Rust CI / Clippy (pull_request) Successful in 4m54s
Rust CI / Rustfmt (pull_request) Successful in 2m51s
Rust CI / Check (pull_request) Successful in 3m42s
Rust CI / Test Suite (pull_request) Successful in 4m53s
Rust CI / build (pull_request) Successful in 4m11s
Rust CI / Clippy (pull_request) Successful in 4m54s
This commit is contained in:
+14
-17
@@ -20,7 +20,7 @@ pub mod response {
|
||||
#[derive(Debug, Default, serde::Deserialize, serde::Serialize, utoipa::ToSchema)]
|
||||
pub struct Response {
|
||||
pub message: String,
|
||||
pub data: Vec<icarus_models::coverart::CoverArt>,
|
||||
pub data: Vec<simodels::coverart::CoverArt>,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ pub mod response {
|
||||
#[derive(Debug, Default, serde::Deserialize, serde::Serialize, utoipa::ToSchema)]
|
||||
pub struct Response {
|
||||
pub message: String,
|
||||
pub data: Vec<icarus_models::coverart::CoverArt>,
|
||||
pub data: Vec<simodels::coverart::CoverArt>,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -74,15 +74,15 @@ pub mod endpoint {
|
||||
let coverart_type = if file_type.file_type
|
||||
== icarus_meta::detection::coverart::constants::JPEG_TYPE
|
||||
{
|
||||
icarus_models::types::CoverArtType::JpegExtension
|
||||
simodels::types::CoverArtType::JpegExtension
|
||||
} else if file_type.file_type
|
||||
== icarus_meta::detection::coverart::constants::JPG_TYPE
|
||||
{
|
||||
icarus_models::types::CoverArtType::JpgExtension
|
||||
simodels::types::CoverArtType::JpgExtension
|
||||
} else if file_type.file_type
|
||||
== icarus_meta::detection::coverart::constants::PNG_TYPE
|
||||
{
|
||||
icarus_models::types::CoverArtType::PngExtension
|
||||
simodels::types::CoverArtType::PngExtension
|
||||
} else {
|
||||
response.message = String::from("Invalid CoverArt type");
|
||||
return (
|
||||
@@ -91,13 +91,11 @@ pub mod endpoint {
|
||||
);
|
||||
};
|
||||
let filename =
|
||||
icarus_models::coverart::generate_filename(coverart_type, true)
|
||||
.unwrap();
|
||||
simodels::coverart::generate_filename(coverart_type, true).unwrap();
|
||||
|
||||
let mut coverart =
|
||||
icarus_models::coverart::init::init_coverart_dir_and_filename(
|
||||
&directory, &filename,
|
||||
);
|
||||
let mut coverart = simodels::coverart::init::init_coverart_dir_and_filename(
|
||||
&directory, &filename,
|
||||
);
|
||||
coverart.title = song.album.clone();
|
||||
coverart.file_type = file_type.file_type;
|
||||
coverart.data = data;
|
||||
@@ -200,7 +198,7 @@ pub mod endpoint {
|
||||
axum::extract::Path(id): axum::extract::Path<uuid::Uuid>,
|
||||
) -> (axum::http::StatusCode, axum::response::Response) {
|
||||
match repo::coverart::get_coverart(&pool, &id).await {
|
||||
Ok(coverart) => match icarus_models::coverart::io::to_data(&coverart) {
|
||||
Ok(coverart) => match simodels::coverart::io::to_data(&coverart) {
|
||||
Ok(data) => {
|
||||
let (file_type, img_type) =
|
||||
match icarus_meta::detection::coverart::file_type_from_data(&data) {
|
||||
@@ -208,15 +206,15 @@ pub mod endpoint {
|
||||
if file_type.file_type
|
||||
== icarus_meta::detection::coverart::constants::JPEG_TYPE
|
||||
{
|
||||
(file_type, icarus_models::types::CoverArtType::JpegExtension)
|
||||
(file_type, simodels::types::CoverArtType::JpegExtension)
|
||||
} else if file_type.file_type
|
||||
== icarus_meta::detection::coverart::constants::JPG_TYPE
|
||||
{
|
||||
(file_type, icarus_models::types::CoverArtType::JpgExtension)
|
||||
(file_type, simodels::types::CoverArtType::JpgExtension)
|
||||
} else if file_type.file_type
|
||||
== icarus_meta::detection::coverart::constants::PNG_TYPE
|
||||
{
|
||||
(file_type, icarus_models::types::CoverArtType::PngExtension)
|
||||
(file_type, simodels::types::CoverArtType::PngExtension)
|
||||
} else {
|
||||
return (
|
||||
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
|
||||
@@ -235,8 +233,7 @@ pub mod endpoint {
|
||||
let bytes = axum::body::Bytes::from(data);
|
||||
let mut response = bytes.into_response();
|
||||
let headers = response.headers_mut();
|
||||
let filename =
|
||||
icarus_models::coverart::generate_filename(img_type, true).unwrap();
|
||||
let filename = simodels::coverart::generate_filename(img_type, true).unwrap();
|
||||
headers.insert(
|
||||
axum::http::header::CONTENT_TYPE,
|
||||
file_type.mime.parse().unwrap(),
|
||||
|
||||
@@ -331,23 +331,22 @@ pub mod endpoint {
|
||||
let coverart_type = if file_type.file_type
|
||||
== icarus_meta::detection::coverart::constants::JPEG_TYPE
|
||||
{
|
||||
icarus_models::types::CoverArtType::JpegExtension
|
||||
simodels::types::CoverArtType::JpegExtension
|
||||
} else if file_type.file_type
|
||||
== icarus_meta::detection::coverart::constants::JPG_TYPE
|
||||
{
|
||||
icarus_models::types::CoverArtType::JpgExtension
|
||||
simodels::types::CoverArtType::JpgExtension
|
||||
} else if file_type.file_type
|
||||
== icarus_meta::detection::coverart::constants::PNG_TYPE
|
||||
{
|
||||
icarus_models::types::CoverArtType::PngExtension
|
||||
simodels::types::CoverArtType::PngExtension
|
||||
} else {
|
||||
return (
|
||||
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
|
||||
axum::response::Response::default(),
|
||||
);
|
||||
};
|
||||
let filename =
|
||||
icarus_models::coverart::generate_filename(coverart_type, true).unwrap();
|
||||
let filename = simodels::coverart::generate_filename(coverart_type, true).unwrap();
|
||||
headers.insert(
|
||||
axum::http::header::CONTENT_DISPOSITION,
|
||||
format!("attachment; filename=\"{filename}\"")
|
||||
|
||||
+10
-12
@@ -36,8 +36,8 @@ pub mod request {
|
||||
|| !self.song_queue_id.is_nil()
|
||||
}
|
||||
|
||||
pub fn to_song(&self) -> icarus_models::song::Song {
|
||||
icarus_models::song::Song {
|
||||
pub fn to_song(&self) -> simodels::song::Song {
|
||||
simodels::song::Song {
|
||||
id: uuid::Uuid::nil(),
|
||||
title: self.title.clone(),
|
||||
artist: self.artist.clone(),
|
||||
@@ -71,7 +71,7 @@ pub mod response {
|
||||
#[derive(Debug, Default, serde::Deserialize, serde::Serialize, utoipa::ToSchema)]
|
||||
pub struct Response {
|
||||
pub message: String,
|
||||
pub data: Vec<icarus_models::song::Song>,
|
||||
pub data: Vec<simodels::song::Song>,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,15 +79,15 @@ pub mod response {
|
||||
#[derive(Debug, Default, serde::Deserialize, serde::Serialize, utoipa::ToSchema)]
|
||||
pub struct Response {
|
||||
pub message: String,
|
||||
pub data: Vec<icarus_models::song::Song>,
|
||||
pub data: Vec<simodels::song::Song>,
|
||||
}
|
||||
}
|
||||
|
||||
pub mod delete_song {
|
||||
#[derive(Debug, Default, serde::Deserialize, serde::Serialize, utoipa::ToSchema)]
|
||||
pub struct SongAndCoverArt {
|
||||
pub song: icarus_models::song::Song,
|
||||
pub coverart: icarus_models::coverart::CoverArt,
|
||||
pub song: simodels::song::Song,
|
||||
pub coverart: simodels::coverart::CoverArt,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, serde::Deserialize, serde::Serialize, utoipa::ToSchema)]
|
||||
@@ -134,11 +134,9 @@ pub mod endpoint {
|
||||
|
||||
if payload.is_valid() {
|
||||
let mut song = payload.to_song();
|
||||
song.filename = icarus_models::song::generate_filename(
|
||||
icarus_models::types::MusicType::FlacExtension,
|
||||
true,
|
||||
)
|
||||
.unwrap();
|
||||
song.filename =
|
||||
simodels::song::generate_filename(simodels::types::MusicType::FlacExtension, true)
|
||||
.unwrap();
|
||||
song.directory = sienvy::environment::get_root_directory().value;
|
||||
|
||||
match repo_queue::song::get_data(&pool, &payload.song_queue_id).await {
|
||||
@@ -340,7 +338,7 @@ pub mod endpoint {
|
||||
axum::extract::Path(id): axum::extract::Path<uuid::Uuid>,
|
||||
) -> (axum::http::StatusCode, axum::response::Response) {
|
||||
match repo::song::get_song(&pool, &id).await {
|
||||
Ok(song) => match icarus_models::song::io::to_data(&song) {
|
||||
Ok(song) => match simodels::song::io::to_data(&song) {
|
||||
Ok(data) => {
|
||||
let bytes = axum::body::Bytes::from(data);
|
||||
let mut response = bytes.into_response();
|
||||
|
||||
Reference in New Issue
Block a user