mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
add release date to AudioItem
- preparation for MPRIS support - now that the data is there, also yield from player_event_handler
This commit is contained in:
parent
949a886f62
commit
055e0d8f38
2 changed files with 9 additions and 0 deletions
|
@ -47,6 +47,7 @@ pub enum UniqueFields {
|
||||||
Track {
|
Track {
|
||||||
artists: ArtistsWithRole,
|
artists: ArtistsWithRole,
|
||||||
album: String,
|
album: String,
|
||||||
|
album_date: Date,
|
||||||
album_artists: Vec<String>,
|
album_artists: Vec<String>,
|
||||||
popularity: u8,
|
popularity: u8,
|
||||||
number: u32,
|
number: u32,
|
||||||
|
@ -83,6 +84,8 @@ impl AudioItem {
|
||||||
let uri = track_id.to_uri()?;
|
let uri = track_id.to_uri()?;
|
||||||
let album = track.album.name;
|
let album = track.album.name;
|
||||||
|
|
||||||
|
let album_date = track.album.date;
|
||||||
|
|
||||||
let album_artists = track
|
let album_artists = track
|
||||||
.album
|
.album
|
||||||
.artists
|
.artists
|
||||||
|
@ -116,6 +119,7 @@ impl AudioItem {
|
||||||
let unique_fields = UniqueFields::Track {
|
let unique_fields = UniqueFields::Track {
|
||||||
artists: track.artists_with_role,
|
artists: track.artists_with_role,
|
||||||
album,
|
album,
|
||||||
|
album_date,
|
||||||
album_artists,
|
album_artists,
|
||||||
popularity,
|
popularity,
|
||||||
number,
|
number,
|
||||||
|
|
|
@ -54,6 +54,7 @@ impl EventHandler {
|
||||||
UniqueFields::Track {
|
UniqueFields::Track {
|
||||||
artists,
|
artists,
|
||||||
album,
|
album,
|
||||||
|
album_date,
|
||||||
album_artists,
|
album_artists,
|
||||||
popularity,
|
popularity,
|
||||||
number,
|
number,
|
||||||
|
@ -72,6 +73,10 @@ impl EventHandler {
|
||||||
env_vars
|
env_vars
|
||||||
.insert("ALBUM_ARTISTS", album_artists.join("\n"));
|
.insert("ALBUM_ARTISTS", album_artists.join("\n"));
|
||||||
env_vars.insert("ALBUM", album);
|
env_vars.insert("ALBUM", album);
|
||||||
|
env_vars.insert(
|
||||||
|
"ALBUM_DATE",
|
||||||
|
album_date.unix_timestamp().to_string(),
|
||||||
|
);
|
||||||
env_vars.insert("POPULARITY", popularity.to_string());
|
env_vars.insert("POPULARITY", popularity.to_string());
|
||||||
env_vars.insert("NUMBER", number.to_string());
|
env_vars.insert("NUMBER", number.to_string());
|
||||||
env_vars.insert("DISC_NUMBER", disc_number.to_string());
|
env_vars.insert("DISC_NUMBER", disc_number.to_string());
|
||||||
|
|
Loading…
Reference in a new issue