Commit graph

1997 commits

Author SHA1 Message Date
JasonLG1979
ce9eb42469 Fix fmt lint from 05dcb652a0 2022-10-01 19:51:55 -05:00
Roderick van Domburg
05dcb652a0
Fix example 2022-10-02 00:08:36 +02:00
Roderick van Domburg
bae304fdb0
Update zeroconf fields and publish active user 2022-10-02 00:00:30 +02: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
Roderick van Domburg
6dc7a11b09
Re-introduce autoplay command-line option as an override 2022-09-28 22:59:03 +02:00
Roderick van Domburg
d07f58e6df
Update crates 2022-09-28 22:17:55 +02:00
Roderick van Domburg
cc1fb5a406
Update changelog 2022-09-28 22:17:43 +02:00
Roderick van Domburg
eb1472c713
Various loading improvements
- Improve responsiveness by downloading the smallest possible chunk
  size when seeking or first loading.

- Improve download time and decrease CPU usage by downloading the
  largest possible chunk size as throughput allows, still allowing
  for reasonable seek responsiveness (~1 second).

- As a result, take refactoring opportunities: simplify prefetching
  logic, download threading, command sending, and some ergonomics.

- Fix disappearing controls in the Spotify mobile UI while loading.

- Fix handling of seek, pause, and play commands while loading.

