[PR #452] [MERGED] Add more data to player events and fire more of them #934

Closed
opened 2026-02-27 20:00:30 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/librespot-org/librespot/pull/452
Author: @kaymes
Created: 3/12/2020
Status: Merged
Merged: 5/11/2020
Merged by: @awiouy

Base: devHead: improved_events


📝 Commits (3)

  • c911754 Refactor TrackMetaData in the player and add the metadata to the player events.
  • b562ec6 rename variable.
  • 223b8d6 Roll back the meta data processing.

📊 Changes

3 files changed (+77 additions, -26 deletions)

View changed files

📝 playback/src/player.rs (+50 -26)
📝 src/main.rs (+1 -0)
📝 src/player_event_handler.rs (+26 -0)

📄 Description

This PR adds more metadata to the PlayerEvents. I also added some comments that explain which PlayerEvent is fired when.

More PlayerEvents are now exposed through the --onevent script and the additional meta data is made available through additional environment variables.

Currently the additional metadata that is being exported is the title of the current track and its length.
It would be nice to add the Artist and maybe the cover art URL as well but this requires loading of additional information from the server. At this stage I'm only making available what's already there. So that's half of #439.
(Loading the Artist info shouldn't be too difficult, but there doesn't seem to be an interface for the cover art yet - at least I couldn't find it in the code or protobuf definition).

While doing so I realised that a growing set of metadata variables is getting passed around within the player. Thus I decided to refactor this and bundle them into a TrackMetaData struct. This should make it much easier to add more fields in the future.

The events that trigger the --onevent script are:
start
change
stop
playing
paused
volume_set

The first three events are as before and the last three are new.

Only playing and paused provide the additional meta data. The reason is that start and change are fired before the track has been loaded, so the data isn't available.

The volume_set event solves one half of #410. (the second half is suppressing the volume change within librespot).


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/librespot-org/librespot/pull/452 **Author:** [@kaymes](https://github.com/kaymes) **Created:** 3/12/2020 **Status:** ✅ Merged **Merged:** 5/11/2020 **Merged by:** [@awiouy](https://github.com/awiouy) **Base:** `dev` ← **Head:** `improved_events` --- ### 📝 Commits (3) - [`c911754`](https://github.com/librespot-org/librespot/commit/c9117542eb290795b458f59fd4af99e6f6cd03da) Refactor TrackMetaData in the player and add the metadata to the player events. - [`b562ec6`](https://github.com/librespot-org/librespot/commit/b562ec6015f3caf709a3d5bf2375cad7eaa4f945) rename variable. - [`223b8d6`](https://github.com/librespot-org/librespot/commit/223b8d611e7c354cb1d784f71b89d8a3d851af19) Roll back the meta data processing. ### 📊 Changes **3 files changed** (+77 additions, -26 deletions) <details> <summary>View changed files</summary> 📝 `playback/src/player.rs` (+50 -26) 📝 `src/main.rs` (+1 -0) 📝 `src/player_event_handler.rs` (+26 -0) </details> ### 📄 Description This PR adds more metadata to the PlayerEvents. I also added some comments that explain which PlayerEvent is fired when. More PlayerEvents are now exposed through the --onevent script and the additional meta data is made available through additional environment variables. Currently the additional metadata that is being exported is the title of the current track and its length. It would be nice to add the Artist and maybe the cover art URL as well but this requires loading of additional information from the server. At this stage I'm only making available what's already there. So that's half of #439. (Loading the Artist info shouldn't be too difficult, but there doesn't seem to be an interface for the cover art yet - at least I couldn't find it in the code or protobuf definition). While doing so I realised that a growing set of metadata variables is getting passed around within the player. Thus I decided to refactor this and bundle them into a TrackMetaData struct. This should make it much easier to add more fields in the future. The events that trigger the --onevent script are: start change stop playing paused volume_set The first three events are as before and the last three are new. Only playing and paused provide the additional meta data. The reason is that start and change are fired before the track has been loaded, so the data isn't available. The volume_set event solves one half of #410. (the second half is suppressing the volume change within librespot). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 20:00:30 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/librespot#934
No description provided.