tsk-79: Create function to generate CoverArt filename #80

Merged
phoenix merged 3 commits from tsk-79 into main 2025-10-24 16:19:39 +00:00
2 changed files with 1 additions and 4 deletions
Showing only changes of commit 2be2680447 - Show all commits

View File

@@ -3,7 +3,6 @@ use std::io::Write;
use rand::Rng; use rand::Rng;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
const FILENAME_LENGTH: i32 = 16; const FILENAME_LENGTH: i32 = 16;
#[derive(Clone, Debug, Default, Deserialize, Serialize, utoipa::ToSchema)] #[derive(Clone, Debug, Default, Deserialize, Serialize, utoipa::ToSchema)]

View File

@@ -129,14 +129,12 @@ impl Song {
} }
} }
/// Generates a filename. In order to save a song to the filesystem, the song must have /// Generates a filename. In order to save a song to the filesystem
/// a directory and filename
pub fn generate_filename(typ: types::MusicTypes, randomize: bool) -> String { pub fn generate_filename(typ: types::MusicTypes, randomize: bool) -> String {
let file_extension = match typ { let file_extension = match typ {
types::MusicTypes::DefaultMusicExtension => { types::MusicTypes::DefaultMusicExtension => {
String::from(constants::file_extensions::audio::DEFAULTMUSICEXTENSION) String::from(constants::file_extensions::audio::DEFAULTMUSICEXTENSION)
} }
types::MusicTypes::WavExtension => { types::MusicTypes::WavExtension => {
String::from(constants::file_extensions::audio::WAVEXTENSION) String::from(constants::file_extensions::audio::WAVEXTENSION)
} }