Commit graph

110 commits

Author SHA1 Message Date
Roderick van Domburg 7a01a3e442
Merge pull request #1089 from GeorgeHahn/microsecond-timestamps
Handle microsecond timestamps
2023-01-04 20:37:56 +01:00
George Hahn ce4be71719 fix timestamp heuristic (year 2200+) 2023-01-03 22:39:07 -07:00
George Hahn 512c799266 Handle microsecond timestamps 2023-01-03 22:26:58 -07:00
Guillaume Desmottes 7f2cb684c9 fix clippy warnings 2023-01-03 00:36:35 +01:00
Guillaume Desmottes f72048e5e1 metadata: add lyrics
Save users from doing all the parsing themselves.
2023-01-02 19:00:10 +01: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 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
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 2a79af1f0a
Migrate to Rust 2021 2022-08-02 21:42:38 +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 4980650b3d
Merge pull request #1018 from eladyn/more_metadata
Include more metadata in Track struct
2022-08-01 21:49:43 +02:00
sqozz d09ee4206c Add minimum rust version 2022-08-01 15:14:17 +02:00
Roderick van Domburg 9f0185eb42
Merge branch 'dev' into more_metadata 2022-08-01 11:29:52 +02:00
Daniel M e7348db17c Default for vec / hashmap wrappers in metadata
- Derive `Default` trait for the vec / hashmap wrapper types in
  `librespot-metadata`
- The wrapped types (`Vec` / `Hashmap`) implement Default, so the
  wrapper types should as well
2022-08-01 00:44:43 +02:00
eladyn c0fc35fd18
Include more metadata in track struct
Based on changes from @capnfabs.
2022-07-31 11:56:14 +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
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
Roderick van Domburg dff19377fa
Update version numbers to 0.4.0 2022-05-21 22:31:15 +02:00
Jason Gray 47f1362453
Port remove unsafe code and catch up with dev (#956) 2022-02-14 12:15:19 +01:00
Jason Gray ceebb374f0
Remove unsafe code (#940)
Remove unsafe code
2022-01-23 19:02:04 +01:00
Roderick van Domburg 0de55c6183
Merge branch 'dev' into new-api 2022-01-14 23:42:18 +01:00
Roderick van Domburg dbeeb0f991
Switch from chrono to time 2022-01-14 23:28:09 +01:00
Roderick van Domburg 59d00787c9
Update player crates and transitive dependencies 2022-01-09 16:04:53 +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 5cc3040bd8
Update futures 2022-01-08 21:21:31 +01:00
Roderick van Domburg d5a4be4aa1
Optimize fallback sample buffer size 2022-01-04 00:50:45 +01:00
Roderick van Domburg 096269c1d0
Reintroduce offset for passthrough decoder 2022-01-03 22:20:29 +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 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 2af34fc674
Add product metrics to requests 2021-12-30 22:36:38 +01:00
Roderick van Domburg 62461be1fc
Change panics into Result<_, librespot_core::Error> 2021-12-26 21:18:42 +01:00
Roderick van Domburg 2f7b9863d9
Implement CDN for audio files 2021-12-16 22:42:37 +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 40163754bb
Update protobufs to 1.1.73.517 2021-12-10 20:33:43 +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 87f6a78d3e
Fix examples 2021-12-07 23:52:34 +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
Roderick van Domburg f037a42908
Migrate and expand playlist protos 2021-11-27 11:59:22 +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