Commit graph

31 commits

Author SHA1 Message Date
Jarkko Lehtoranta e3db0994bc
Use single player and mixer instances 2023-07-19 14:49:17 +03:00
Nick Steel 68bbb4fbbc Fix latest clippy and fmt warnings 2022-11-22 13:38:02 +00:00
killahtree b15490714d
Update play.rs 2022-11-03 20:21:39 -04:00
killahtree 39b37d344f
Update play.rs 2022-11-03 20:10:49 -04:00
JasonLG1979 8545f361c4 Major Events Overhaul
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 `disconnect`, `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
2022-09-17 16:21:10 -05:00
Roderick van Domburg 05b9b13cf8
Merge branch 'dev' into new-api and update crates 2022-07-27 23:31:11 +02:00
Louis Seubert 6c2491b9a3
adding callback for reusable credentials (#983)
This allows more control over how the credentials are saved to the cache
2022-05-20 12:53:44 +02:00
Jason Gray 7efc62b9ca
Remove the volume sample iteration (#986)
Move volume calculations out of their own separate samples iteration and into the normalisation iteration
2022-05-19 22:23:14 +02:00
Roderick van Domburg 2065ded7b6
Fix examples 2022-01-16 01:29:50 +01:00
johannesd3 26c127c2ec Merge branch 'dev' into tokio_migration 2021-04-10 12:59:47 +02:00
johannesd3 11ce29077e Fix formatting 2021-04-09 10:45:48 +02:00
ThouCheese ec1ec59b8a update examples
Re-add default impl to SessionConfig and make Credentials::with_password generic over Into<String>

add docs for Credential

reintroduce old Default impl for SessionConfig

use the third argument for the track-to-play rather than a testing id
2021-03-24 01:14:44 +01:00
Roderick van Domburg 6379926eb4 Fix example 2021-03-12 23:47:15 +01:00
Konstantin Seiler 9eef690a22 Some clean up 2020-02-02 11:08:46 +11:00
Konstantin Seiler 5784b4652c Prepare for gapless play.
- change communication between player and spirc to use player events channel.
- enhance player events channel
- have spirc send loading messages to Spotify
- enable preloading of tracks in the player
2020-02-01 08:41:11 +11:00
ashthespy d26590afc5
Update to Rust 2018
- Fix deprecated Error::cause warnings and missing dyn
- Reset max_width
- Add rustfmt to Travis
- Run rustfmt on full codebase
 with `cargo fmt --all`
- Add rustfmt to Travis
- Complete migration to edition 2018
- Replace try! shorthand
- Use explicit `dyn Trait`
2020-01-17 18:11:52 +01:00
marcelbuesing be2ad9059a
Migrate to rust 2018 edition 2020-01-17 15:54:42 +01:00
Gilles Castel 93a00956ce Fix play.rs example 2019-10-09 18:18:38 +02:00
Nick Mavis c19375c5ca Fixed nightly conflict with 2019-09-16 15:00:09 -04:00
Harold 00e89343fb Formatting 2018-07-03 13:08:42 +02:00
Brice d40c0f50db Cache volume across restarts (#220)
* create Volume struct for use with Cache

* add "volume" file to Cache

* load cached volume on start, intial overrides cached overrides default

* amend volume_to_mixer function to cache the volume on every change

* pass cache to Spirc and SpircTask so volume_to_mixer has access

* rustfmt changes

* revert volume_to_mixer function and Spirc/SpircTask cache variable

* Volume implements Copy, pass by value instead of reference

* clamp volume to 100 if cached value exceeds limit

* convert Volume to u16 internally, use float and round to convert hex->dec

* convert initial_volume and ConnectConfig.volume to u16 as well

* add cache_volume function to SpircTask

* remove conversion to/from percentage on cached volume

* consolidate device.set_volume, mixer.set_volume, and caching

* streamline intial volume logic
2018-05-17 03:15:17 +02:00
Lasse Linkola 4caf2b88f2 formatting 2018-04-16 19:11:27 +03:00
Lasse Linkola d62b72f24d fixed example play.rs initalizing player 2018-04-16 19:04:31 +03:00
Johan Anderholm 612978908f Reformat according to new rustfmt rules 2018-03-24 08:45:43 +00:00
Sasha Hilton 237ef1e4f9 Format according to rustfmt 2018-02-26 02:50:41 +01:00
Sasha Hilton 4fb8c71b0a Set SpotifyId methods to return Result 2018-02-25 03:04:07 +01:00
akosel 3ce22113cf Fix example use declarations (#160) 2018-02-22 13:24:04 +01:00
awiouy 4c2b641cad core API: move spotify_id to lib.rs 2018-02-13 07:57:28 +01:00
awiouy 191caca518 core API: move Bitrate and PlayerConfig from core to playback 2018-02-11 23:55:41 +01:00
Paul Lietar 2846d3acfd Fix the play example 2017-08-03 20:11:30 +01:00
Paul Lietar 294a7821d6 Add simple playback example. 2017-04-28 23:24:55 +01:00