Commit graph

484 commits

Author SHA1 Message Date
Evan Cameron
3388508141
use current_thread 2021-02-28 22:09:46 -05: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
b606d8c661 Replace "extern crate"s 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
d064ffc670 Use tokio channels and fix compilation errors 2021-02-23 22:22:53 +01:00
johannesd3
9253be7bc9 Small refactor of librespot-core
* Remove default impl for `SessionConfig`
* Move util mod to single file
* Restore privacy of mods
* Move `fn get_credentials` to application
* Remove `extern crate` statements
2021-02-23 22:22:51 +01:00
johannesd3
678d1777fd Merge branch 'dev' into tokio_migration 2021-02-23 22:22:49 +01:00
Sasha Hilton
4beb3d5e60 Add version string CLI parameter, set name to optional parameter, default to 'librespot' 2021-02-23 18:35:57 +00:00
Philippe G
34bc286d9b ogg passthrough
rename
2021-02-22 13:45:53 -08:00
johannesd3
220061e158 Migrate application to tokio 1.0 2021-02-21 17:05:36 +01:00
johannesd3
daf7ecd23a Migrate librespot-connect to tokio 1.0 2021-02-21 14:09:31 +01:00
Johannes Dertmann
c8e45ab690 Modified startup message 2021-02-17 15:13:57 +01:00
johannesd3
872fab62d8 Merge branch 'dev' into tokio_migration 2021-02-10 21:51:33 +01:00
johannesd3
09e506ed66 Replace version functions by constants 2021-02-09 19:42:56 +01:00
Sasha Hilton
84ba421818
Merge pull request #566 from xou816/fix/map-auth-errors
fix: map authentication errors to a custom error type
2021-02-06 02:54:11 +00:00
Alexandre Trendel
71e9295ee8 fix: map authentication errors to a custom error type 2021-02-05 14:26:32 +01:00
Sasha Hilton
632894a13e
Merge pull request #526 from marcelbuesing/align-player-events
Align PLAYER_EVENT naming
2021-02-05 04:25:43 +00:00
Sasha Hilton
24486c8c83
Merge pull request #573 from librespot-org/album-normalisation
Add option to choose between track or album normalisation gain
2021-02-05 04:19:09 +00:00
Sasha Hilton
318c499dc5 Change opt message to reflect default selection accurately. 2021-01-30 02:31:16 +00:00
johannesd3
fd1f049572 Removed volume struct 2021-01-25 10:52:06 +01:00
johannesd3
fa5c9f7d11 Made locations in cache optional
The locations of credentials, volume and audio are now stored
in three separate Optional<PathBuf>s.
Removed the clearing of the cache if an error occurs. This might
be added again later.
2021-01-25 10:48:14 +01:00
johannesd3
14a004f84c Refactored Cache
Proper error handling, and moving the conversion between
{ credentials, volume } and file into the cache module
2021-01-25 10:47:42 +01:00
johannesd3
91d7d0422b Preparing main crate for testing 2021-01-25 09:04:47 +01:00
johannesd3
fe37186804 Make librespot_playback work 2021-01-25 09:04:33 +01:00
Sasha Hilton
efabb03631 Fix incorrect cache initialisation causing crash on startup 2021-01-24 23:21:35 +00:00
Sasha Hilton
37a5796a86 Add option to choose between track or album normalisation gain, default album. 2021-01-21 19:16:05 +00:00
Sasha Hilton
414383db18
Merge pull request #506 from LaurentLouf/feature-split_cache_folders
Feature split cache folders, resolves #505
2021-01-02 23:17:33 +00:00
maxthiel
2f7bf54076 Add a preload event to warn about new track coming soon 2020-12-10 21:17:41 +00:00
marcelbuesing
a3774632a0
Align PLAYER_EVENT naming 2020-09-25 16:11:30 +02:00
ashthespy
3dfad7f788 Implement mapped volume for alsa mixer 2020-07-29 15:59:45 +01:00
Laurent Louf
c14c254c6b Format 2020-07-26 16:11:32 +02:00
Laurent Louf
09bebe5dd7 Fix types 2020-07-25 13:51:45 +02:00
Laurent Louf
77cb66d9a3 Fix syntax 2020-07-25 13:51:34 +02:00
Ash
f0b3b2c7e8
Refactor Volume control, allow for a fixed volume option (#447)
Refactored the old `--linear-volume` flag to a more generic `--volume-ctrl` flag that takes the options of `[linear, log, fixed]`. It defaults as previously to log.
2020-07-25 09:38:08 +02:00
Laurent Louf
8fc9ebfa8c Add the option to specify the system cache for credentials and volume files and adapt Cache to use two cache directories instead of one 2020-07-24 23:18:29 +02:00
Sasha Hilton
6eabf4a75c
Merge pull request #449 from kaymes/blocking_sink_events
Add blocking SinkActive|SinkInactive events
2020-07-24 03:07:38 +01:00
Anton Voyl
0aa9bc60e3
Merge pull request #452 from kaymes/improved_events
Add more data to player events and fire more of them
2020-05-11 08:57:18 +02:00
Ash
e47ae83f33
libmdns housekeeping (#467)
* Rename log hooks (mdns-> libmdns)

* Bump libmdns
2020-05-10 13:22:19 +02:00
v1ne
ed0e1eed5a
Synchronise name and help: softvol (#470)
Using "softmixer" as a mixer backend does not work.

Co-authored-by: v1ne <v1ne2go@gmail.com>
2020-05-02 12:14:53 +02:00
Konstantin Seiler
223b8d611e Roll back the meta data processing. 2020-03-20 17:31:18 +11:00
Konstantin Seiler
b562ec6015 rename variable. 2020-03-12 23:29:24 +11:00
Konstantin Seiler
c9117542eb Refactor TrackMetaData in the player and add the metadata to the player events.
Fire more events in the --onevent script and set more variables.
2020-03-12 23:01:45 +11:00
Konstantin Seiler
667e559340 Merge remote-tracking branch 'origin/dev' into blocking_sink_events 2020-03-10 23:52:20 +11:00
Konstantin Seiler
6f28b0486f Emit blocking sink events 2020-03-10 23:26:01 +11:00
Ash
ef27b4bce3
Disable gapless playback via runtime flag (#444)
* Enable gapless playback via runtime flag

* Set gapless playback as default, use `--disable-gapless` to turn it off

* Ensure sink restarts b/w tracks when gapless is disabled
2020-03-10 13:00:57 +01:00
Sasha Hilton
b86c317ac9
Merge pull request #435 from Malvineous/patch-1
Allow use of HTTP proxies listening on port 80
2020-02-27 02:14:49 +00:00
Adam Nielsen
63cc846a10
Allow use of HTTP proxies listening on port 80
Since port 80 is the default port for the HTTP protocol, `url.port()` returns `None`, causing an "invalid proxy" message.  Using `port_or_known_default()` will only return `None` if the both the port has been omitted and an unknown protocol has been specified.
2020-02-16 18:52:09 +10:00
Konstantin Seiler
18d1181bf5 Clean up some code
Ensure the player events are emitted correctly.
Only call the external script on events we want to notify about.
Stop sink when loading to pause.
cargo fmt
2020-02-03 18:58:44 +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
Konstantin Seiler
37f6e3eb9c Print error message on connection failure. 2020-01-29 09:51:26 +11:00
Konstantin Seiler
65d1c1bf8e Proper error handling when connecting to the server. 2020-01-29 09:45:06 +11:00
Sasha Hilton
e9c3357e41 Run cargo fmt 2020-01-24 02:26:16 +01:00
Sasha Hilton
cdcb919c08
Merge branch 'dev' into connection-lost-crash 2020-01-24 01:02:40 +01:00
Konstantin Seiler
a52092e094 Convert another panic to error handling.
Compatibility fix for Rust 1.33.
2020-01-24 10:12:16 +11:00
Konstantin Seiler
0e22678a28 Workaround for Rust 1.33 borrow checker. 2020-01-23 21:10:55 +11:00
Konstantin Seiler
dadab486d2 Don't exit if too many spirc failures. 2020-01-23 19:51:09 +11:00
Konstantin Seiler
f26db01110 Rate-limit automatic re-connection attempts when spirc shuts down. 2020-01-23 19:32:06 +11:00
Konstantin Seiler
719943aec9 Don't panic if spirc terminates prematurely.
Instead attempt to reconnect and wait for new client connections.
2020-01-23 01:24:59 +11:00
Konstantin Seiler
b6c676ad60 Prevent librespot from panicking if server connection is lost. 2020-01-22 21:55:45 +11:00
marcelbuesing
38d82f2dc2
Rerun rustfmt on full codebase 2020-01-17 18:47:30 +01: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
ashthespy
b3c9744b29 Add a autoplay option flag 2019-11-05 20:34:43 +01:00
Ash
25107ee796 Revert "Fix play.rs example (#379)"
This reverts commit 2ff71abb8e.
2019-10-09 18:05:08 +02:00
Gilles Castel
2ff71abb8e Fix play.rs example (#379)
Fix `play.rs` example by renaming `core` to `librespot_core`
2019-10-09 10:44:20 +02:00
George Hahn
6e280b3c88 Upgrade dependencies 2019-07-17 22:08:15 -05:00
Tristan Stenner
37eca2fab3 Update env_logger to 0.6 2019-05-03 07:40:13 +02:00
ashthespy
cc6c9b2dc4 More alsa stragglers 2019-03-22 00:00:58 +01:00
ashthespy
0e1147077c Add run time option flags for AlsaMixer
Add `Cargo.lock` for Travis
2019-03-22 00:00:57 +01:00
ashthespy
a67048c3d7 Add initial support for alsamixer 2019-03-22 00:00:14 +01:00
Will Stott
b81bdca707 QDH: Instantiate audio backend immediately when using "--device ?". 2019-03-20 13:16:29 +00:00
Artyom Pavlov
391b9c69c4
Merge branch 'master' into master 2019-03-15 16:32:54 +00:00
Nick Steel
6a600596e8 main: exit librespot after the first ctrl+c if no currently active spirc session. 2019-03-13 18:47:56 +00:00
Artyom Pavlov
772591576a
Merge branch 'master' into master 2018-12-06 09:38:33 +00:00
ruben
81e7c9b9d3 Changed TRACK_ID from base16 to base62 so that it is equal with the official Spotify app 2018-11-04 18:41:33 +01:00
William R. Fraser
9fa138a116 implement using tokio-process instead 2018-10-16 02:34:56 -07:00
William R. Fraser
eaac599ce3 reap the exit statuses from 'onevent' child processes 2018-10-16 00:24:33 -07:00
newpavlov
e4677027d2 replace rust-crypto's hashes, HMAC and PBKDF2 2018-07-23 16:41:39 +03:00
Harold
4fb3d5f271 Add ap-port option to specify preferred port 2018-07-03 13:09:22 +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
Reinier Balt
deb240c02f reverse #212 since it does not address the real problem (#213) 2018-05-01 21:39:49 +02:00
Reinier Balt
6a4e9e8bec return from Main loop on Ctrl-C/shutdown 2018-04-30 14:22:45 +02:00
Johan Anderholm
3a14e9a6be Validate proxy urls better.
Use the url crate to handle proxies to make sure they conform to a
proper format.
2018-03-24 08:45:43 +00:00
Johan Anderholm
3bdc5e0073 Add support for http proxy
Currently only http proxy (no https) is supported.
2018-03-24 08:45:43 +00:00
Johan Anderholm
612978908f Reformat according to new rustfmt rules 2018-03-24 08:45:43 +00:00
thekr1s
d6b82cd732 revert file mode to original mode 2018-03-14 23:19:49 +01:00
thekr1s
b1f2a412ad fir rustfmt issues 2018-03-11 13:34:30 +01:00
thekr1s
b3966b0e08 Add optional linear volume contol 2018-03-11 11:27:28 +01:00
Sasha Hilton
237ef1e4f9 Format according to rustfmt 2018-02-26 02:50:41 +01:00
Sasha Hilton
084646e21b Use prompt for password in main.rs 2018-02-25 05:40:00 +01:00
Sasha Hilton
bde157fad7
Merge branch 'master' into events-on-prev-next 2018-02-24 20:16:28 +01:00
Sasha Hilton
eed2bb6938
Merge pull request #162 from librespot-org/normalisation
Add volume normalisation support
2018-02-24 18:54:03 +01:00
Anton Voyl
58ea1baa98 Issue 130 (#164)
* Core API: device_id

* Core API: u128
2018-02-24 16:34:04 +01:00
Sasha Hilton
f8db550e5e Add volume normalisation support 2018-02-23 20:08:20 +01:00
Simon Persson
23d3c1593f Just spawn event handlers, don't wait for exit code. 2018-02-20 23:17:06 +01:00
Simon Persson
93af49aadf Send player event messages over futures aware channel. 2018-02-20 23:12:29 +01:00
Simon Persson
2eb4aa61d3 Use single program on events, and pass events in envars. 2018-02-20 22:45:14 +01:00
Simon Persson
1b943d069f Move PlayerEvent into player. 2018-02-20 21:57:42 +01:00
Simon Persson
b0ee03112f First attempt at a better playback event system. 2018-02-16 00:16:38 +01:00
Sasha Hilton
17d39dffa9 Make backtrace var conditional 2018-02-13 16:46:10 +01:00
Sasha Hilton
67dabcdd8e Enable backtrace on all builds 2018-02-13 14:02:37 +01:00
Sasha Hilton
60996d108e Update device usage instructions 2018-02-13 02:35:59 +01:00
Sasha Hilton
90ae9d713d Fix conflicts from PR #143 2018-02-12 01:12:02 +01:00
awiouy
d900134114 connect: discovery and spirc 2018-02-11 23:55:41 +01:00
awiouy
191caca518 core API: move Bitrate and PlayerConfig from core to playback 2018-02-11 23:55:41 +01:00
Michael Herger
5ed4639cca Remove the -z as an alias for the --zeroconf-port parameter 2018-02-11 06:32:07 +01:00
Michael Herger
12487966b2 Somewhat uniform coding style might help myself to better understand Rust :-) 2018-02-11 06:32:07 +01:00
Sasha Hilton
f3bb85c33a
Merge pull request #137 from awiouy/core_API
core API review changes.
2018-02-10 23:14:41 +01:00
awiouy
77882836ce core API: move now_ms to spirc.rs 2018-02-10 17:58:15 +01:00
Nick Steel
d05fa10067 Improved next/prev handling for queued tracks.
1) A queued track is removed once it has become the current track.
   Note that the track doesn't need to actually play i.e. it could
   have been immediately skipped over with 'next()'. This is
   implemented in 'consume_queued_track()'.

2) Queued tracks are always positioned immediately after the current
   track. 1) ensures this is true for 'next()' but 'prev()' requires
   all the queued tracks are actually moved for this to remain the
   case.

Also fixed the case where 'prev()' on the first track would incorrectly
wrap back around to the last track even when repeat was disabled. The
correct behaviour is to remain on the first track and just seek to the
start.

For example, with the following tracks and repeat enabled:

TrackA, TrackB, TrackC-Q, TrackD-Q, TrackE
        ^^^^^^

Here, the result of 'prev' changes the current track from TrackB to
TrackA and the queued tracks (TrackC, TrackD) move to the position
immediately after TrackA:

TrackA, TrackC-Q, TrackD-Q, TrackB, TrackE
^^^^^^

Calling 'prev' again results in the current track wrapping back around
to TrackE and the queued tracks moving after that same track:

TrackA, TrackB, TrackE, TrackC-Q, TrackD-Q
                ^^^^^^
2018-02-10 15:17:30 +00:00
Sasha Hilton
1fb65354b0 Move audio backends into seperate crate 2018-02-09 02:05:50 +01:00
awiouy
e3516ebd9b Move discovery to its own module. 2018-02-08 04:03:53 +01:00
Sasha Hilton
7ead896ae7
Merge pull request #122 from librespot-org/keymaster
Move keymaster to core
2018-02-07 17:50:45 +01:00
Sasha Hilton
53fab4dc86
Merge pull request #11 from thekr1s/alsa-open-crash
Prevent crash in audio_backend/alsa.rs when switching from Kodi audio…
2018-02-07 15:08:52 +01:00
Sasha Hilton
cfa7a62dfc Re-add serde_derive to lib.rs 2018-02-07 15:07:01 +01:00
Sasha Hilton
6a442a4570 Move keymaster to core 2018-02-06 19:54:28 +01:00
Robert
b03430a057 minor code cleanup 2018-02-05 00:33:17 +01:00
Sasha Hilton
977a6db3ef
Merge pull request #116 from librespot-org/jackaudio
Jackaudio Support. Closes #93.
2018-02-04 20:23:16 +01:00
awiouy
2ae1f1399f simplify dns-sd/mdns code 2018-02-02 19:53:08 +01:00
Sasha Hilton
407e23b311
Merge branch 'master' into jackaudio 2018-02-02 05:12:36 +01:00
Sasha Hilton
f35f52cbf9 Remove redundant code 2018-02-02 05:03:59 +01:00
Sasha Hilton
932441db45
Merge pull request #112 from librespot-org/feature_dns
Feature flag for selecting dns service
2018-01-31 21:51:59 +01:00
Sasha Hilton
7a58e6d561 fix addr in wrong place 2018-01-31 12:08:23 +01:00
Sasha Hilton
d923f3bad3 Add with-dns-sd feature flag 2018-01-31 12:00:53 +01:00
Colm
8be642de31
Merge pull request #110 from librespot-org/inital-volume-ifelse-cleanup
Initial volume ifelse cleanup
2018-01-30 23:38:36 +00:00
Sasha Hilton
fddcbbcd82 Tidied up Syntax 2018-01-31 00:05:54 +01:00
Sasha Hilton
3efe499737
Merge pull request #109 from librespot-org/zeroconf_port
Add zeroconf-port option
2018-01-30 23:19:29 +01:00
ComlOnline
618eceb740 lost iv - due to previous 2018-01-30 21:46:57 +00:00
ComlOnline
46de5a704b Thats what I get for copypasta 2018-01-30 21:30:37 +00:00
ComlOnline
863ea9c976 removed and optimised 2018-01-30 20:52:25 +00:00
Sasha Hilton
8e8bab03d5 Add zeroconf-port option 2018-01-30 21:38:54 +01:00
thekr1s
63755aae46 Merge branch 'master' into alsa-open-crash 2018-01-30 18:53:11 +01:00
Sasha Hilton
91647ab2dd
Merge pull request #10 from thekr1s/progressive-voume-control
Change volume control to implement logarithmic scaling.
2018-01-30 17:38:40 +01:00
Robert
bec6b8c512 Changed volume control after discussion: https://github.com/librespot-org/librespot/pull/10
implement exponential volume control only
2018-01-29 23:39:55 +01:00
Robert
752a6b1df4 Prevent crash in audio_backend/alsa.rs when switching from Kodi audio to librespot 2018-01-26 01:42:24 +01:00
Robert
4870acd572 Add --progressive-volume option. Increase volume slowly at low level, faster at higher level 2018-01-25 23:37:28 +01:00
Thomas Bächler
2465b0f57f Refactor the discovery module to remove usage of deprecated functions 2018-01-25 23:23:45 +01:00
Thomas Bächler
d36017d6f0 Remove usage of deprecated tokio_core::io 2018-01-25 23:23:45 +01:00
Thomas Bächler
630de8c0a9 Use futures::sync::mpsc::UnboundedSender::unbounded_send() instead of the deprecated send() 2018-01-25 23:23:45 +01:00
Thomas Bächler
5237203899 Remove usage of deprecated BoxFuture, BoxStream and BoxSink 2018-01-25 23:23:45 +01:00
Thomas Bächler
644355269e Use futures::sync::oneshot::Sender::send() instead of the deprecated complete() 2018-01-25 23:23:45 +01:00
Colm
5302bd1072
Merge pull request #6 from brain0/work
Make librespot more robust against audio failures
2017-12-19 21:46:22 +00:00
Thomas Bächler
4cda8affcd Handle audio sink errors in the player
Failing to open or write to the audio sink is not necessarily a fatal and permanent error.
When the audio sink fails, the player now tries to restart the sink periodically.
2017-12-18 00:56:37 +01:00
Thomas Bächler
f250179fed Join the player thread when the player is dropped 2017-12-17 23:46:52 +01:00
Thomas Bächler
f5d8019c18 Add proper error handling to the pulseaudio backend and ensure that no invalid pointers are passed to pulseaudio 2017-12-17 23:28:42 +01:00
Thomas Bächler
35ec580eac Disable the "variable does not need to be mutable" compiler warning in generated code 2017-12-17 23:15:49 +01:00
fossedihelm
de2b4cc8e3 added comments and edited README 2017-12-07 11:36:26 +01:00
fossedihelm
94e4cd853a merge ColmOnline changes 2017-12-07 10:04:43 +01:00
fossedihelm
ac39da6c97 check if argument of initial-value is in the [0,100 range 2017-12-06 15:22:28 +01:00