1
0
Fork 0
mirror of https://github.com/librespot-org/librespot.git synced 2025-10-03 01:39:28 +02:00

Dealer: Rework context retrieval (#1414)

* connect: simplify `handle_command` for SpircCommand

* connect: simplify `handle_player_event`

* connect: `handle_player_event` update log entries

* connect: set `playback_speed` according to player state

* connect: reduce/group state updates by delaying them slightly

* connect: load entire context at once

* connect: use is_playing from connect_state

* connect: move `ResolveContext` in own file

* connect: handle metadata correct

* connect: resolve context rework

- resolved contexts independently, by that we don't block our main loop
- move resolve logic into own file
- polish handling for play and transfer

* connect: rework aftermath

* general logging and comment fixups

* connect: fix incorrect stopping

* connect: always handle player seek event

* connect: adjust behavior

- rename `handle_context` to `handle_next_context`
- disconnect should only pause the playback
- find_next should not exceed queue length

* fix typo and `find_next`

* connect: fixes for context and transfer

- fix context_metadata and restriction incorrect reset
- do some state updates earlier
- add more logging

* revert removal of state setup

* `clear_next_tracks` should never clear queued items

just mimics official client behavior

* connect: make `playing_track` optional and handle it correctly

* connect: adjust finish of context resolving

* connect: set track position when shuffling

* example: adjust to model change

* connect: remove duplicate track

* connect: provide all recently played tracks to autoplay request

- removes previously added workaround

* connect: apply review suggestions

- use drain instead of for with pop
- use for instead of loop
- use or_else instead of match
- use Self::Error instead of the value
- free memory for metadata and restrictions

* connect: impl trait for player context

* connect: fix incorrect playing and paused

* connect: apply options as official clients

* protocol: move trait impls into impl_trait mod
This commit is contained in:
Felix Prillwitz 2025-01-18 16:45:33 +01:00 committed by GitHub
parent c288cf7106
commit f3bb380851
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 1004 additions and 734 deletions

View file

@ -174,7 +174,9 @@ fn handle_transfer_encoding(
) -> Result<Vec<u8>, Error> {
let encoding = headers.get("Transfer-Encoding").map(String::as_str);
if let Some(encoding) = encoding {
trace!("message was send with {encoding} encoding ");
trace!("message was sent with {encoding} encoding ");
} else {
trace!("message was sent with no encoding ");
}
if !matches!(encoding, Some("gzip")) {

View file

@ -813,7 +813,7 @@ impl SpClient {
/// **will** contain the query
/// - artists
/// - returns 2 pages with tracks: 10 most popular tracks and latest/popular album
/// - remaining pages are albums of the artists and are only provided as page_url
/// - remaining pages are artist albums sorted by popularity (only provided as page_url)
/// - search
/// - is massively influenced by the provided query
/// - the query result shown by the search expects no query at all