[PR #1053] [MERGED] Major Events Overhaul #1211

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

📋 Pull Request Information

Original PR: https://github.com/librespot-org/librespot/pull/1053
Author: @JasonLG1979
Created: 8/23/2022
Status: Merged
Merged: 9/22/2022
Merged by: @roderickvd

Base: devHead: connect-event


📝 Commits (1)

📊 Changes

17 files changed (+1223 additions, -623 deletions)

View changed files

📝 CHANGELOG.md (+11 -0)
📝 connect/src/spirc.rs (+201 -100)
contrib/event_handler_example.py (+77 -0)
📝 core/src/authentication.rs (+1 -1)
📝 core/src/session.rs (+41 -0)
📝 examples/play.rs (+1 -1)
📝 metadata/src/album.rs (+1 -1)
📝 metadata/src/audio/item.rs (+231 -67)
📝 metadata/src/audio/mod.rs (+1 -1)
📝 metadata/src/episode.rs (+3 -29)
📝 metadata/src/error.rs (+4 -0)
📝 metadata/src/image.rs (+7 -0)
📝 metadata/src/track.rs (+2 -41)
📝 playback/src/audio_backend/alsa.rs (+30 -16)
📝 playback/src/player.rs (+318 -183)
📝 src/main.rs (+12 -60)
📝 src/player_event_handler.rs (+282 -123)

📄 Description

Special thanks to @eladyn for all of their help and suggestions.

  • Add all player events to player_event_handler.rs

  • Move event handler code to player_event_handler.rs

  • Add session events

  • Clean up and de-noise events and event firing

  • Added metadata support via a TrackChanged event

  • Add event_handler_example.py

  • Handle invalid track start positions by just starting the track from the beginning

  • Add repeat support to spirc.rs

  • Add set_position_ms and set_volume to spirc.rs

  • Set PlayStatus to the correct value when Player is loading to avoid blanking out the controls when self.play_status is LoadingPlay or LoadingPause in spirc.rs

  • Handle attempts to play local files better by basically ignoring attempts to load them in handle_remote_update in spirc.rs

  • Add an event worker thread that runs async to the main thread(s) but sync to itself to prevent potential data races for event consumers.

  • Get rid of (probably harmless) .unwrap() in main.rs

  • Ensure that events are emited in a logical order and at logical times

  • Handle invalid and disappearing devices better

  • Ignore SpircCommands unless we're active with the exception of ShutDown


🔄 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/1053 **Author:** [@JasonLG1979](https://github.com/JasonLG1979) **Created:** 8/23/2022 **Status:** ✅ Merged **Merged:** 9/22/2022 **Merged by:** [@roderickvd](https://github.com/roderickvd) **Base:** `dev` ← **Head:** `connect-event` --- ### 📝 Commits (1) - [`8545f36`](https://github.com/librespot-org/librespot/commit/8545f361c47b764739ebc4925c4bd33416baa91b) Major Events Overhaul ### 📊 Changes **17 files changed** (+1223 additions, -623 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+11 -0) 📝 `connect/src/spirc.rs` (+201 -100) ➕ `contrib/event_handler_example.py` (+77 -0) 📝 `core/src/authentication.rs` (+1 -1) 📝 `core/src/session.rs` (+41 -0) 📝 `examples/play.rs` (+1 -1) 📝 `metadata/src/album.rs` (+1 -1) 📝 `metadata/src/audio/item.rs` (+231 -67) 📝 `metadata/src/audio/mod.rs` (+1 -1) 📝 `metadata/src/episode.rs` (+3 -29) 📝 `metadata/src/error.rs` (+4 -0) 📝 `metadata/src/image.rs` (+7 -0) 📝 `metadata/src/track.rs` (+2 -41) 📝 `playback/src/audio_backend/alsa.rs` (+30 -16) 📝 `playback/src/player.rs` (+318 -183) 📝 `src/main.rs` (+12 -60) 📝 `src/player_event_handler.rs` (+282 -123) </details> ### 📄 Description Special thanks to @eladyn for all of their help and suggestions. * Add all player events to `player_event_handler.rs` * Move event handler code to `player_event_handler.rs` * Add session events * Clean up and de-noise events and event firing * Added metadata support via a TrackChanged event * Add `event_handler_example.py` * Handle invalid track start positions by just starting the track from the beginning * Add repeat support to `spirc.rs` * Add `set_position_ms` and `set_volume` to `spirc.rs` * Set `PlayStatus` to the correct value when Player is loading to avoid blanking out the controls when `self.play_status` is `LoadingPlay` or `LoadingPause` in `spirc.rs` * Handle attempts to play local files better by basically ignoring attempts to load them in `handle_remote_update` in `spirc.rs` * Add an event worker thread that runs async to the main thread(s) but sync to itself to prevent potential data races for event consumers. * Get rid of (probably harmless) `.unwrap()` in `main.rs` * Ensure that events are emited in a logical order and at logical times * Handle invalid and disappearing devices better * Ignore SpircCommands unless we're active with the exception of ShutDown --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 20:01:35 +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#1211
No description provided.