Skip to content

Commit

Permalink
add release date to AudioItem
Browse files Browse the repository at this point in the history
- preparation for MPRIS support
- now that the data is there, also yield from player_event_handler
  • Loading branch information
wisp3rwind committed Oct 27, 2024
1 parent 949a886 commit 055e0d8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions metadata/src/audio/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ pub enum UniqueFields {
Track {
artists: ArtistsWithRole,
album: String,
album_date: Date,
album_artists: Vec<String>,
popularity: u8,
number: u32,
Expand Down Expand Up @@ -83,6 +84,8 @@ impl AudioItem {
let uri = track_id.to_uri()?;
let album = track.album.name;

let album_date = track.album.date;

let album_artists = track
.album
.artists
Expand Down Expand Up @@ -116,6 +119,7 @@ impl AudioItem {
let unique_fields = UniqueFields::Track {
artists: track.artists_with_role,
album,
album_date,
album_artists,
popularity,
number,
Expand Down
5 changes: 5 additions & 0 deletions src/player_event_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ impl EventHandler {
UniqueFields::Track {
artists,
album,
album_date,
album_artists,
popularity,
number,
Expand All @@ -72,6 +73,10 @@ impl EventHandler {
env_vars
.insert("ALBUM_ARTISTS", album_artists.join("\n"));
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("NUMBER", number.to_string());
env_vars.insert("DISC_NUMBER", disc_number.to_string());
Expand Down

0 comments on commit 055e0d8

Please sign in to comment.