Added Album collection
This commit is contained in:
31
src/album.rs
Normal file
31
src/album.rs
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
pub mod collection {
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
fn is_set(num: &i32) -> bool {
|
||||||
|
*num >= 0
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
|
pub struct Album {
|
||||||
|
#[serde(skip_serializing_if = "String::is_empty")]
|
||||||
|
#[serde(alias = "album")]
|
||||||
|
pub title: String,
|
||||||
|
pub genre: String,
|
||||||
|
pub year: i32,
|
||||||
|
pub track_count: i32,
|
||||||
|
#[serde(skip_serializing_if = "is_set")]
|
||||||
|
pub disc_count: i32,
|
||||||
|
#[serde(skip_serializing_if = "Vec::is_empty")]
|
||||||
|
pub tracks: Vec<Track>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
|
pub struct Track {
|
||||||
|
pub title: String,
|
||||||
|
pub artist: String,
|
||||||
|
pub disc: i32,
|
||||||
|
pub track: i32,
|
||||||
|
// In seconds
|
||||||
|
pub duration: f64,
|
||||||
|
}
|
||||||
|
}
|
@@ -1,4 +1,5 @@
|
|||||||
pub mod access_level;
|
pub mod access_level;
|
||||||
|
pub mod album;
|
||||||
pub mod constants;
|
pub mod constants;
|
||||||
pub mod login_result;
|
pub mod login_result;
|
||||||
pub mod song;
|
pub mod song;
|
||||||
|
Reference in New Issue
Block a user