From 80fbd42e16ca2f0f6cc6e5f8d6f7822610be0f8c Mon Sep 17 00:00:00 2001 From: KD Date: Sat, 29 Mar 2025 09:57:46 -0400 Subject: [PATCH 1/3] Added file extension constant and updated constants module --- src/constants.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/constants.rs b/src/constants.rs index 51dd5ea..74dc979 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -1,5 +1,15 @@ + +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"; + } +} -- 2.43.0 From d68c2f44c06b71a4c0baee39a635aaed79c690e8 Mon Sep 17 00:00:00 2001 From: KD Date: Sat, 29 Mar 2025 09:58:41 -0400 Subject: [PATCH 2/3] Code formatting --- src/constants.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/constants.rs b/src/constants.rs index 74dc979..4a982b1 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -1,15 +1,14 @@ - 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 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"; + pub const JPGEXTENSION: &str = ".jpg"; + pub const JPEGEXTENSION: &str = ".jpeg"; + pub const PNGEXTENSION: &str = ".png"; } } -- 2.43.0 From fb6cb7954318ba7577f8a98895be066e5818bcbe Mon Sep 17 00:00:00 2001 From: KD Date: Sat, 29 Mar 2025 10:03:04 -0400 Subject: [PATCH 3/3] Updated file extension constants --- src/song.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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 { -- 2.43.0