From 455ece80ea9c153a150b511fa691d0cad89a3d75 Mon Sep 17 00:00:00 2001 From: phoenix Date: Sat, 22 Mar 2025 19:41:18 -0400 Subject: [PATCH] Removed song module --- src/models/mod.rs | 1 - src/models/song.rs | 99 ---------------------------------------------- 2 files changed, 100 deletions(-) delete mode 100644 src/models/song.rs diff --git a/src/models/mod.rs b/src/models/mod.rs index c9c4e79..32db87d 100644 --- a/src/models/mod.rs +++ b/src/models/mod.rs @@ -1,5 +1,4 @@ pub mod api; pub mod flags; pub mod icarus_action; -// pub mod song; pub mod upload_form; diff --git a/src/models/song.rs b/src/models/song.rs deleted file mode 100644 index 1ab04dd..0000000 --- a/src/models/song.rs +++ /dev/null @@ -1,99 +0,0 @@ -use std::default::Default; -use std::io::Read; - -use serde::{Deserialize, Serialize}; - -/* -#[derive(Debug, Deserialize, Serialize)] -pub struct Album { - #[serde(alias = "album")] - pub title: String, - pub album_artist: String, - pub genre: String, - pub year: i32, - pub track_count: i32, - pub disc_count: i32, - #[serde(alias = "tracks")] - pub songs: Vec, -} - -impl Default for Album { - fn default() -> Self { - Album { - title: String::new(), - album_artist: String::new(), - genre: String::new(), - year: 0, - track_count: 0, - disc_count: 0, - songs: Vec::new(), - } - } -} -*/ - -/* - - // if 1 - wav, if 0 - mp3, anything else defaults to wav - pub fn _generate_filename_from_track(&mut self, i_type: i32) -> i32 { - let mut filename: String = String::new(); - if self.track.unwrap() < 10 { - filename += "0"; - } - - filename += &self.track.unwrap().to_string(); - - if i_type == 0 { - filename += icarus_models::constants::MPTHREE_EXTENSION; - } else { - filename += icarus_models::constants::WAV_EXTENSION; - } - - self.filename = Some(filename); - - return 0; - } - - pub fn _to_metadata_json(&self) -> Result { - return serde_json::to_string_pretty(&self); - } -} -*/ - -#[derive(Debug, Deserialize, Serialize)] -pub struct CoverArt { - pub id: Option, - pub title: Option, - pub path: Option, - pub data: Option>, -} - -impl Default for CoverArt { - fn default() -> Self { - CoverArt { - id: None, - title: None, - path: None, - data: None, - } - } -} - -impl CoverArt { - pub fn to_data(&self) -> Result, std::io::Error> { - let mut path: String = String::new(); - match &self.path { - Some(val) => { - path = String::from(val); - } - None => { - (); - } - } - - let mut file = std::fs::File::open(path)?; - let mut buffer = Vec::new(); - file.read_to_end(&mut buffer)?; - Ok(buffer) - } -}