summaryrefslogtreecommitdiff
path: root/src/playlist.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/playlist.rs')
-rw-r--r--src/playlist.rs166
1 files changed, 166 insertions, 0 deletions
diff --git a/src/playlist.rs b/src/playlist.rs
new file mode 100644
index 0000000..b918282
--- /dev/null
+++ b/src/playlist.rs
@@ -0,0 +1,166 @@
+//! Playlist.
+use serde::Deserialize;
+
+use crate::creator::Creator;
+
+/// A playlist.
+#[derive(Debug, Deserialize)]
+pub struct Playlist
+{
+ /// The playlist's Deezer id.
+ pub id: u64,
+
+ /// The playlist's title.
+ pub title: String,
+
+ /// The playlist description.
+ pub description: String,
+
+ /// The playlist's duration (seconds).
+ pub duration: u64,
+
+ /// If the playlist is public or not.
+ pub public: bool,
+
+ /// If the playlist is the love tracks playlist.
+ pub is_loved_track: bool,
+
+ /// If the playlist is collaborative or not.
+ pub collaborative: bool,
+
+ /// Nb tracks in the playlist.
+ pub nb_tracks: u64,
+
+ /// Nb tracks not seen.
+ pub unseen_track_count: Option<u64>,
+
+ /// The number of playlist's fans.
+ pub fans: u64,
+
+ /// The url of the playlist on Deezer.
+ pub link: String,
+
+ /// The share link of the playlist on Deezer.
+ pub share: String,
+
+ /// The url of the playlist's cover. Add 'size' parameter to the url to change size.
+ /// Can be 'small', 'medium', 'big', 'xl'.
+ pub picture: String,
+
+ /// The url of the playlist's cover in size small.
+ pub picture_small: String,
+
+ /// The url of the playlist's cover in size medium.
+ pub picture_medium: String,
+
+ /// The url of the playlist's cover in size big.
+ pub picture_big: String,
+
+ /// The url of the playlist's cover in size xl.
+ pub picture_xl: String,
+
+ /// The checksum for the track list.
+ pub checksum: String,
+
+ /// The creator of the playlist.
+ pub creator: Creator,
+
+ /// List of tracks.
+ pub tracks: PlaylistTracks,
+}
+
+/// A track in a playlist.
+#[derive(Debug, Deserialize)]
+pub struct PlaylistTrack
+{
+ /// The track's Deezer id
+ pub id: u64,
+
+ /// true if the track is readable in the player for the current user
+ pub readable: bool,
+
+ /// The track's fulltitle
+ pub title: String,
+
+ /// The track's short title
+ pub title_short: String,
+
+ /// The track version
+ pub title_version: String,
+
+ /// The track unseen status
+ pub unseen: Option<bool>,
+
+ /// The url of the track on Deezer
+ pub link: String,
+
+ /// The track's duration in seconds
+ pub duration: u64,
+
+ /// The track's Deezer rank
+ pub rank: u64,
+
+ /// Whether the track contains explicit lyrics
+ pub explicit_lyrics: bool,
+
+ /// The url of track's preview file. This file contains the first 30 seconds of the
+ /// track
+ pub preview: String,
+
+ /// The time when the track has been added to the playlist
+ pub time_add: u64,
+
+ /// The track's artist.
+ pub artist: PlaylistTrackArtist,
+
+ /// The track's album.
+ pub album: PlaylistTrackAlbum,
+}
+
+/// The artist of a playlist track.
+#[derive(Debug, Deserialize)]
+pub struct PlaylistTrackArtist
+{
+ /// Artist id.
+ pub id: u64,
+
+ /// Artist name.
+ pub name: String,
+
+ /// Artist url.
+ pub link: String,
+}
+
+/// The album of a playlist track.
+#[derive(Debug, Deserialize)]
+pub struct PlaylistTrackAlbum
+{
+ /// Album id.
+ pub id: u64,
+
+ /// Album title.
+ pub title: String,
+
+ /// Album cover.
+ pub cover: String,
+
+ /// Album cover in size small.
+ pub cover_small: String,
+
+ /// Album cover in size medium.
+ pub cover_medium: String,
+
+ /// Album cover in size big.
+ pub cover_big: String,
+
+ /// Album cover in side xl.
+ pub cover_xl: String,
+}
+
+/// Tracks in a playlist.
+#[derive(Debug, Deserialize)]
+pub struct PlaylistTracks
+{
+ /// Tracks.
+ pub data: Vec<PlaylistTrack>,
+}