Compare commits
8 Commits
main
...
c14d3e5a51
Author | SHA1 | Date | |
---|---|---|---|
c14d3e5a51
|
|||
8e2eb8a1b1
|
|||
d652d8588d
|
|||
08b441a2ee
|
|||
bde67b5014
|
|||
ccf6ee08b4
|
|||
b3bd009460
|
|||
cea522d6b8
|
10
src/lib.rs
10
src/lib.rs
@@ -56,11 +56,13 @@ pub mod test_util {
|
||||
pub fn get_filename(track: i32) -> String {
|
||||
const FLAC_EXTENSION: &str = ".flac";
|
||||
|
||||
if track < 10 {
|
||||
format!("track0{track}{FLAC_EXTENSION}")
|
||||
let filename = if track < 10 {
|
||||
format!("track0{}{}", track, FLAC_EXTENSION)
|
||||
} else {
|
||||
format!("track{track}{FLAC_EXTENSION}")
|
||||
}
|
||||
format!("track{}{}", track, FLAC_EXTENSION)
|
||||
};
|
||||
|
||||
filename
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -275,6 +275,9 @@ pub mod metadata {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
// use super::*;
|
||||
|
||||
mod get {
|
||||
use super::super::metadata::get_meta;
|
||||
use crate::test_util::util;
|
||||
|
@@ -1,5 +1,10 @@
|
||||
use lofty::file::AudioFile;
|
||||
|
||||
#[derive(Debug, Default, Clone)]
|
||||
pub struct Duration {
|
||||
pub val: i32,
|
||||
}
|
||||
|
||||
pub fn get_duration(song_path: &String) -> Result<std::time::Duration, std::io::Error> {
|
||||
match std::fs::File::open(song_path) {
|
||||
Ok(mut content) => {
|
||||
|
@@ -32,6 +32,11 @@ impl MetadataType {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Properties {
|
||||
Duration,
|
||||
}
|
||||
|
||||
pub fn all_metadata_types() -> Vec<Type> {
|
||||
vec![
|
||||
Type::Album,
|
||||
|
Reference in New Issue
Block a user