Cleanup
This commit is contained in:
+16
-14
@@ -1496,7 +1496,6 @@ pub mod endpoint {
|
|||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
Ok(coverart) => {
|
Ok(coverart) => {
|
||||||
// let coverart_path = std::path::Path::new(&coverart.path);
|
|
||||||
let coverart_path_str = match coverart.get_path() {
|
let coverart_path_str = match coverart.get_path() {
|
||||||
Ok(path) => path,
|
Ok(path) => path,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
@@ -1510,8 +1509,6 @@ pub mod endpoint {
|
|||||||
let coverart_path = std::path::Path::new(&coverart_path_str);
|
let coverart_path = std::path::Path::new(&coverart_path_str);
|
||||||
|
|
||||||
if coverart_path.exists() {
|
if coverart_path.exists() {
|
||||||
match song.song_path() {
|
|
||||||
Ok(song_path) => {
|
|
||||||
match super::song_db::delete_song(&pool, &song.id).await {
|
match super::song_db::delete_song(&pool, &song.id).await {
|
||||||
Ok(deleted_song) => {
|
Ok(deleted_song) => {
|
||||||
match super::super::coverart::cov_db::delete_coverart(
|
match super::super::coverart::cov_db::delete_coverart(
|
||||||
@@ -1521,12 +1518,12 @@ pub mod endpoint {
|
|||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
Ok(deleted_coverart) => {
|
Ok(deleted_coverart) => {
|
||||||
match std::fs::remove_file(song_path) {
|
match song.remove_from_filesystem() {
|
||||||
Ok(_) => match std::fs::remove_file(
|
Ok(_) => match coverart.remove_from_filesystem() {
|
||||||
coverart_path,
|
|
||||||
) {
|
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
response.message = String::from(super::super::response::SUCCESSFUL);
|
response.message = String::from(
|
||||||
|
super::super::response::SUCCESSFUL,
|
||||||
|
);
|
||||||
response.data.push(super::response::delete_song::SongAndCoverArt{ song: deleted_song, coverart: deleted_coverart });
|
response.data.push(super::response::delete_song::SongAndCoverArt{ song: deleted_song, coverart: deleted_coverart });
|
||||||
(
|
(
|
||||||
axum::http::StatusCode::OK,
|
axum::http::StatusCode::OK,
|
||||||
@@ -1545,12 +1542,6 @@ pub mod endpoint {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Err(err) => {
|
|
||||||
response.message = err.to_string();
|
|
||||||
(axum::http::StatusCode::INTERNAL_SERVER_ERROR, axum::Json(response))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
response.message = err.to_string();
|
response.message = err.to_string();
|
||||||
(
|
(
|
||||||
@@ -1568,6 +1559,17 @@ pub mod endpoint {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// }
|
||||||
|
/*
|
||||||
|
Err(err) => {
|
||||||
|
response.message = err.to_string();
|
||||||
|
(
|
||||||
|
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
|
axum::Json(response),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
// }
|
||||||
} else {
|
} else {
|
||||||
response.message =
|
response.message =
|
||||||
String::from("Could not locate coverart on the filesystem");
|
String::from("Could not locate coverart on the filesystem");
|
||||||
|
|||||||
Reference in New Issue
Block a user