mirror of
https://github.com/librespot-org/librespot.git
synced 2026-04-27 08:15:50 +03:00
[PR #452] [MERGED] Add more data to player events and fire more of them #934
Labels
No labels
A-Alsa
SpotifyAPI
Tokio 1.0
audio
bug
can't reproduce
compilation
dependencies
duplicate
enhancement
good first issue
help wanted
high priority
imported
imported
invalid
new api
pull-request
question
reverse engineering
wiki
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/librespot#934
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 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:
dev← Head:improved_events📝 Commits (3)
c911754Refactor TrackMetaData in the player and add the metadata to the player events.b562ec6rename variable.223b8d6Roll 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.