Commit graph

1443 commits

Author SHA1 Message Date
Roderick van Domburg 92b8476645
Merge pull request #922 from JasonLG1979/cleanup_list_compatible_devices
Clean up `list_compatible_devices`
2022-01-03 22:32:22 +01:00
JasonLG1979 8dfa00d66f Clean up list_compatible_devices
Fix a typo and be a little more forgiving.
2022-01-01 17:19:12 -06:00
Roderick van Domburg 9202ec01d4
Merge pull request #920 from gdesmott/write-own
Sink: pass ownership of the packet on write()
2022-01-01 17:00:03 +01:00
Guillaume Desmottes f09be4850e Sink: pass ownership of the packet on write()
Prevent a copy if the implementation needs to keep the data around.
2021-12-31 13:46:35 +01:00
Roderick van Domburg b1bdf1d7f2
Merge pull request #916 from JasonLG1979/remove-last-unwraps-from-main
Remove `unwrap`s from main
2021-12-27 11:36:03 +01:00
JasonLG1979 1f43e9e389 Remove that last couple unwraps from main
Also:

* Don't just hang if Spirc shuts down too often.

* Replace the while loop with Vec retain.

* Be more explicit with the rate limit.
2021-12-26 17:45:06 -06:00
Roderick van Domburg 4370aa1cbe
Merge pull request #910 from JasonLG1979/fix-alsa-mixer-device
Fix auto fallback for --alsa-mixer-device and --alsa-mixer-index
2021-12-22 08:47:27 +01:00
JasonLG1979 305f80bdfd Fix auto fallback for --alsa-mixer-device and --alsa-mixer-index
As mentioned in https://github.com/librespot-org/librespot/issues/898#issuecomment-986528998
2021-12-21 19:29:35 -06:00
Roderick van Domburg e5fd7d6506
Merge pull request #899 from JasonLG1979/arg_parse_fixup
Fix incorrect verbose logging of command line options
2021-12-16 22:49:54 +01:00
Jason Gray 306096ee2a
Merge branch 'librespot-org:dev' into arg_parse_fixup 2021-12-15 12:28:09 -06:00
Roderick van Domburg 24e2c6da25
Merge pull request #907 from tomodachi/arm64
Add arm64 target example
2021-12-15 19:02:14 +01:00
Roderick van Domburg 1736e7c52b
Merge pull request #905 from roderickvd/fix-exit-on-decoder-error
Skip track on decoding error
2021-12-15 19:01:15 +01:00
Roderick van Domburg 1cd5f9e571
Merge pull request #896 from JasonLG1979/dynamic-alsa-buffer
Dynamic failable buffer sizing alsa-backend
2021-12-15 18:52:27 +01:00
JasonLG1979 d5efb8a620 Dynamic failable buffer sizing alsa-backend
Dynamically set the alsa buffer and period based on the device's reported min/max buffer and period sizes. In the event of failure use the device's defaults.

This should have no effect on devices that allow for reasonable buffer and period sizes but would allow us to be more forgiving with less reasonable devices or configurations.

Closes: https://github.com/librespot-org/librespot/issues/895
2021-12-14 16:49:09 -06:00
Mateusz Mojsiejuk 67836b5b02 Added arm64 target to docker run examples. Also removed
feature quotes as they're not nessesary and don't match
the non-quoted examples of targets in the WIKI
2021-12-14 21:23:13 +01:00
JasonLG1979 368bee1088 condense some option parsings 2021-12-13 18:43:28 -06:00
JasonLG1979 d29337c62d Dry up error messages. 2021-12-12 23:25:19 -06:00
Roderick van Domburg 8f23c3498f
Clean up warnings 2021-12-12 20:01:05 +01:00
Roderick van Domburg 79c4040a53
Skip track on decoding error 2021-12-12 12:56:02 +01:00
JasonLG1979 8c480b7e39 Fix Command line arguments incorrectly echoed in TRACE
Fix up for #886
Closes: #898

And...

* Don't silently ignore non-Unicode while parsing env vars.

* Iterating over `std::env::args` will panic! on invalid unicode. Let's not do that. `getopts` will catch missing args and exit if those args are required after our error message about the arg not being valid unicode.

* Gaurd against empty strings. There are a few places while parsing options strings that we don't immediately evaluate their validity let's at least makes sure that they are not empty if present.

* `args` is only used in `get_setup` it doesn't need to be in main.

* Nicer help header.

* Get rid of `use std::io::{stderr, Write};` and just use `rpassword::prompt_password_stderr`.

* Get rid of `get_credentials` it was clunky, ugly and only used once. There is no need for it to be a separate function.

* Handle an empty password prompt and password prompt parsing errors.

