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:
wisp3rwind 2024-09-17 15:19:26 +02:00
parent 949a886f62
commit 055e0d8f38
2 changed files with 9 additions and 0 deletions

View file

@ -47,6 +47,7 @@ pub enum UniqueFields {
Track {
artists: ArtistsWithRole,
album: String,
album_date: Date,
album_artists: Vec<String>,
popularity: u8,
number: u32,
@ -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
@ -116,6 +119,7 @@ impl AudioItem {
let unique_fields = UniqueFields::Track {
artists: track.artists_with_role,
album,
album_date,
album_artists,
popularity,
number,

View file

@ -54,6 +54,7 @@ impl EventHandler {
UniqueFields::Track {
artists,
album,
album_date,
album_artists,
popularity,
number,
@ -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());