Commit graph

429 commits

Author SHA1 Message Date
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
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
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
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
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
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
sqozz
d09ee4206c Add minimum rust version 2022-08-01 15:14:17 +02:00
Roderick van Domburg
5344258ba9
Relax some non-fatal events to WARN level
Fixes #1029
2022-07-30 22:39:05 +02:00
Roderick van Domburg
786f8832d1
Update version numbers to 0.5.0-dev 2022-07-30 22:28:12 +02:00
Roderick van Domburg
37794c5b78
Merge branch 'new-api' into dev 2022-07-29 23:39:06 +02:00
Roderick van Domburg
6537c441c3
Update Cargo.lock 2022-07-29 22:05:10 +02:00
Roderick van Domburg
87ea69b457
Blacklist ap-gue1.spotify.com access point 2022-07-29 21:30:27 +02:00
Roderick van Domburg
9e06b11609
Update MSRV to 1.61 and fix test 2022-07-28 19:32:11 +02:00
Roderick van Domburg
7bd9186e94
Blacklist ap-gew4 access point (#1026) 2022-07-28 18:51:49 +02:00
eladyn
88f7cdbb44
Fix playlist metadata fields parsing (#1019)
Some fields were wrongly parsed as `SpotifyId`s, although they do not
always encode exactly 16 bytes in practice. Also, some optional fields
caused `[]` to be parsed as `SpotifyId`, which obviously failed as well.
2022-07-28 18:46:16 +02:00
Roderick van Domburg
05b9b13cf8
Merge branch 'dev' into new-api and update crates 2022-07-27 23:31:11 +02:00
Roderick van Domburg
88e64bd884
Update Cargo.lock 2022-05-23 21:43:16 +02:00
JasonLG1979
c03d3ad102 Bump deps
This bumps deps that don't need major code refactoring or MSRV bumps.
2022-05-23 10:19:54 -05:00
Roderick van Domburg
dff19377fa
Update version numbers to 0.4.0 2022-05-21 22:31:15 +02:00
Roderick van Domburg
2a3e248bba
Fix clippy lints 2022-05-21 21:36:56 +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
Bernhard M. Wiedemann
9de1f38e92 Allow to override build_id with SOURCE_DATE_EPOCH
in order to make builds reproducible.
See https://reproducible-builds.org/ for why this is good
and https://reproducible-builds.org/specs/source-date-epoch/
for the definition of this variable.

This PR was done while working on reproducible builds for openSUSE.
2022-05-20 10:29:42 +02:00
JasonLG1979
d887d58251 Fix clippy warnings 2022-03-20 10:52:08 -05:00
JasonLG1979
30c960a6cd Silence compiler warning
The `split` variable in `split_uri` should not be `mut`.
2022-02-23 17:08:43 -06:00
Jason Gray
47f1362453
Port remove unsafe code and catch up with dev (#956) 2022-02-14 12:15:19 +01:00
Roderick van Domburg
cb1cfddb74
Send platform-dependent client token request 2022-01-26 22:53:30 +01:00
Roderick van Domburg
31c682453b
Prevent man-in-the-middle attacks 2022-01-25 22:48:27 +01:00
Roderick van Domburg
44860f4738
Remove assertions for what we know works well 2022-01-25 20:58:39 +01:00
Roderick van Domburg
3f95a45b27
Parse dates without month or day (fixes #943) 2022-01-25 20:03:35 +01:00
SuisChan
8498ad8078 Update connectivity.proto 2022-01-24 12:52:15 +01:00
Jason Gray
ceebb374f0
Remove unsafe code (#940)
Remove unsafe code
2022-01-23 19:02:04 +01:00
Roderick van Domburg
4ea1b77c7b
Fix client-token and implement expiry logic 2022-01-23 00:26:52 +01:00
Roderick van Domburg
1528292583
Retrieve client token (not working) 2022-01-22 23:17:10 +01:00
Roderick van Domburg
0630586cd6
Ensure a client ID is present 2022-01-22 21:27:56 +01:00
Roderick van Domburg
0822af0328
Use configured client ID on initial connection (fixes #941) 2022-01-22 21:17:55 +01:00
Roderick van Domburg
8851951f04
Change counting to spirc and player
They can be reinstantiated, unlike the `session` which is now
intended to be constructed once.
2022-01-16 21:29:59 +01:00
Roderick van Domburg
fcb21df81f
Fix connect test 2022-01-16 01:36:28 +01:00
Roderick van Domburg
abbc3bade8
Register message listeners before connecting 2022-01-16 01:14:00 +01:00
Roderick van Domburg
dbeeb0f991
Switch from chrono to time 2022-01-14 23:28:09 +01:00
Roderick van Domburg
32df4a401d
Add configurable client ID and listen for updates 2022-01-12 22:09:57 +01:00
Roderick van Domburg
fbff879f3d
Update http, once_cell, vergen 2022-01-09 01:03:47 +01:00
Roderick van Domburg
56f3c39fc6
Update hmac, pbkdf2, serde, serde_json, sha-1 2022-01-09 00:25:47 +01:00
Roderick van Domburg
5a8bd5703c
Update tokio and hyper-rustls 2022-01-08 23:28:46 +01:00
Roderick van Domburg
5cc3040bd8
Update futures 2022-01-08 21:21:31 +01:00
Roderick van Domburg
89a5133bd7
Upgrade aes-ctr to latest aes 2022-01-08 20:51:51 +01:00
Roderick van Domburg
c1965198fc
Move DeviceType to core 2022-01-06 09:48:11 +01:00
Roderick van Domburg
4ca1f661d5
Prevent deadlock 2022-01-06 09:43:50 +01:00
Roderick van Domburg
cc9a574b2e
Move ConnectConfig to connect 2022-01-05 21:15:19 +01:00
Roderick van Domburg
1a7c440bd7
Improve lock ordering and contention 2022-01-05 20:44:08 +01:00
Roderick van Domburg
5c2b5a21c1
Fix audio file caching 2022-01-05 16:43:46 +01:00
Roderick van Domburg
2d699e288a
Follow autoplay client setting 2022-01-01 20:23:21 +01:00
Roderick van Domburg
2af34fc674
Add product metrics to requests 2021-12-30 22:36:38 +01:00
Roderick van Domburg
05c768f612
Add audio preview, image and head file support 2021-12-30 21:35:43 +01:00
Roderick van Domburg
9b6e02fa0d
Prevent a few potential panics 2021-12-29 23:15:08 +01:00
Roderick van Domburg
0f78fc277e
Call stream_from_cdn with CdnUrl 2021-12-27 21:42:57 +01:00
Roderick van Domburg
b622e3811e
Enable HTTP/2 flow control 2021-12-27 00:45:27 +01:00
Roderick van Domburg
95776de74a
Fix compilation for with-dns-sd 2021-12-27 00:21:42 +01:00
Roderick van Domburg
8aa23ed0c6
Drop locks as soon as possible 2021-12-27 00:11:07 +01:00
Roderick van Domburg
059e17dca5
Fix tests 2021-12-26 23:51:25 +01:00
Roderick van Domburg
b4f7a9e35e
Change to parking_lot and remove remaining panics 2021-12-26 23:02:02 +01:00
Roderick van Domburg
62461be1fc
Change panics into Result<_, librespot_core::Error> 2021-12-26 21:18:42 +01:00
Roderick van Domburg
0d51fd43dc
Remove unwraps from librespot-audio 2021-12-18 23:44:13 +01:00
Roderick van Domburg
d18a0d1803
Fix caching message when cache is disabled 2021-12-18 14:02:28 +01:00
Roderick van Domburg
9d88ac59c6
Configure User-Agent once 2021-12-18 13:39:41 +01:00
Roderick van Domburg
3b07a6bcb9
Support user-defined temp directories 2021-12-17 20:58:05 +01:00
Roderick van Domburg
2f7b9863d9
Implement CDN for audio files 2021-12-16 22:42:37 +01:00
Roderick van Domburg
9a93cca562
Get connection ID 2021-12-11 23:06:58 +01:00
Roderick van Domburg
9a31aa0362
Pretty-print trace messages 2021-12-11 20:45:08 +01:00
Roderick van Domburg
e748d543e9
Check availability from the catalogue attribute 2021-12-11 20:22:44 +01:00
Roderick van Domburg
51b6c46fcd
Receive autoplay and other attributes 2021-12-11 16:43:34 +01:00
Roderick van Domburg
9a0d2390b7
Get user attributes and updates 2021-12-11 00:03:35 +01:00
Roderick van Domburg
4f51c1e810
Report actual CPU, OS, platform and librespot version 2021-12-09 19:01:54 +01:00
Roderick van Domburg
f74c574c9f
Fix lyrics and add simpler endpoint 2021-12-08 20:27:15 +01:00
Roderick van Domburg
9b2ca1442e
Move FileId out of SpotifyId 2021-12-08 19:53:45 +01:00
Roderick van Domburg
f03a7e95c1
Merge remote-tracking branch 'librespot-org/dev' into new-api-wip 2021-12-08 19:11:53 +01:00
Roderick van Domburg
0e2686863a
Major metadata refactoring and enhancement
* Expose all fields of recent protobufs

 * Add support for user-scoped playlists, user root playlists and
   playlist annotations

 * Convert messages with the Rust type system

 * Attempt to adhere to embargos (tracks and episodes scheduled for
   future release)

 * Return `Result`s with meaningful errors instead of panicking on
   `unwrap`s

 * Add foundation for future playlist editing

 * Up version in connection handshake to get all version-gated features
2021-12-07 23:22:24 +01:00
JasonLG1979
4370258716 Address clippy lint warnings for rust 1.57 2021-12-03 12:51:41 -06:00
Roderick van Domburg
a73e05837e
Return HttpClientError for status code <> 200 2021-11-27 10:41:54 +01:00
Roderick van Domburg
e1b273b8a1
Fix lyrics retrieval 2021-11-27 08:30:51 +01:00
Roderick van Domburg
d19fd24074
Add spclient and HTTPS support
* Change metadata to use spclient
 * Add support for HTTPS proxies
 * Start purging unwraps and using Result instead
2021-11-26 23:28:37 +01:00
JasonLG1979
0e9fdbe6b4 Refactor main.rs
* Don't panic when parsing options. Instead list valid values and exit.
* Get rid of needless .expect in playback/src/audio_backend/mod.rs.
* Enforce reasonable ranges for option values (breaking).
* Don't evaluate options that would otherwise have no effect.
* Add pub const MIXERS to mixer/mod.rs very similar to the audio_backend's implementation. (non-breaking though)
* Use different option descriptions and error messages based on what backends are enabled at build time.
* Add a -q, --quiet option that changed the logging level to warn.
* Add a short name for every flag and option.
* Note removed options.
* Other misc cleanups.
2021-11-17 15:31:16 -06:00
JasonLG1979
9e017119bb Address review change request 2021-10-27 14:47:33 -05:00
JasonLG1979
52bd212e43 Add disable credential cache flag
As mentioned in https://github.com/librespot-org/librespot/discussions/870, this allows someone who would otherwise like to take advantage of audio file and volume caching to disable credential caching.
2021-10-26 22:06:52 -05:00
Roderick van Domburg
0e6b1ba9dc
Update version numbers to 0.3.1 2021-10-24 20:12:33 +02:00
Sasha Hilton
6a3377402a Update version numbers to 0.3.0 2021-10-13 15:10:18 +01:00
Roderick van Domburg
b016b69772
Fix clippy warnings 2021-09-01 21:25:32 +02:00
Roderick van Domburg
c0115fd4e8
Merge pull request #763 from Johannesd3/credentials-with-blob-args
Adjust argument types of `Credentials::with_blob` to avoid redundant UTF-8 checks
2021-06-28 21:27:00 +02:00
Roderick van Domburg
7cd1b7a26a
Merge branch 'dev' into new-api-client 2021-06-26 00:14:20 +02:00
Roderick van Domburg
7d27b94cfb
Document new unknown packet 0xb6 2021-06-25 23:56:17 +02:00
Roderick van Domburg
e58934849f
Fix clippy warnings 2021-06-23 21:43:23 +02:00
Roderick van Domburg
aa4cc0bee6
Ignore known but unused packets 2021-06-23 21:26:52 +02:00
Roderick van Domburg
12365ae082
Fix comment 2021-06-22 23:58:35 +02:00
Roderick van Domburg
0703630041
Use PacketType instead of hex identifiers 2021-06-22 23:57:38 +02:00
Roderick van Domburg
4fe1183a80
Fix compilation on Rust 1.48 2021-06-22 21:54:50 +02:00
Roderick van Domburg
d3074f597a
Remove keymaster and update example 2021-06-22 21:49:36 +02:00
Roderick van Domburg
3a7843d049
Fix refilling with proxies and a race condition 2021-06-22 21:39:38 +02:00
Roderick van Domburg
eee79f2a1e
Introduce caching ApResolver component 2021-06-21 23:49:37 +02:00
Roderick van Domburg
b6357a27a5
Store token_type and simplify scopes argument 2021-06-21 23:48:53 +02:00
Roderick van Domburg
15628842af
Introduce HTTP client 2021-06-20 23:09:27 +02:00
Roderick van Domburg
ce4f8dc288
Remove superfluous status check 2021-06-20 20:45:15 +02:00
Roderick van Domburg
e1e265179f
Document known token scopes 2021-06-20 20:40:33 +02:00
Roderick van Domburg
850db43254
Add token provider 2021-06-19 23:46:48 +02:00
Roderick van Domburg
6244515879
Resolve dealer and spclient access points (#795) 2021-06-10 22:24:40 +02:00
Roderick van Domburg
7c975f8ed0
Remove feature gate around apresolve 2021-06-01 20:43:23 +02:00
Roderick van Domburg
ad19b69bfb
Various code improvements (#777)
* Remove deprecated use of std::u16::MAX
* Use `FromStr` for fallible `&str` conversions
* DRY up strings into constants
* Change `as_ref().map()` into `as_deref()`
* Use `Duration` for time constants and functions
* Optimize `Vec` with response times
* Move comments for `rustdoc` to parse
2021-05-31 22:32:39 +02:00
johannesd3
3be50fd90f
Corrected documentation 2021-05-27 17:20:49 +02:00
Johannesd3
7ed35396f8
Mostly cosmetic changes in dealer (#762)
* Add missing timeout on reconnect

* Cosmetic changes
2021-05-27 15:33:29 +02:00
johannesd3
049bcf616f
Fix integer overflow in spotify_id 2021-05-27 15:29:36 +02:00
johannesd3
14c1779056
Adjust arg types of Credentials::with_blob
... to avoid redundant utf-8 checking
2021-05-26 21:52:36 +02:00
Roderick van Domburg
3a2455d686
Merge branch 'dev' into log-volume-ctrl-optimisations 2021-05-26 20:50:42 +02:00
Roderick van Domburg
d8ec98015c
Merge pull request #673 from Johannesd3/discovery-crate
Create separate discovery crate
2021-05-26 20:21:43 +02:00
johannesd3
1ade02b7ad
Add basic websocket support 2021-05-26 16:51:13 +02:00
Johannesd3
28dd842e05 Fix bug in MercurySender 2021-05-24 16:31:34 +02:00
Roderick van Domburg
eca505c387
Improve volume controls
This is a squashed commit featuring the following:

Connect:
- Synchronize player volume with mixer volume on playback
- Fix step size on volume up/down events
- Remove no-op mixer started/stopped logic

Playback:
- Move from `connect` to `playback` crate
- Make cubic volume control available to all mixers with `--volume-ctrl cubic`
- Normalize volumes to `[0.0..1.0]` instead of `[0..65535]` for greater precision and performance (breaking)
- Add `--volume-range` option to set dB range and control `log` and `cubic` volume control curves
- Fix `log` and `cubic` volume controls to be mute at zero volume

Alsa mixer:
- Complete rewrite (breaking)
- Query card dB range for the `log` volume control unless specified otherwise
- Query dB range from Alsa softvol (previously only from hardware)
- Use `--device` name for `--mixer-card` unless specified otherwise
- Fix consistency for `cubic` between cards that report minimum volume as mute, and cards that report some dB value
- Fix `--volume-ctrl {linear|log}` to work as expected
- Removed `--mixer-linear-volume` option; use `--volume-ctrl linear` instead
2021-05-24 15:53:32 +02:00
Johannesd3
ebea5397b9
Add librespot-discovery crate 2021-05-19 21:05:19 +02:00
johannesd3
68818758a2
Add timeout to test 2021-05-18 15:17:30 +02:00
johannesd3
041f084d7f Fix warnings 2021-05-13 22:42:55 +02:00
johannesd3
1c62af9160
Unpin protobuf version 2021-05-08 22:09:37 +02:00
Sasha Hilton
3cd5ef32c4 Merge branch 'dev' 2021-05-04 13:16:39 +01:00
Sasha Hilton
7570241d86 Change wildcard env_logger dependency to version 0.8 2021-05-04 13:16:16 +01:00
Sasha Hilton
2ef3928691 Update version numbers to 0.2.0 2021-05-04 13:05:13 +01:00
johannesd3
1681574846
Bump hmac and pbkdf2 2021-05-01 10:53:14 +02:00
johannesd3
ddf41a49f2
Update lower version bound for some deps 2021-05-01 10:40:52 +02:00
Sasha Hilton
9d5ac1b156
Merge pull request #699 from Johannesd3/ready-macro
Use `ready!` macro to reduce boilerplate
2021-05-01 01:25:14 +01:00
johannesd3
de6bc32dea
Add documentation, logging and tests 2021-04-21 11:29:32 +02:00
johannesd3
e9dc9cd839
Add size limit to cache 2021-04-21 11:29:08 +02:00
johannesd3
7d6267c0a2
Use ready macro to reduce boilerplate 2021-04-17 12:23:24 +02:00
johannesd3
4c2fc61d64 Better joining of session tasks 2021-04-12 22:54:32 +02:00
johannesd3
690e0d2e10 Add simple tests to librespot-core
The first test checks whether apresolve works. A second test tries
to create a Spotify sessions with fake credentials and asserts that
an error is returned.
2021-04-10 12:50:30 +02:00
johannesd3
e688e7e886 Almost eliminate util module 2021-04-10 12:50:30 +02:00
johannesd3
9378ae5b6f Bump num-bigint dependency 2021-04-09 22:39:51 +02:00
johannesd3
11ce29077e Fix formatting 2021-04-09 10:45:48 +02:00
johannesd3
7c3d89112d Fix clippy warnings 2021-04-09 10:45:43 +02:00
johannesd3
f5274f5ada Merge branch 'dev' into tokio_migration 2021-04-09 10:39:06 +02:00
Ash
d4dfd4890f
Merge pull request #674 from Johannesd3/proxy-support
[Tokio migration] Add back hyper-proxy
2021-03-29 21:00:18 +02:00
johannesd3
95fedf5357 Add back hyper-proxy 2021-03-27 15:36:33 +01: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
johannesd3
5616004dbe Fix many clippy lints
...and other small improvements
2021-03-10 22:41:44 +01:00
Evan Cameron
6a33eb4efa
minor cleanup 2021-02-28 21:54:19 -05:00
Ash
56f1fb6dae
Merge pull request #595 from Johannesd3/const_versions
Replace version functions by constants
2021-02-26 10:47:44 +01:00
johannesd3
f22b41956f Update url crate to 2.1 2021-02-23 22:22:53 +01:00
johannesd3
18179e73ec Remove unused dependencies and fix feature flags 2021-02-23 22:22:53 +01:00
johannesd3
27f308b82f Replace error_chain by thiserror 2021-02-23 22:22:52 +01:00
johannesd3
10827bd6a8 Clean up dependencies of librespot-core
* Use sub-crates of future
* Remove unnecessary pin-project
* Removed unused crates and features
* Replace futures channels by tokio channels
* Use serde's "derive" feature flag instead of serde_derive
2021-02-23 22:22:51 +01:00
johannesd3
8cff10e983 Put apresolve behind feature flag 2021-02-23 22:22:51 +01:00