diff --git a/src/constants.rs b/src/constants.rs index 51dd5ea..4a982b1 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -1,5 +1,14 @@ -pub const DEFAULTMUSICEXTENSION: &str = FLACEXTENSION; -pub const FLACEXTENSION: &str = ".flac"; -pub const WAVEXTENSION: &str = ".wav"; -pub const MPTHREEEXTENSION: &str = ".mp3"; -pub const JPGEXTENSION: &str = ".jpg"; +pub mod file_extensions { + pub mod audio { + pub const DEFAULTMUSICEXTENSION: &str = FLACEXTENSION; + pub const FLACEXTENSION: &str = ".flac"; + 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"; + } +} diff --git a/src/song.rs b/src/song.rs index 4d319dc..3f0d15f 100644 --- a/src/song.rs +++ b/src/song.rs @@ -128,12 +128,18 @@ impl Song { let file_extension = match typ { types::MusicTypes::DefaultMusicExtension => { - String::from(constants::DEFAULTMUSICEXTENSION) + String::from(constants::file_extensions::audio::DEFAULTMUSICEXTENSION) } - types::MusicTypes::WavExtension => String::from(constants::WAVEXTENSION), - types::MusicTypes::FlacExtension => String::from(constants::FLACEXTENSION), - types::MusicTypes::MPThreeExtension => String::from(constants::MPTHREEEXTENSION), + types::MusicTypes::WavExtension => { + String::from(constants::file_extensions::audio::WAVEXTENSION) + } + types::MusicTypes::FlacExtension => { + String::from(constants::file_extensions::audio::FLACEXTENSION) + } + types::MusicTypes::MPThreeExtension => { + String::from(constants::file_extensions::audio::MPTHREEEXTENSION) + } }; if randomize {