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
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:
@@ -1,5 +1,14 @@
|
|||||||
pub const DEFAULTMUSICEXTENSION: &str = FLACEXTENSION;
|
pub mod file_extensions {
|
||||||
pub const FLACEXTENSION: &str = ".flac";
|
pub mod audio {
|
||||||
pub const WAVEXTENSION: &str = ".wav";
|
pub const DEFAULTMUSICEXTENSION: &str = FLACEXTENSION;
|
||||||
pub const MPTHREEEXTENSION: &str = ".mp3";
|
pub const FLACEXTENSION: &str = ".flac";
|
||||||
pub const JPGEXTENSION: &str = ".jpg";
|
pub const WAVEXTENSION: &str = ".wav";
|
||||||
|
pub const MPTHREEEXTENSION: &str = ".mp3";
|
||||||
|
}
|
||||||
|
|
||||||
|
pub mod image {
|
||||||
|
pub const JPGEXTENSION: &str = ".jpg";
|
||||||
|
pub const JPEGEXTENSION: &str = ".jpeg";
|
||||||
|
pub const PNGEXTENSION: &str = ".png";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
14
src/song.rs
14
src/song.rs
@@ -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 {
|
||||||
|
Reference in New Issue
Block a user