Added function to make coverart init easier
Some checks failed
Rust Build / Check (pull_request) Successful in 29s
Rust Build / Test Suite (pull_request) Successful in 34s
Rust Build / Rustfmt (pull_request) Successful in 28s
Rust Build / Clippy (pull_request) Failing after 28s
Rust Build / build (pull_request) Successful in 33s

This commit is contained in:
2025-04-03 22:01:45 -04:00
parent 61ad88a258
commit f772cc8f19
2 changed files with 28 additions and 0 deletions

View File

@@ -10,6 +10,32 @@ pub struct CoverArt {
pub data: Vec<u8>,
}
pub mod init {
use crate::coverart::CoverArt;
pub fn init_coverart_only_path(path: &String) -> CoverArt {
CoverArt {
id: uuid::Uuid::new_v4(),
title: String::new(),
path: path.clone(),
data: Vec::new(),
}
}
}
#[cfg(test)]
mod tests {
use crate::coverart;
#[test]
fn test_cover_art_image() {
let path: String = String::from("somepath");
let coverart = coverart::init::init_coverart_only_path(&path);
assert_eq!(path, coverart.path);
}
}
impl CoverArt {
pub fn to_data(&self) -> Result<Vec<u8>, std::io::Error> {
let path: &String = &self.path;

View File

@@ -28,6 +28,7 @@ mod utils {
}
}
#[cfg(test)]
mod song_tests {
use std::fs::File;
use std::io::Write;
@@ -151,6 +152,7 @@ mod song_tests {
}
}
#[cfg(test)]
mod album_tests {
use crate::utils;