tsk-44 #47

Merged
phoenix merged 15 commits from tsk-44 into main 2025-10-21 16:20:51 +00:00
3 changed files with 22 additions and 0 deletions
Showing only changes of commit 580d73eeb8 - Show all commits

20
src/detection/coverart.rs Normal file
View File

@@ -0,0 +1,20 @@
/// Gets the file type of a CoverArt given it's path
pub fn file_type(filepath: &str) -> Result<String, std::io::Error> {
match imghdr::from_file(filepath) {
Ok(Some(imghdr::Type::Jpeg)) => {
Ok(String::from("jpeg"))
}
Ok(Some(imghdr::Type::Png)) => {
Ok(String::from("png"))
}
Ok(None) => {
Err(std::io::Error::other("Image file not supported"))
}
Err(err) => {
Err(err)
}
_ => {
Err(std::io::Error::other("Image file not supported"))
}
}
}

1
src/detection/mod.rs Normal file
View File

@@ -0,0 +1 @@
pub mod coverart;

View File

@@ -1,3 +1,4 @@
pub mod detection;
pub mod meta; pub mod meta;
pub mod properties; pub mod properties;
pub mod types; pub mod types;