Coverart save to filesystem (#67)
All checks were successful
Release Tagging / release (pull_request) Successful in 36s
Rust Build / Check (pull_request) Successful in 41s
Rust Build / Test Suite (pull_request) Successful in 43s
Rust Build / Rustfmt (pull_request) Successful in 32s
Rust Build / Clippy (pull_request) Successful in 2m12s
Rust Build / build (pull_request) Successful in 2m18s

Reviewed-on: #67
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
This commit is contained in:
2025-10-11 20:30:39 +00:00
committed by phoenix
parent 440caca7c2
commit e3ca2c5781
4 changed files with 16 additions and 4 deletions

2
Cargo.lock generated
View File

@@ -142,7 +142,7 @@ checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5"
[[package]] [[package]]
name = "icarus_models" name = "icarus_models"
version = "0.6.4" version = "0.6.5"
dependencies = [ dependencies = [
"josekit", "josekit",
"rand", "rand",

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "icarus_models" name = "icarus_models"
version = "0.6.4" version = "0.6.5"
edition = "2024" edition = "2024"
rust-version = "1.88" rust-version = "1.88"
description = "models used for the icarus project" description = "models used for the icarus project"

View File

@@ -1,3 +1,5 @@
use std::io::Write;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Default, Deserialize, Serialize, utoipa::ToSchema)] #[derive(Clone, Debug, Default, Deserialize, Serialize, utoipa::ToSchema)]
@@ -26,7 +28,17 @@ pub mod init {
} }
impl CoverArt { impl CoverArt {
// TODO: Add method to save to filesystem /// Saves the coverart to the filesystem
pub fn save_to_filesystem(&self) -> Result<(), std::io::Error> {
match std::fs::File::create(&self.path) {
Ok(mut file) => match file.write_all(&self.data) {
Ok(_) => Ok(()),
Err(err) => Err(err),
},
Err(err) => Err(err),
}
}
// TODO: Add method to remove from filesystem // TODO: Add method to remove from filesystem
} }

View File

@@ -113,7 +113,7 @@ impl Song {
Ok(song_path) => { Ok(song_path) => {
let p = std::path::Path::new(&song_path); let p = std::path::Path::new(&song_path);
if p.exists() { if p.exists() {
match std::fs::remove_file(&p) { match std::fs::remove_file(p) {
Ok(_) => Ok(()), Ok(_) => Ok(()),
Err(err) => Err(err), Err(err) => Err(err),
} }