Fix up for #886Closes: #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.
* 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
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).
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.
* 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.