Skip to content

Commit 64995ab

Browse files
wisp3rwindpaulfariello
authored andcommitted
add release date to AudioItem
- preparation for MPRIS support - now that the data is there, also yield from player_event_handler
1 parent 58e8a8e commit 64995ab

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

metadata/src/audio/item.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ pub enum UniqueFields {
4545
Track {
4646
artists: ArtistsWithRole,
4747
album: String,
48+
album_date: Date,
4849
album_artists: Vec<String>,
4950
popularity: u8,
5051
number: u32,
@@ -80,6 +81,8 @@ impl AudioItem {
8081
let uri_string = uri.to_uri()?;
8182
let album = track.album.name;
8283

84+
let album_date = track.album.date;
85+
8386
let album_artists = track
8487
.album
8588
.artists
@@ -113,6 +116,7 @@ impl AudioItem {
113116
let unique_fields = UniqueFields::Track {
114117
artists: track.artists_with_role,
115118
album,
119+
album_date,
116120
album_artists,
117121
popularity,
118122
number,

src/player_event_handler.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ impl EventHandler {
6161
UniqueFields::Track {
6262
artists,
6363
album,
64+
album_date,
6465
album_artists,
6566
popularity,
6667
number,
@@ -81,6 +82,10 @@ impl EventHandler {
8182
album_artists.join("\n"),
8283
);
8384
env_vars.insert("ALBUM", album);
85+
env_vars.insert(
86+
"ALBUM_DATE",
87+
album_date.unix_timestamp().to_string(),
88+
);
8489
env_vars
8590
.insert("POPULARITY", popularity.to_string());
8691
env_vars.insert("NUMBER", number.to_string());

0 commit comments

Comments
 (0)