- Fix download rate calculation (don't use the Mercury rate).

- Fix ping time calculation under lock contention.
2022-09-28 21:25:56 +02:00
Roderick van Domburg
cce1b966cb
Merge pull request #1060 from JasonLG1979/fix-clippy-lint
Fix clippy lint
2022-09-23 07:52:52 +02:00
JasonLG1979
d446258be5 Fix clippy lint 2022-09-22 16:41:03 -05:00
Roderick van Domburg
ccd501d22e
Merge pull request #1053 from JasonLG1979/connect-event
Major events overhaul
2022-09-22 21:43:09 +02: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
eladyn
762f6d1a6f
strongly type ActivityPeriod (#1055)
switch fallibly to unsigned integers
2022-09-03 09:59:53 +02:00
Roderick van Domburg
5451d14972
Rate limit audio file streaming too 2022-09-01 22:35:03 +02:00
Roderick van Domburg
56b5f08a32
Sanitize rate limiting timeout 2022-08-31 21:08:11 +02:00
Roderick van Domburg
16dbade516
Try another access point if so instructed 2022-08-29 23:51:29 +02:00
Roderick van Domburg
6c2127bfcd
Implement rate limiting 2022-08-29 23:09:51 +02:00
Roderick van Domburg
49e885d158
Make hash cash challenges a bit more robust 2022-08-28 23:52:22 +02:00
Roderick van Domburg
10650712a7
Add mobile client IDs and improve hash cash logic 2022-08-26 22:29:00 +02:00
Roderick van Domburg
111c7781d2
Use actual OS and kernel versions 2022-08-26 21:14:43 +02:00
Roderick van Domburg
65e48864a5
Fix tracing of client token 2022-08-26 02:15:13 +02:00
Roderick van Domburg
7b19d4c1dd
Solve hash cash challenges (experimental) 2022-08-26 01:51:00 +02:00
Roderick van Domburg
42a665fb0d
Revert most of cdf84925ad 2022-08-25 21:01:39 +02:00
Roderick van Domburg
dbf71c0dff
Move mostly harmless messages to debug level 2022-08-25 20:49:40 +02:00
Roderick van Domburg
9d80521e09
Fix warning and clippy lints 2022-08-22 22:38:19 +02:00
Roderick van Domburg
27e1274dcb
Merge pull request #1042 from dnlmlr/core-keep-hyper-client
Keep using the same `hyper` client
2022-08-15 12:28:30 +02:00
Roderick van Domburg
d899da5f8f
Merge pull request #1044 from felixstorm/fix-armv6hp
Fix armv6hp Builds (RPI 1 & Zero)
2022-08-15 12:26:33 +02:00
Felix Storm
a08efbc2f6 fix contrib/docker-build-pi-armv6hf.sh 2022-08-12 17:42:03 +02:00
Roderick van Domburg
a46df1d380
Merge pull request #1043 from JasonLG1979/update-raspotify-desc
Update raspotify description
2022-08-06 08:09:53 +02:00
JasonLG1979
411e95a7f8 Update raspotify description 2022-08-05 12:09:41 -05:00
Daniel M
b588d9fd07 Keep using the same hyper client
- Keep using the same hyper client instead of building a new one for
  each request
- This allows the client to reuse connections and improves the
  performance of multiple requests by almost 2x.
- The playlist_tracks example takes 38 secs before and 20 secs after the
  change to enumerate a 180 track playlist
- To avoid carrying the hyper Client generics through the whole project,
  `ProxyConnector` is always used as the Connector, but disabled when
  not using a proxy.
- The client creation is done lazily to keep the `HttpClient::new`
  without a `Result` return type
2022-08-04 18:37:32 +02:00
Roderick van Domburg
35f633c93a
Merge pull request #1041 from dnlmlr/fix-get-playlist
Fix `SpClient::get_playlist` endpoint generation
2022-08-04 07:05:48 +02:00
Daniel M
f55bdbb962 Fix SpClient::get_playlist endpoint generation 2022-08-04 00:09:30 +02:00
Roderick van Domburg
d88a20929f
Playlist ID should be Base62 encoded 2022-08-03 23:21:38 +02:00
Roderick van Domburg
a60d63637d
Fix example 2022-08-03 22:50:21 +02:00
Roderick van Domburg
80f0d3c59b
Pass by reference 2022-08-03 22:26:52 +02:00
Roderick van Domburg
70eb3f9d72
Add more HTTP endpoints and migrate playlist 2022-08-03 21:27:07 +02:00
Roderick van Domburg
922e927231
Merge pull request #1039 from roderickvd/rust-2021-edition
Migrate to Rust 2021
2022-08-03 20:04:31 +02:00
Roderick van Domburg
b2c7b25835
Merge pull request #1040 from dnlmlr/metadata-iterators-instead-of-vecs
Return iterators instead of collected Vecs
2022-08-03 20:02:51 +02:00
dnlmlr
131310b920
Fix panic in ApResolver::resolve (#1038)
- Fixed resolve function panicking when resolving endpoint type with no
  AP in the list
- Fixed fallback APs not being applied when only some of the AP types
  were missing
- Switch container type from `Vec` to `VecDeque` for the `AccessPoints`
- Remove the note about fallback AP being used even if the port is not
  matching the configured `ap_port`
2022-08-03 20:01:03 +02:00
Daniel M
176a47f10f Return iterators instead of collected vecs
- Change the return type of metadata convenience iter functions to
  actual iterators instead of allocated collections
- The iterator item type is set to be a reference
2022-08-03 16:43:30 +02:00
Roderick van Domburg
cdf84925ad
Add client-token header to spclient requests
- Also fix an overflow panic when a token cannot be parsed.

- Getting tokens always requires the keymaster client ID;
  passing the actual client ID yields a HashCash challenge.
2022-08-02 23:06:02 +02:00
Roderick van Domburg
2a79af1f0a
Migrate to Rust 2021 2022-08-02 21:42:38 +02:00
Roderick van Domburg
ebfe8ca36c
Merge pull request #1037 from dnlmlr/metadata-wrappers-deref-mut
Implement `DerefMut` for wrapper types in metadata
2022-08-02 20:27:45 +02:00
Daniel M
0c69126065 Rename from_repeated_* functions to impl_*
- `from_repeated_message` -> `impl_from_repeated`
- `from_repeated_enum` -> `impl_from_repeated_copy` since the enum
  references were just simply deref copied
- `try_from_repeated_message` -> `impl_try_from_repeated`
- Simplified the implementation of `from_repeated_enum`
2022-08-02 14:21:07 +02:00
Daniel M
a7fa0e2299 Implement DerefMut for wrapper types in metadata
- Change the `Deref` implementations for metadata wrapper types to use a
  new `impl_deref_wrapped` macro
- The macro implements `Deref` and `DerefMut`
2022-08-02 12:45:37 +02:00
dnlmlr
e5092c84fd
Implement additional metadata for Artist (#1036)
- Added `*-current()` functions to `Artist` to get the list of current
  versions / releases of each album
- This is useful since the `AlbumGroups` can contain multiple versions
  / releases of the same album
2022-08-02 11:43:48 +02:00
Roderick van Domburg
8ffaf7cb8d
Document crate and changelog updates 2022-08-01 23:14:21 +02:00
Roderick van Domburg
2bce489159
Create SECURITY.md 2022-08-01 22:46:05 +02:00