Skip to main content

qobuz_api/models/
track.rs

1//! Track data model.
2
3use {
4    serde::{Deserialize, Serialize},
5    serde_json::Value,
6};
7
8use crate::models::{album::Album, artist::Artist};
9
10/// Audio technical details.
11#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
12pub struct AudioInfo {
13    /// Bit depth.
14    pub bit_depth: Option<i32>,
15    /// Sample rate in kHz.
16    pub sampling_rate: Option<f64>,
17    /// Channel count.
18    pub channels: Option<i32>,
19    /// Audio codec.
20    pub codec: Option<String>,
21}
22
23/// An individual music track.
24#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
25pub struct Track {
26    /// Unique track identifier.
27    pub id: Option<i32>,
28    /// Track title.
29    pub title: Option<String>,
30    /// Version subtitle.
31    pub version: Option<String>,
32    /// ISRC code.
33    pub isrc: Option<String>,
34    /// Track position in album.
35    pub track_number: Option<i32>,
36    /// Duration in seconds.
37    pub duration: Option<i32>,
38    /// Disc number.
39    pub media_number: Option<i32>,
40    /// Classical work title.
41    pub work: Option<String>,
42    /// Parent album.
43    pub album: Option<Box<Album>>,
44    /// Primary performer.
45    pub performer: Option<Box<Artist>>,
46    /// All performers (formatted string).
47    pub performers: Option<String>,
48    /// Primary composer.
49    pub composer: Option<Box<Artist>>,
50    /// Audio technical details.
51    pub audio_info: Option<AudioInfo>,
52    /// Copyright notice.
53    pub copyright: Option<String>,
54    /// Streaming available.
55    pub streamable: Option<bool>,
56    /// Download available.
57    pub downloadable: Option<bool>,
58    /// Hi-Res available.
59    pub hires: Option<bool>,
60    /// Max bit depth.
61    pub maximum_bit_depth: Option<i32>,
62    /// Max sample rate.
63    pub maximum_sampling_rate: Option<f64>,
64    /// Max channel count.
65    pub maximum_channel_count: Option<i32>,
66    /// Original release date.
67    pub release_date_original: Option<String>,
68    /// Streaming date.
69    pub release_date_stream: Option<String>,
70    /// Explicit content flag.
71    pub parental_warning: Option<bool>,
72    /// Sales metadata.
73    pub product_sales_factors: Option<Value>,
74}