* + Other random misc clean ups.
2021-12-11 16:24:09 -06:00
Roderick van Domburg 7160dc1017
Merge pull request #897 from JasonLG1979/clippy-lints
Address clippy lint warnings from Rust 1.57
2021-12-03 20:07:56 +01:00
JasonLG1979 4370258716 Address clippy lint warnings for rust 1.57 2021-12-03 12:51:41 -06:00
Jason Gray e66cc5508c
parse environment variables (#886)
Make librespot able to parse environment variables for options and flags.

To avoid name collisions environment variables must be prepended with `LIBRESPOT_` so option/flag `foo-bar` becomes `LIBRESPOT_FOO_BAR`.

Verbose logging mode (`-v`, `--verbose`) logs all parsed environment variables and command line arguments (credentials are redacted).
2021-12-01 21:29:58 +01:00
Tom Vincent bbd575ed23
Harden systemd service, update restart policy (#888) 2021-11-26 19:49:50 +01:00
Roderick van Domburg 97399e2c0a
Merge pull request #883 from JasonLG1979/improve_device_list_outputs
Improve `--device ?` functionality for the alsa backend
2021-11-25 09:45:36 +01:00
JasonLG1979 c006a23644 Improve --device ? functionality for the alsa backend
This makes `--device ?` only show compatible devices (ones that support 2 ch 44.1 Interleaved) and it shows what `librespot` format(s) they support.

This should be more useful to users as the info maps directly to `librespot`'s `--device` and `--format` options.
2021-11-20 13:51:24 -06:00
Roderick van Domburg e064f27c13
Merge pull request #880 from JasonLG1979/fix_index_out_bounds_spirc
Guard against tracks_len being zero
2021-11-19 21:52:39 +01: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 85d6049ee7
Merge pull request #875 from JasonLG1979/refactor-main
Refactor main.rs
2021-11-17 22:44:22 +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
Roderick van Domburg 45b19efd03
Merge pull request #874 from JasonLG1979/kill-the-undead
Prevent librespot from becoming a zombie
2021-10-30 20:27:42 +02:00
JasonLG1979 24e4d2b636 Prevent librespot from becoming a zombie
Prevent hang when discovery is disabled and there are no credentials or when bad credentials are given.
2021-10-28 09:13:46 -05:00
Roderick van Domburg 5049cd76e0
Merge pull request #872 from JasonLG1979/add-disable-credential-cache-flag
Add disable credential cache flag
2021-10-28 15:18:34 +02:00
JasonLG1979 9e017119bb Address review change request 2021-10-27 14:47:33 -05:00
Jason Gray fefd432773
Merge branch 'librespot-org:dev' into add-disable-credential-cache-flag 2021-10-27 14:42:24 -05:00
Roderick van Domburg bd39a362f7
Merge pull request #873 from jannuary/patch-1
README: Mention Spot
2021-10-27 20:50:46 +02:00
JasonLG1979 e543ef72ed Clean up cache logic in main 2021-10-27 10:14:40 -05:00
Noëlle 81e7c61c17
README: Mention Spot 2021-10-27 20:03:14 +07:00
JasonLG1979 9152ca8159 Update changelog 2021-10-26 22:20:24 -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 b4784ebf9c
Merge pull request #871 from roderickvd/update-crates
Update crates
2021-10-26 21:40:58 +02:00
Roderick van Domburg 72b2c01b3a
Update crates 2021-10-26 20:10:39 +02:00
Roderick van Domburg c1ac4cbb3a
Update Cargo.lock for 0.3.1 2021-10-24 20:24:28 +02:00
Roderick van Domburg 0e6b1ba9dc
Update version numbers to 0.3.1 2021-10-24 20:12:33 +02:00
Roderick van Domburg 9d19841c0f
Prepare for 0.3.1 release 2021-10-24 20:07:11 +02:00
Roderick van Domburg f21c25a257
Merge pull request #869 from JasonLG1979/clarify-arg-descriptions
Improve command line option description grammar
2021-10-24 19:28:08 +02:00
JasonLG1979 a5c7580d4f Grammar Police the arg descriptions 2021-10-22 17:41:59 -05:00
Roderick van Domburg 6d127b46c6
Merge pull request #868 from roderickvd/smallrng-dither
Change hand-picked RNGs back to `SmallRng`
2021-10-21 21:45:13 +02:00
Roderick van Domburg ff3648434b
Change hand-picked RNGs back to SmallRng
While `Xoshiro256+` is faster on 64-bit, it has low linear complexity in the
lower three bits, which *are* used when generating dither.

Also, while `Xoshiro128StarStar` access one less variable from the heap,
multiplication is generally slower than addition in hardware.
2021-10-21 19:31:58 +02:00
Roderick van Domburg 4c89a721ee
Improve dithering CPU usage (#866) 2021-10-19 22:33:04 +02:00