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

248 commits

Author SHA1 Message Date
Felix Prillwitz
9d0e39f9c3
fix: fires the connect and disconnect again (#1548) 2025-08-24 12:27:53 +02:00
Roderick van Domburg
78ce118d32
fix: rustls-tls features to support certificate stores (#1542)
Add separate features for native system roots and Mozilla webpki roots.
Update documentation and build configs to reflect new options.
2025-08-20 11:31:13 +02:00
Roderick van Domburg
0a4969ffe2
feat: add configurable TLS backend selection with native-tls as default (#1541)
Add support for choosing between native-tls and rustls-tls backends
through feature flags, with native-tls as the default for maximum
platform compatibility.

Key changes:
- Add mutually exclusive native-tls and rustls-tls feature flags
- Use conditional compilation to select TLS implementation
- Configure rustls-tls with platform certificate verifier
- Refactor to workspace-based dependency management
- Update CI workflows with improved cross-compilation support
- Add comprehensive TLS backend documentation

The native-tls backend uses system TLS libraries (OpenSSL on Linux,
Secure Transport on macOS, SChannel on Windows) while rustls-tls
provides a pure Rust implementation with platform certificate stores.
2025-08-19 23:06:28 +02:00
Roderick van Domburg
218eced556
style: format with style edition 2024 2025-08-13 23:09:59 +02:00
Roderick van Domburg
6288e7e03c
refactor: update to Rust 1.85 and edition 2024, use inline log args
- Update MSRV to 1.85 and Rust edition to 2024.
- Refactor all logging macros to use inline argument formatting.
- Fix import order in main.rs and examples.
- Add async environment variable setter to main.rs as safe facade.
2025-08-13 16:19:39 +02:00
Roderick van Domburg
ce1ab8ff3f
refactor: update dependencies and code for latest ecosystem changes
- Update many dependencies to latest versions across all crates
- Switch from `once_cell::OnceCell` to `std::sync::OnceLock` where appropriate
- Update OAuth to use stateful `reqwest` for HTTP requests
- Fix Rodio backend to honor the requested sample format
2025-08-13 13:19:48 +02:00
Felix Prillwitz
be37402421
Expose possible mixer opening errors (#1488)
* playback: handle errors when opening mixer

* chore: update CHANGELOG.md

* fix tests and typo
2025-07-14 17:39:33 +02:00
Felix Prillwitz
80c27ec476
fix: playback of uris by api request (#1509)
- pop page after usage
- become active when play is requested
2025-06-26 17:39:49 +02:00
Mads Marquart
2c425ebd06
Fix compiler error when objc2 is in dependency tree (#1503) 2025-06-09 12:34:54 +02:00
Felix Prillwitz
8b729540f4
Re-Add ability to handle/play tracks (#1468)
* re-add support to play a set of tracks

* connect: reduce some cloning

* connect: derive clone for LoadRequest

* apply review, improve function naming

* clippy fix
2025-05-04 20:29:54 +02:00
Felix Prillwitz
e2c3ac3146
Mark unrelated parsing error as warning (#1491)
* mark known parsing error as warning

* add copilot suggestion

* adjust unknown enum handling for json
2025-05-03 23:39:07 +02:00
Scott S. McCoy
6bdc0eb312
spirc: Configurable volume control steps (#1498)
* spirc: Configurable volume control steps

Allow the volume control steps to be configured via the `--volume-steps`
command line parameter. The author personally found the default volume
steps of `1024` to be completely unusable, and is presently using `128`
as his configuration. Perhaps consider this as a more reasonable
default.

Additionally, reduce the delay in volume update from a wopping two
seconds to 500ms, again for usability.

Also clean up the seemingly unnecessary use of a pattern match on
whether or not `--initial-volume` was supplied.

* fixup! spirc: Configurable volume control steps

* fixup! spirc: Configurable volume control steps

* fixup! spirc: Configurable volume control steps

* fixup! spirc: Configurable volume control steps

* fixup! spirc: Configurable volume control steps

* fixup! spirc: Configurable volume control steps

---------

Co-authored-by: Scott S. McCoy <scott.s.mccoy@acm.org>
2025-05-01 23:19:47 +02:00
Felix Prillwitz
837b3e6d1a
Emit shuffle and repeat events again (#1469)
* emit shuffle and repeat events again

* connect: split context/track repeat handling
2025-03-22 20:17:46 +01:00
Felix Prillwitz
09b4aa41e5
Add rustdoc to connect crate (#1455)
* restructure connect and add initial docs

* replace inline crate rustdoc with README.md

* connect: make metadata trait less visible

* connect: add some more docs

* chore: remove clippy warning

* update CHANGELOG.md

* revert unrelated changes

* enforce separation of autoplay and options

* hide and improve docs of uid

* remove/rename remarks

* update connect example and link in docs

* fixup rebase and clippy warnings
2025-02-22 23:39:16 +01:00
Felix Prillwitz
34762f2274
Shuffle tracks in place (#1445)
* connect: add shuffle_vec.rs

* connect: shuffle in place

* add shuffle with seed option

* reduce complexity to add new metadata fields

* add context index to metadata

* use seed for shuffle

When losing the connection and restarting the dealer, the seed is now stored in the context metadata. So on transfer we can pickup the seed again and shuffle the context as it was previously

* add log for shuffle seed

* connect: use small_rng, derive Default

* Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-02-02 22:58:30 +01:00
Felix Prillwitz
98e9703edb
connect: handle dnd of current track (#1449) 2025-01-23 19:14:48 +01:00
Felix Prillwitz
5f7cfdc76c
Expose autoplay option to SpircLoadCommand (#1446)
* connect: add autoplay option to SpircLoadCommand

* update CHANGELOG.md

* actually ignore options when starting autoplay
2025-01-23 19:13:30 +01:00
Felix Prillwitz
b54f3e30db
connect: expose disable_volume (#1451) 2025-01-20 16:59:04 +01:00
Felix Prillwitz
f3bb380851
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
2025-01-18 16:45:33 +01:00
Fabio Waljaard
3a570fc5f1
Fix pause state when transferring (#1444) 2025-01-12 22:48:38 +01:00
Fabio Waljaard
4cecb2289a
Handle 'None' uri or empty string uri in transfer command (#1439) 2025-01-12 20:39:45 +01:00
Felix Prillwitz
2a574267ae
Update protobuf files (#1424)
* update protobuf definitions

* add additionally required proto files

* update version.rs

* adjust code to protobuf changes

* fix formatting

* apply suggestions, improve errors
2024-12-24 09:39:49 +01:00
Felix Prillwitz
755aa2e5a0
Dealer: Improve disconnect (#1420)
* connect: adjust disconnect behavior

* update CHANGELOG.md

* core: adjust param of `set_session_id`

* connect: move unexpected disconnect outside the loop again
2024-12-17 18:57:02 +01:00
yubiuser
597974f7d8
Remove session_id clones (#1422)
Signed-off-by: yubiuser <github@yubiuser.dev>
2024-12-16 18:31:46 +01:00
yubiuser
2a6d7545ca
Update/dependencies (#1416)
* Update sysinfo to 0.33
* Update thiserror to v2.0
* Update Alpine Dockerfile to 1.75 (MSRV)
* Update governor to 0.8
* Update quick-xml to 0.37
* Update rodio to 0.20.1
* Update zerocopy to 0.8.13
* Update alpine image to 3.19

---------

Signed-off-by: yubiuser <github@yubiuser.dev>
2024-12-14 22:29:55 +01:00
Fabio Waljaard
00679fc78d
Fix 'play' command requiring 'offset' field (#1418)
* Fix 'play' command requiring 'offset' field

* Derive 'Default' for SkipTo
2024-12-14 22:28:53 +01:00
Felix Prillwitz
5839b36192
Spirc: Replace Mecury with Dealer (#1356)
This was a huge effort by photovoltex@gmail.com with help from the community.
Over 140 commits were squashed. Below, their commit messages are kept unchanged.

---

* dealer wrapper for ease of use

* improve sending protobuf requests

* replace connect config with connect_state config

* start integrating dealer into spirc

* payload handling, gzip support

* put connect state consistent

* formatting

* request payload handling, gzip support

* expose dealer::protocol, move request in own file

* integrate handle of connect-state commands

* spirc: remove ident field

* transfer playing state better

* spirc: remove remote_update stream

* spirc: replace command sender with connect state update

* spirc: remove device state and remaining unused methods

* spirc: remove mercury sender

* add repeat track state

* ConnectState: add methods to replace state in spirc

* spirc: move context into connect_state, update load and next

* spirc: remove state, adjust remaining methods

* spirc: handle more dealer request commands

* revert rustfmt.toml

* spirc: impl shuffle

- impl shuffle again
- extracted fill up of next tracks in own method
- moved queue revision update into next track fill up
- removed unused method `set_playing_track_index`
- added option to specify index when resetting the playback context
- reshuffle after repeat context

* spirc: handle device became inactive

* dealer: adjust payload handling

* spirc: better set volume handling

* dealer: box PlayCommand (clippy warning)

* dealer: always respect queued tracks

* spirc: update duration of track

* ConnectState: update more restrictions

* cleanup

* spirc: handle queue requests

* spirc: skip next with track

* proto: exclude spirc.proto
- move "deserialize_with" functions into own file
- replace TrackRef with ProvidedTrack

* spirc: stabilize transfer/context handling

* core: cleanup some remains

* connect: improvements to code structure and performance

- use VecDeque for next and prev tracks

* connect: delayed volume update

* connect: move context resolve into own function

* connect: load context asynchronous

* connect: handle reconnect

- might currently steal the active devices playback

* connect: some fixes and adjustments

- fix wrong offset when transferring playback
- fix missing displayed context in web-player
- remove access_token from log
- send correct state reason when updating volume
- queue track correctly
- fix wrong assumption for skip_to

* connect: replace error case with option

* connect: use own context state

* connect: more stabilising

- handle SkipTo having no Index
- handle no transferred restrictions
- handle no transferred index
- update state before shutdown, for smoother reacquiring

* connect: working autoplay

* connect: handle repeat context/track

* connect: some quick fixes

- found self-named uid in collection after reconnecting

* connect: handle add_to_queue via set_queue

* fix clippy warnings

* fix check errors, fix/update example

* fix 1.75 specific error

* connect: position update improvements

* connect: handle unavailable

* connect: fix incorrect status handling for desktop and mobile

* core: fix dealer reconnect

- actually acquire new token
- use login5 token retrieval

* connect: split state into multiple files

* connect: encapsulate provider logic

* connect: remove public access to next and prev tracks

* connect: remove public access to player

* connect: move state only commands into own file

* connect: improve logging

* connect: handle transferred queue again

* connect: fix all-features specific error

* connect: extract transfer  handling into own file

* connect: remove old context model

* connect: handle more transfer cases correctly

* connect: do auth_token pre-acquiring earlier

* connect: handle play with skip_to by uid

* connect: simplified cluster update log

* core/connect: add remaining set value commands

* connect: position update workaround/fix

* connect: some queue cleanups

* connect: add uid to queue

* connect: duration as volume delay const

* connect: some adjustments and todo cleanups

- send volume update before general update
- simplify queue revision to use the track uri
- argument why copying the prev/next tracks is fine

* connect: handle shuffle from set_options

* connect: handle context update

* connect: move other structs into model.rs

* connect: reduce SpircCommand visibility

* connect: fix visibility of model

* connect: fix: shuffle on startup isn't applied

* connect: prevent loading a context with no tracks

* connect: use the first page of a context

* connect: improve context resolving

- support multiple pages
- support page_url of context
- handle single track

* connect: prevent integer underflow

* connect: rename method for better clarity

* connect: handle mutate and update messages

* connect: fix 1.75 problems

* connect: fill, instead of replace next page

* connect: reduce context update to single method

* connect: remove unused SpircError, handle local files

* connect: reduce nesting, adjust initial transfer handling

* connect: don't update volume initially

* core: disable trace logging of handled mercury responses

* core/connect: prevent takeover from other clients, handle session-update

* connect: add queue-uid for set_queue command

* connect: adjust fields for PlayCommand

* connect: preserve context position after update_context

* connect: unify metadata modification

- only handle `is_queued` `true` items for queue

* connect: polish request command handling

 - reply to all request endpoints
 - adjust some naming
 - add some docs

* connect: add uid to tracks without

* connect: simpler update of current index

* core/connect: update log msg, fix wrong behavior

- handle became inactive separately
- remove duplicate stop
- adjust docs for websocket request

* core: add option to request without metrics and salt

* core/context: adjust context requests and update

- search should now return the expected context
- removed workaround for single track playback
- move local playback check into update_context
- check track uri for invalid characters
- early return with `?`

* connect: handle possible search context uri

* connect: remove logout support

- handle logout command
- disable support for logout
- add todos for logout

* connect: adjust detailed tracks/context handling

- always allow next
- handle no prev track available
- separate active and fill up context

* connect: adjust context resolve handling, again

* connect: add autoplay metadata to tracks

- transfer into autoplay again

* core/connect: cleanup session after spirc stops

* update CHANGELOG.md

* playback: fix clippy warnings

* connect: adjust metadata

- unify naming
- move more metadata infos into metadata.rs

* connect: add delimiter between context and autoplay playback

* connect: stop and resume correctly

* connect: adjust context resolving

- improved certain logging parts
- preload autoplay when autoplay attribute mutates
- fix transfer context uri
- fix typo
- handle empty strings for resolve uri
- fix unexpected stop of playback

* connect: ignore failure during stop

* connect: revert resolve_uri changes

* connect: correct context reset

* connect: reduce boiler code

* connect: fix some incorrect states

- uid getting replaced by empty value
- shuffle/repeat clearing autoplay context
- fill_up updating and using incorrect index

* core: adjust incorrect separator

* connect: move `add_to_queue` and `mark_unavailable` into tracks.rs

* connect: refactor - directly modify PutStateRequest

- replace `next_tracks`, `prev_tracks`, `player` and `device` with `request`
- provide helper methods for the removed fields

* connect: adjust handling of context metadata/restrictions

* connect: fix incorrect context states

* connect: become inactive when no cluster is reported

* update CHANGELOG.md

* core/playback: preemptively fix clippy warnings

* connect: minor adjustment to session changed

* connect: change return type changing active context

* connect: handle unavailable contexts

* connect: fix previous restrictions blocking load with shuffle

* connect: update comments and logging

* core/connect: reduce some more duplicate code

* more docs around the dealer
2024-12-10 20:36:09 +01:00
Roderick van Domburg
e2eca65d11
chore: bump to v0.6.0-dev 2024-10-31 23:14:13 +01:00
Roderick van Domburg
383a6f6969
Update Cargo.lock 2024-10-30 21:11:33 +01:00
Felix Prillwitz
4580dab73f
Get access token via login5 (#1344)
* core: Obtain spclient access token using login5 instead of keymaster (Fixes #1179)
* core: move solving hashcash into util
* login5: add login for mobile

---------

Co-authored-by: Nick Steel <nick@nsteel.co.uk>
2024-10-19 20:27:26 +02:00
Artur H.
d8e84238ab
Fix initial volume showing zero but playing full volume (#1373) 2024-10-17 17:02:56 +02:00
Guillaume Desmottes
1912065248
Cargo: use rust-version from workspace (#1375)
Make it easier to check and update.
2024-10-17 17:01:56 +02:00
Roderick van Domburg
e73a08d43a
Remove garbage toml-e files from last publish 2024-10-15 21:23:09 +02:00
Roderick van Domburg
a974a71cc4
Update Cargo.lock 2024-10-15 20:38:42 +02:00
Roderick van Domburg
84d28e887b
Update Cargo.lock 2024-10-15 20:34:15 +02:00
yubiuser
353c696554
Fix elided_named_lifetimes (#1365)
Signed-off-by: yubiuser <github@yubiuser.dev>
2024-10-06 22:10:02 +02:00
yubiuser
22a8850fe9
Revert lint exception by setting minor version of protobuf (#1339) 2024-09-16 19:42:55 +02:00
yubiuser
dcd592bafb
Update MSRV to 1.74.0 and sysinfo to 0.31.3
Signed-off-by: yubiuser <github@yubiuser.dev>
2024-08-27 23:16:48 +02:00
Joey Eamigh
180ffacde1
adding flag to show connect device as group 2024-06-15 23:36:47 -04:00
Christian König
b0170d142b
Bump MSRV to 1.73
Signed-off-by: Christian König <ckoenig@posteo.de>
2024-06-10 18:50:38 +00:00
Christian König
ca035c9d17
Set MSRV in Cargo.toml files to 1.71
Signed-off-by: Christian König <ckoenig@posteo.de>
2024-05-11 19:03:06 +00:00
Christian König
63e2490821
Fix redundant import checking on beta toolchain
Signed-off-by: Christian König <ckoenig@posteo.de>
2024-03-31 17:37:07 +00:00
eladyn
60f6451c2e
fix clippy errors 2023-11-15 08:10:10 +01:00
Jarkko Lehtoranta
e3db0994bc
Use single player and mixer instances 2023-07-19 14:49:17 +03:00
Jarkko Lehtoranta
46195f18d6
Handle play_request_id as an event 2023-07-19 14:49:05 +03:00
Lukáš Tyrychtr
3662302196
Update protobuf and related crates to 3.x (#1092) 2023-01-17 21:46:14 +01:00
Guillaume Desmottes
7f2cb684c9 fix clippy warnings 2023-01-03 00:36:35 +01:00
Oliver Cooper
edf646d4bb
Add activate and load functions to Spirc (#1075) 2022-12-03 12:25:27 +01:00
Roderick van Domburg
f10b8f69f8
Improvements towards supporting pagination
Not there yet, as Apollo stations always return autoplay
recommendations even if you set autoplay to false. Along the way
as an effort to bring the protocol up to spec:

- And support for and use different Apollo station scopes depending
  on whether we are using autoplay or not. For autoplay, get a
  "stations" scope and follow the "tracks" pages from there. Otherwise
  use "tracks" immediately for the active scope (playlist, album).

- For the above point we only need the fields from `PageContext`
  so use that instead of a `StationContext`.

- Add some documentation from API reverse engineering: things seen
  in the wild, some of them to do, others documented for posterity's
  sake.

- Update the Spirc device state based on what the latest desktop
  client puts out. Unfortunately none of it seems to change the
  behavior necessary to support external episodes, shows, but
  at least we're doing the right thing.

- Add a salt to HTTPS queries to defeat any caching.

- Add country metrics to HTTPS queries.

- Fix `get_radio_for_track` to use the right Spotify ID format.

- Fix a bug from the previous commit, where the playback position
  might not advance when hitting next and the autoplay context
  is loaded initially.
2022-10-01 23:01:17 +02:00
Roderick van Domburg
bfb7d5689c
Retrieve autoplay contexts over HTTPS and fix repeat/prev/next
Repeat, previous and next used to start playback regardless of
the actual playback state. They now start playback only if we
were already playing.
2022-09-30 21:36:20 +02:00