Commit graph

174 commits

Author SHA1 Message Date
Roderick van Domburg c1965198fc
Move DeviceType to core 2022-01-06 09:48:11 +01:00
Roderick van Domburg cc9a574b2e
Move ConnectConfig to connect 2022-01-05 21:15:19 +01:00
Roderick van Domburg 7921f23927
Improve format handling and support MP3
- Switch from `lewton` to `Symphonia`. This is a pure Rust demuxer
  and decoder in active development that supports a wide range of
  formats, including Ogg Vorbis, MP3, AAC and FLAC for future HiFi
  support. At the moment only Ogg Vorbis and MP3 are enabled; all
  AAC files are DRM-protected.

- Bump MSRV to 1.51, required for `Symphonia`.

- Filter out all files whose format is not specified.

- Not all episodes seem to be encrypted. If we can't get an audio
  key, try and see if we can play the file without decryption.

- After seeking, report the actual position instead of the target.

- Remove the 0xa7 bytes offset from `Subfile`, `Symphonia` does
  not balk at Spotify's custom Ogg packet before it. This also
  simplifies handling of formats other than Ogg Vorbis.

- When there is no next track to load, signal the UI that the
  player has stopped. Before, the player would get stuck in an
  infinite reloading loop when there was only one track in the
  queue and that track could not be loaded.
2022-01-03 00:13:28 +01:00
Roderick van Domburg 2d699e288a
Follow autoplay client setting 2022-01-01 20:23:21 +01:00
Roderick van Domburg 0fdff0d3fd
Follow client setting to filter explicit tracks
- Don't load explicit tracks when the client setting forbids them

 - When a client switches explicit filtering on *while* playing
   an explicit track, immediately skip to the next track
2021-12-30 23:50:28 +01:00
Roderick van Domburg e51f475a00
Further initial loading improvements
This should fix remaining cases of a client connecting, and failing
to start playback from *beyond* the beginning when `librespot` is
still loading that track.

This undoes the `suppress_loading_status` workaround from #430,
under the assumption that the race condition reported there has
since been fixed on Spotify's end.
2021-12-29 22:27:31 +01:00
Roderick van Domburg 332f9f04b1
Fix error hitting play when loading
Further changes:

 - Improve some debug and trace messages

 - Default to streaming download strategy

 - Synchronize mixer volume on loading play

 - Use default normalisation values when the file position isn't
   exactly what we need it to be

 - Update track position only when the decoder reports a
   successful seek
2021-12-28 23:46:37 +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 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 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 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
JasonLG1979 3016d6fbdb Guard against tracks_len being zero
to prevent 'index out of bounds: the len is 0 but the index is 0'
https://github.com/librespot-org/librespot/issues/226#issuecomment-971642037
2021-11-17 21:15:35 -06:00
Roderick van Domburg 0e6b1ba9dc
Update version numbers to 0.3.1 2021-10-24 20:12:33 +02:00
Roderick van Domburg 8ab5a94451
Merge pull request #859 from roderickvd/fix-album-play
Fix behavior after last track of an album/playlist

Partly fixes: #434
2021-10-13 20:33:57 +02:00
Sasha Hilton 6a3377402a Update version numbers to 0.3.0 2021-10-13 15:10:18 +01:00
Roderick van Domburg 0f5d610b4b
Revert 10 track history window 2021-10-06 21:21:03 +02:00
Roderick van Domburg 289b4f9bcc
Fix behavior after last track of an album/playlist
* When autoplay is disabled, then loop back to the first track
   instead of 10 tracks back. Continue or stop playing depending
   on the state of the repeat button.

 * When autoplay is enabled, then extend the playlist *after* the
   last track. #844 broke this such that the last track of an album
   or playlist was never played.

Fixes: #434
2021-10-05 22:08:26 +02:00
Roderick van Domburg 949ca4fded
Add and default to "auto" normalisation type (#844) 2021-09-20 19:22:02 +02:00
Roderick van Domburg b016b69772
Fix clippy warnings 2021-09-01 21:25:32 +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
Roderick van Domburg 3a2455d686
Merge branch 'dev' into log-volume-ctrl-optimisations 2021-05-26 20:50:42 +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 9b6ba49026
Add "discovery" compat layer to "connect" 2021-05-19 21:09:38 +02:00
Johannesd3 ebea5397b9
Add librespot-discovery crate 2021-05-19 21:05:19 +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 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 6077a1ef4e
Remove unused block-modes dep 2021-05-01 10:41:39 +02:00
johannesd3 ddf41a49f2
Update lower version bound for some deps 2021-05-01 10:40:52 +02:00
Sasha Hilton 9a75ca195e Update spirc shuffle command for tokio migration 2021-05-01 01:48:42 +01:00
Sasha Hilton 617b3b72b7
Merge pull request #666 from jackvstrickland/dev
Add shuffle command and command handling
2021-05-01 01:20:03 +01:00
johannesd3 b7350b71da Restore previous feature flags
Some of the feature flags librespot uses are not really additive but
rather mutual exclusive. A previous attempt to improve the situation
had other drawbacks, so it's better to postpone a decision and restore
the old behaviour.
2021-04-10 12:50:30 +02:00
johannesd3 e688e7e886 Almost eliminate util module 2021-04-10 12:50:30 +02:00
johannesd3 7ddb1a20bb Reuse librespot-core's Diffie Hellman in discovery 2021-04-09 22:39:47 +02:00
johannesd3 f5274f5ada Merge branch 'dev' into tokio_migration 2021-04-09 10:39:06 +02:00
johannesd3 059b9029de Remove redundant field names 2021-03-10 22:41:46 +01:00
johannesd3 5616004dbe Fix many clippy lints
...and other small improvements
2021-03-10 22:41:44 +01:00
Jack Strickland eb4dacbc59 Add shuffle command and command handling 2021-03-09 15:37:11 -06: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 59c556635e Clean up librespot-connect dependencies 2021-02-23 22:22:53 +01:00