Added file extension constant and updated constants module (#17)
All checks were successful
Rust Build / Check (push) Successful in 22s
Rust Build / Test Suite (push) Successful in 27s
Rust Build / Rustfmt (push) Successful in 23s
Rust Build / Clippy (push) Successful in 24s
Rust Build / build (push) Successful in 25s
Rust Build / Check (pull_request) Successful in 26s
Rust Build / Test Suite (pull_request) Successful in 28s
Rust Build / Rustfmt (pull_request) Successful in 26s
Rust Build / Clippy (pull_request) Successful in 29s
Rust Build / build (pull_request) Successful in 30s
Release Tagging / release (push) Successful in 29s

Reviewed-on: phoenix/icarus-models#17
Co-authored-by: KD <kundeng94@gmail.com>
Co-committed-by: KD <kundeng94@gmail.com>
This commit is contained in:
KD
2025-03-29 22:37:02 +00:00
committed by phoenix
parent bf5808a06a
commit 56384fb371
2 changed files with 24 additions and 9 deletions

View File

@@ -1,5 +1,14 @@
pub mod file_extensions {
pub mod audio {
pub const DEFAULTMUSICEXTENSION: &str = FLACEXTENSION; pub const DEFAULTMUSICEXTENSION: &str = FLACEXTENSION;
pub const FLACEXTENSION: &str = ".flac"; pub const FLACEXTENSION: &str = ".flac";
pub const WAVEXTENSION: &str = ".wav"; pub const WAVEXTENSION: &str = ".wav";
pub const MPTHREEEXTENSION: &str = ".mp3"; pub const MPTHREEEXTENSION: &str = ".mp3";
}
pub mod image {
pub const JPGEXTENSION: &str = ".jpg"; pub const JPGEXTENSION: &str = ".jpg";
pub const JPEGEXTENSION: &str = ".jpeg";
pub const PNGEXTENSION: &str = ".png";
}
}

View File

@@ -128,12 +128,18 @@ impl Song {
let file_extension = match typ { let file_extension = match typ {
types::MusicTypes::DefaultMusicExtension => { types::MusicTypes::DefaultMusicExtension => {
String::from(constants::DEFAULTMUSICEXTENSION) String::from(constants::file_extensions::audio::DEFAULTMUSICEXTENSION)
} }
types::MusicTypes::WavExtension => String::from(constants::WAVEXTENSION), types::MusicTypes::WavExtension => {
types::MusicTypes::FlacExtension => String::from(constants::FLACEXTENSION), String::from(constants::file_extensions::audio::WAVEXTENSION)
types::MusicTypes::MPThreeExtension => String::from(constants::MPTHREEEXTENSION), }
types::MusicTypes::FlacExtension => {
String::from(constants::file_extensions::audio::FLACEXTENSION)
}
types::MusicTypes::MPThreeExtension => {
String::from(constants::file_extensions::audio::MPTHREEEXTENSION)
}
}; };
if randomize { if randomize {