Spotifyd / spotifyd

A spotify daemon
https://spotifyd.rs
GNU General Public License v3.0
9.89k stars 452 forks source link

Spotifyd crashes without specifying a volume_controller #294

Closed otahontas closed 5 years ago

otahontas commented 5 years ago

After building on macos 10.4.6. with portaudio as backend, launching spotifyd results next panic:

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:347:21

Running with RUST_BACKTRACE=1 shows next stack backtrace:

   0: std::panicking::default_hook::{{closure}}
   1: std::panicking::default_hook
   2: std::panicking::rust_panic_with_hook
   3: std::panicking::continue_panic_fmt
   4: rust_begin_unwind
   5: core::panicking::panic_fmt
   6: core::panicking::panic
   7: spotifyd::config::get_internal_config
   8: spotifyd::main
   9: std::rt::lang_start::{{closure}}
  10: std::panicking::try::do_call
  11: __rust_maybe_catch_panic
  12: std::rt::lang_start_internal
  13: main

I was able to build working version from source on August and after that I've only changed my rust installation from Homebrew version to rustup (guess that's not the problem here?). Any suggestions?

mainrs commented 5 years ago

Are you running Spotifyd without a config file?

Edit: Could you post the output when running with the verbose flag, e.g. RUST_BACKTRACE=1 spotifyd --verbose --no-daemon

Felixoid commented 5 years ago

Hey. I'm using arch linux and have the same issue with 0.2.13

>±> RUST_BACKTRACE=full spotifyd --no-daemon
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Custom("provided string was not `true` or `false`")', src/libcore/result.rs:999:5
stack backtrace:
   0:     0x55adc2ba1efb - std::panicking::default_hook::{{closure}}::hb50c1be487d5e83b
   1:     0x55adc2ba1bd7 - std::panicking::default_hook::h22162fa7b1026bf3
   2:     0x55adc2ba2670 - std::panicking::rust_panic_with_hook::h4e663330759b90e1
   3:     0x55adc2ba21f2 - std::panicking::continue_panic_fmt::hea2c5ffb8af99faf
   4:     0x55adc2ba20d6 - rust_begin_unwind
   5:     0x55adc2bc072d - core::panicking::panic_fmt::ha8e419005b06d9fa
   6:     0x55adc24ba0ae - core::result::unwrap_failed::h735537d36531a10c
   7:     0x55adc249503a - spotifyd::config::CliConfig::load_config_file_values::h39db184325d616b4
   8:     0x55adc24b3d2f - spotifyd::main::h60bb33b0dbca0d67
   9:     0x55adc24828d3 - std::rt::lang_start::{{closure}}::hcf53bd9e72ba3236
  10:     0x55adc2ba2073 - std::panicking::try::do_call::hb2e93d09483d8e75
  11:     0x55adc2baba4a - __rust_maybe_catch_panic
  12:     0x55adc2ba2c3d - std::rt::lang_start_internal::hf9d5ceedc8e59823
  13:     0x55adc24b6632 - main
  14:     0x7f8d22e8eee3 - __libc_start_main
  15:     0x55adc247210e - _start
  16:                0x0 - <unknown>

>±> grep -vP '^#' ~/.config/spotifyd/spotifyd.conf
[global]
username = **name**
use-keyring = true
backend = pulseaudio
device_name = ig-fel-spotifyd
bitrate = 320
volume-normalisation = true
normalisation-pregain = -10

the binary built as cargo build --release --locked --features pulseaudio_backend,dbus_mpris,dbus_keyring

mainrs commented 5 years ago

Hey, could you please run it with the verbose flag and post the output as well (or edit the old one). As you didn't specify a cache_path, could you also try it with a specified cache_path? I do have an idea why this might happen. Here I am mapping the cache_path to PathBuf::from but I actually dont check to make sure the config is present. It looks like it automatically unwraps and if no path is specified, it crashes.

Felixoid commented 5 years ago

It's pretty much the same as I see

>±> RUST_BACKTRACE=full spotifyd --verbose --no-daemon
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Custom("provided string was not `true` or `false`")', src/libcore/result.rs:999:5
stack backtrace:
   0:     0x55f07b893efb - std::panicking::default_hook::{{closure}}::hb50c1be487d5e83b
   1:     0x55f07b893bd7 - std::panicking::default_hook::h22162fa7b1026bf3
   2:     0x55f07b894670 - std::panicking::rust_panic_with_hook::h4e663330759b90e1
   3:     0x55f07b8941f2 - std::panicking::continue_panic_fmt::hea2c5ffb8af99faf
   4:     0x55f07b8940d6 - rust_begin_unwind
   5:     0x55f07b8b272d - core::panicking::panic_fmt::ha8e419005b06d9fa
   6:     0x55f07b1ac0ae - core::result::unwrap_failed::h735537d36531a10c
   7:     0x55f07b18703a - spotifyd::config::CliConfig::load_config_file_values::h39db184325d616b4
   8:     0x55f07b1a5d2f - spotifyd::main::h60bb33b0dbca0d67
   9:     0x55f07b1748d3 - std::rt::lang_start::{{closure}}::hcf53bd9e72ba3236
  10:     0x55f07b894073 - std::panicking::try::do_call::hb2e93d09483d8e75
  11:     0x55f07b89da4a - __rust_maybe_catch_panic
  12:     0x55f07b894c3d - std::rt::lang_start_internal::hf9d5ceedc8e59823
  13:     0x55f07b1a8632 - main
  14:     0x7f6f4efefee3 - __libc_start_main
  15:     0x55f07b16410e - _start
  16:                0x0 - <unknown>
mainrs commented 5 years ago

Does it work when you set the cache_path either using --cache-path as a CLI or via the config file?

corbuntus commented 5 years ago

Same error, even after setting cache_path, archlinux user too.

mainrs commented 5 years ago

I can tackle this one down after the weekend at earliest. It worked for me though before I pushed the code. Not sure what settings I used though. I am running macOS.

mainrs commented 5 years ago

Anyway, the first trace and the second one look like two different errors. The first happens on an Option, the second one on a Result.

otahontas commented 5 years ago

Are you running Spotifyd without a config file?

Edit: Could you post the output when running with the verbose flag, e.g. RUST_BACKTRACE=1 spotifyd --verbose --no-daemon

I originally tried to run it with my old config file, but same happens without config. Here's the verbose print without config:

21:26:39 [TRACE] spotifyd: [<unknown>:56] CliConfig { config_path: None, no_daemon: true, verbose: true, pid: None, shared_config: SharedConfigValues { username: None, password: None, password_cmd: None, use_keyring: false, on_song_change_hook: None, cache_path: None, backend: None, volume_controller: None, device: None, control: None, mixer: None, device_name: None, bitrate: None, volume_normalisation: false, normalisation_pregain: None, zeroconf_port: None } }
21:26:39 [TRACE] spotifyd::utils: [<unknown>:9] Found shell "/usr/local/bin/zsh" using SHELL environment variable

And with config:

21:25:36 [TRACE] spotifyd: [<unknown>:56] CliConfig { config_path: None, no_daemon: true, verbose: true, pid: None, shared_config: SharedConfigValues { username: Some("user"), password: Some("taken out for privacy"), password_cmd: None, use_keyring: false, on_song_change_hook: None, cache_path: Some("/Users/otahontas/.cache/spotifyd/"), backend: Some(PortAudio), volume_controller: None, device: None, control: None, mixer: None, device_name: Some("macbook_cli"), bitrate: Some(Bitrate160), volume_normalisation: true, normalisation_pregain: Some(0.0), zeroconf_port: None } }
21:25:36 [TRACE] spotifyd::utils: [<unknown>:9] Found shell "/usr/local/bin/zsh" using SHELL environment variable.
mainrs commented 5 years ago

I can take a closer look at it on monday, thanks for posting the outputs!

Edit: Bug from @otahontas: volume_controller gets unwrapped without having a value during SpotifydConfig creation. Either specify a default (softvol) or add an unwrap_or clause like I did for other values above the config creation: Here

Bug from @Felixoid: ~Probably this as it is the only one without checking for the return value. It directly unwraps the read config file. Do you have the right permissions on the file (that's the first thing that just comes into my mind :smile:)?~ #300.

corbuntus commented 5 years ago

Bug from @otahontas: volume_controller gets unwrapped without having a value during SpotifydConfig creation. Either specify a default (softvol) or add an unwrap_or clause like I did for other values above the config creation: Here

Thanks! That worked for me.

mainrs commented 5 years ago

It should theoretically be enough to just pass a volume_controller for now. I think softvol was the default before I started refactoring. No problem :smile:

Felixoid commented 5 years ago

@SirWindfield I've tried to play with and without config and found that the reason is use-keyring in the file. If I define it in config the program crashes, but with the parameter --use-keyring everything runs smoothly.

But after some further investigation there even more issues, e.g.:


thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Custom("unknown variant `pulseaudio # run `spotifyd --backends` for possible values`, expected one of `alsa`, `portaudio`, `pulseaudio`")', src/libcore/result.rs:999:5```

I think there is some general issue with the config
mainrs commented 5 years ago

That's super weird. I made sure to be completely backwards compatible with everything I did imlement. I just ran some tests. I specified use-keyring in the config file and it worked without problems. The daemon logged into my account.

First off, I really NEED your commands that you used to start spotifyd if you want help. I can't reproduce stuff if I have no idea how you started the daemon. The error message you posted above indicated that it doesn't know the pulseaudio backend. This happens if you compiled the project without adding the backend to it. If you want to use pulseaudio, make sure to run the following:

$ cargo build --release --no-default-features --features "pulseaudio_backend,dbus_keyring"

This enables keyring support as well as the pulseaudio backend. I do not own a Linux machine and my VMs stopped booting as of recently. I can only test stuff on portaudio. But if the problem still occurs after you used the pulseaudio_backend feature flag, report back.

I even used your config file and spotifyd started up without any problems. I just changed to portaudio as my backend because I work on macOS.

Edit: I got pulseaudio installed on my macOS and compiled it using the pulseaudio_backend feature flag and it started as well. So I guess you forgot the flag during compilation.

Felixoid commented 5 years ago

I'll double-check, but take a look closer to the error:

expected one of `alsa`, `portaudio`, `pulseaudio`

So the variant is there

I'll come back after manual build

mainrs commented 5 years ago

That's actually another issue, #297. All flags and possibilities are displayed, despite the fact that they are possible or not. If you used the pre-compiled version, it only supports the alsa backend. So you have to compile it manually. There is some work on the go to add support for all variants (the more important ones) to our CI server, which builds the binaries. But for now, there is the inconvenience of building the package yourself if you want some extra features and other backends.

Felixoid commented 5 years ago

So, I've built the featured release and there is a log

expand

``` ┌[10:46:41] felixoid@hostname:~/.cache/yay/spotifyd/spotifyd-0.2.13 [master|✚1] └>±> cargo build --release --locked --features pulseaudio_backend,dbus_mpris,dbus_keyring Compiling semver-parser v0.7.0 Compiling libc v0.2.62 Compiling autocfg v0.1.6 Compiling rand_core v0.4.2 Compiling byteorder v1.3.2 Compiling arrayvec v0.4.11 Compiling lazy_static v1.4.0 Compiling nodrop v0.1.13 Compiling log v0.4.8 Compiling cfg-if v0.1.9 Compiling stable_deref_trait v1.1.1 Compiling scopeguard v0.3.3 Compiling either v1.5.3 Compiling scopeguard v1.0.0 Compiling smallvec v0.6.10 Compiling fnv v1.0.6 Compiling futures v0.1.29 Compiling slab v0.4.2 Compiling proc-macro2 v1.0.3 Compiling protobuf v2.8.1 Compiling getrandom v0.1.12 Compiling typenum v1.11.2 Compiling unicode-xid v0.2.0 Compiling ppv-lite86 v0.2.5 Compiling proc-macro2 v0.4.30 Compiling version_check v0.1.5 Compiling syn v1.0.5 Compiling cc v1.0.45 Compiling scoped-tls v0.1.2 Compiling httparse v1.3.4 Compiling byte-tools v0.3.1 Compiling gcc v0.3.55 Compiling pkg-config v0.3.16 Compiling unicode-xid v0.1.0 Compiling smallvec v0.2.1 Compiling safemem v0.3.2 Compiling ryu v1.0.0 Compiling bitflags v0.7.0 Compiling memchr v2.2.1 Compiling syn v0.15.44 Compiling matches v0.1.8 Compiling slab v0.3.0 Compiling try-lock v0.1.0 Compiling take v0.1.0 Compiling subtle v1.0.0 Compiling serde v1.0.100 Compiling bitflags v1.1.0 Compiling language-tags v0.2.2 Compiling opaque-debug v0.2.3 Compiling mime v0.3.14 Compiling percent-encoding v1.0.1 Compiling rustc-demangle v0.1.16 Compiling fake-simd v0.1.2 Compiling failure_derive v0.1.5 Compiling openssl v0.10.24 Compiling itoa v0.4.4 Compiling foreign-types-shared v0.1.1 Compiling arc-swap v0.4.2 Compiling bitflags v0.9.1 Compiling crc32fast v1.2.0 Compiling regex-syntax v0.6.12 Compiling remove_dir_all v0.5.2 Compiling unicode-xid v0.0.4 Compiling percent-encoding v2.1.0 Compiling rustc-serialize v0.3.24 Compiling indexmap v1.2.0 Compiling nix v0.11.1 Compiling native-tls v0.2.3 Compiling void v1.0.2 Compiling try-lock v0.2.2 Compiling bit-vec v0.5.1 Compiling ucd-util v0.1.5 Compiling byteorder v0.5.3 Compiling encoding_rs v0.8.19 Compiling quote v0.3.15 Compiling linear-map v1.2.0 Compiling adler32 v1.0.3 Compiling quick-error v1.2.2 Compiling c_linked_list v1.1.1 Compiling regex v0.2.11 Compiling openssl-probe v0.1.2 Compiling dtoa v0.4.4 Compiling unicode-segmentation v1.3.0 Compiling unicode-width v0.1.6 Compiling derive_builder v0.5.1 Compiling utf8-ranges v1.0.4 Compiling termcolor v1.0.5 Compiling strsim v0.8.0 Compiling safemem v0.2.0 Compiling vec_map v0.8.1 Compiling ansi_term v0.11.0 Compiling webbrowser v0.2.2 Compiling random v0.12.2 Compiling term v0.4.6 Compiling result v1.0.0 Compiling hex v0.3.2 Compiling xdg v2.2.0 Compiling rand_core v0.3.1 Compiling rand_jitter v0.1.4 Compiling rand_pcg v0.1.2 Compiling rand_chacha v0.1.1 Compiling rand v0.6.5 Compiling num-traits v0.2.8 Compiling num-integer v0.1.41 Compiling num-bigint v0.2.3 Compiling num-iter v0.1.39 Compiling thread_local v0.3.6 Compiling crossbeam-utils v0.6.6 Compiling try_from v0.3.2 Compiling semver v0.9.0 Compiling owning_ref v0.4.0 Compiling itertools v0.7.11 Compiling unicode-normalization v0.1.8 Compiling c2-chacha v0.2.2 Compiling unicase v2.5.1 Compiling error-chain v0.12.1 Compiling block-padding v0.1.4 Compiling tokio-sync v0.1.6 Compiling tokio-service v0.1.0 Compiling relay v0.1.1 Compiling alsa-sys v0.1.2 Compiling libdbus-sys v0.2.1 Compiling unicode-bidi v0.3.4 Compiling ogg-sys v0.0.9 Compiling tremor-sys v0.1.0 (https://github.com/plietar/rust-tremor#5958cc30) Compiling rust-crypto v0.2.36 Compiling backtrace-sys v0.1.31 Compiling openssl-sys v0.9.49 Compiling foreign-types v0.3.2 Compiling synom v0.11.3 Compiling bit-set v0.5.1 Compiling regex-syntax v0.5.6 Compiling miniz_oxide v0.3.2 Compiling dns-parser v0.3.2 (https://github.com/plietar/dns-parser#1d3e5a55) Compiling humantime v1.3.0 Compiling textwrap v0.11.0 Compiling getopts v0.2.21 Compiling heck v0.3.1 Compiling rand_hc v0.1.0 Compiling rand_isaac v0.1.1 Compiling rand_xorshift v0.1.1 Compiling crossbeam-queue v0.1.2 Compiling tokio-executor v0.1.8 Compiling lock_api v0.1.5 Compiling rustc_version v0.2.3 Compiling syn v0.11.11 Compiling idna v0.1.5 Compiling idna v0.2.0 Compiling rand_os v0.1.3 Compiling iovec v0.1.2 Compiling net2 v0.2.33 Compiling num_cpus v1.10.1 Compiling rand v0.4.6 Compiling time v0.1.42 Compiling rand v0.5.6 Compiling nix v0.9.0 Compiling signal-hook-registry v1.1.1 Compiling get_if_addrs v0.5.3 Compiling libpulse-sys v0.0.0 Compiling atty v0.2.13 Compiling dbus v0.2.3 Compiling rust-gmp v0.3.2 Compiling rpassword v2.1.0 Compiling rpassword v3.0.2 Compiling daemonize v0.3.0 Compiling base64 v0.9.3 Compiling base64 v0.10.1 Compiling ogg v0.7.0 Compiling shannon v0.2.0 Compiling base64 v0.6.0 Compiling log v0.3.9 Compiling want v0.0.4 Compiling want v0.2.0 Compiling tokio-timer v0.2.11 Compiling tokio-current-thread v0.1.6 Compiling memoffset v0.5.1 Compiling parking_lot_core v0.4.0 Compiling extprim v1.7.0 Compiling hyper v0.12.35 Compiling generic-array v0.12.3 Compiling quote v1.0.2 Compiling aho-corasick v0.7.6 Compiling aho-corasick v0.6.10 Compiling quote v0.6.13 Compiling flate2 v1.0.11 Compiling url v1.7.2 Compiling num-complex v0.1.43 Compiling bytes v0.4.12 Compiling mio v0.6.19 Compiling futures-cpupool v0.1.8 Compiling rand_core v0.5.1 Compiling rand v0.3.23 Compiling url v2.1.0 Compiling vergen v0.1.1 Compiling signal-hook v0.1.10 Compiling clap v2.33.0 Compiling derive_builder_core v0.2.0 Compiling derive-error-chain v0.10.1 Compiling simplelog v0.4.4 Compiling lewton v0.9.4 Compiling block-buffer v0.7.3 Compiling digest v0.8.1 Compiling crypto-mac v0.7.0 Compiling block-cipher-trait v0.6.2 Compiling stream-cipher v0.3.2 Compiling mime_guess v2.0.1 Compiling alsa v0.2.2 Compiling dbus v0.6.5 Compiling regex v1.3.1 Compiling backtrace v0.3.37 Compiling num-bigint v0.1.44 Compiling tokio-io v0.1.12 Compiling tokio-buf v0.1.1 Compiling string v0.2.1 Compiling http v0.1.18 Compiling cookie v0.12.0 Compiling uuid v0.7.4 Compiling rand_chacha v0.2.1 Compiling protobuf-codegen v2.8.1 Compiling mio-uds v0.6.7 Compiling sha2 v0.8.0 Compiling sha-1 v0.8.1 Compiling hmac v0.7.1 Compiling aes-soft v0.3.3 Compiling block-modes v0.3.3 Compiling ctr v0.3.2 Compiling tremor v0.1.0 (https://github.com/plietar/rust-tremor#5958cc30) Compiling error-chain v0.10.0 Compiling error-chain v0.11.0 Compiling num-rational v0.1.42 Compiling synstructure v0.10.2 Compiling tokio-codec v0.1.1 Compiling env_logger v0.5.13 Compiling env_logger v0.6.2 Compiling rand v0.7.1 Compiling http-body v0.1.0 Compiling h2 v0.1.26 Compiling protobuf-codegen-pure v2.8.1 Compiling crossbeam-epoch v0.7.2 Compiling parking_lot v0.7.1 Compiling aes v0.3.2 Compiling aes-ctr v0.3.0 Compiling dotenv v0.10.1 Compiling pbkdf2 v0.3.0 Compiling publicsuffix v1.5.3 Compiling syslog v4.0.1 Compiling num v0.1.42 Compiling serde_derive v1.0.100 Compiling proc-macro-error v0.2.6 Compiling librespot-core v0.1.0 (https://github.com/librespot-org/librespot.git#7cb551d6) Compiling tempfile v3.1.0 Compiling crossbeam-deque v0.7.1 Compiling tokio-reactor v0.1.9 Compiling secret-service v0.4.0 Compiling librespot-protocol v0.1.0 (https://github.com/librespot-org/librespot.git#7cb551d6) Compiling structopt-derive v0.3.1 Compiling tokio-threadpool v0.1.15 Compiling tokio-tcp v0.1.3 Compiling tokio-uds v0.2.5 Compiling tokio-udp v0.1.5 Compiling tokio-signal v0.2.7 Compiling failure v0.1.5 Compiling keyring v0.6.1 Compiling tokio-fs v0.1.6 Compiling tokio-process v0.2.4 Compiling tokio v0.1.22 Compiling tokio-core v0.1.17 Compiling structopt v0.3.1 Compiling tokio-proto v0.1.1 Compiling tokio-signal v0.1.5 Compiling dbus-tokio v0.2.1 Compiling hyper v0.11.27 Compiling hyper-tls v0.3.2 Compiling hyper-proxy v0.4.1 Compiling serde_json v1.0.40 Compiling multimap v0.4.0 Compiling serde_urlencoded v0.5.5 Compiling chrono v0.4.9 Compiling serde_ini v0.2.0 Compiling cookie_store v0.7.0 Compiling mdns v0.2.0 (https://github.com/plietar/rust-mdns#66a74033) Compiling reqwest v0.9.20 Compiling librespot-audio v0.1.0 (https://github.com/librespot-org/librespot.git#7cb551d6) Compiling librespot-metadata v0.1.0 (https://github.com/librespot-org/librespot.git#7cb551d6) Compiling librespot-playback v0.1.0 (https://github.com/librespot-org/librespot.git#7cb551d6) Compiling rspotify v0.2.5 Compiling librespot-connect v0.1.0 (https://github.com/librespot-org/librespot.git#7cb551d6) Compiling librespot v0.1.0 (https://github.com/librespot-org/librespot.git#7cb551d6) Compiling spotifyd v0.2.12 (/home/felixoid/.cache/yay/spotifyd/spotifyd-0.2.13) Finished release [optimized] target(s) in 20m 03s ┌[11:32:41] felixoid@hostname:~/.cache/yay/spotifyd/spotifyd-0.2.13 [master|✚1] └>±> grep -vP '^#' ~/.config/spotifyd/spotifyd.conf [global] username = username backend = pulseaudio # run `spotifyd --backends` for possible values volume-control = softvol # or alsa_linear, or softvol device_name = hostname-spotifyd # must not contain spaces bitrate = 320 # or 96, or 320 cache_path = "/home/felixoid/.cache/spotifyd" volume-normalisation = true normalisation-pregain = -10 ┌[11:32:56] felixoid@hostname:~/.cache/yay/spotifyd/spotifyd-0.2.13 [master|✚1] └>±> ./target/release/spotifyd --verbose thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Custom("unknown variant `pulseaudio # run `spotifyd --backends` for possible values`, expected one of `alsa`, `portaudio`, `pulseaudio`")', src/libcore/result.rs:999:5 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace. ┌[11:39:04] felixoid@hostname:~/.cache/yay/spotifyd/spotifyd-0.2.13 [master|✚1] └>±> grep -vP '^#' ~/.config/spotifyd/spotifyd.conf [global] username = username use-keyring = true # can be used as alternative to `password` backend = pulseaudio # run `spotifyd --backends` for possible values volume-control = softvol # or alsa_linear, or softvol device_name = hostname-spotifyd # must not contain spaces bitrate = 320 # or 96, or 320 cache_path = "/home/felixoid/.cache/spotifyd" volume-normalisation = true normalisation-pregain = -10 ┌[11:39:06] felixoid@hostname:~/.cache/yay/spotifyd/spotifyd-0.2.13 [master|✚1] └>±> ./target/release/spotifyd --verbose thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Custom("provided string was not `true` or `false`")', src/libcore/result.rs:999:5 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace. ```

As far as I see, it's the same result =\

mainrs commented 5 years ago

OMG. The config file reader ignores comment hashtags. You should be fine if you remove every comment in the config file. Haha I didn't except something like this...

Felixoid commented 5 years ago

Huh, you are right. That's funny, must say =)

Besides that another and, hopefully, the last moment, the --backends argument looks missing

>±> spotifyd --backends
error: Found argument '--backends' which wasn't expected, or isn't valid in this context
    Did you mean --backend?

Thank you very much for your help

mainrs commented 5 years ago

Yes, the message should be changed. If you do not specify one of the allowed types alsa, pulseaudio or portaudio, the daemon doesnt even start and tells you that you passed a wrong one. It's basically deprecated.

Felixoid commented 5 years ago

Ah, forgot to mention. The last working version with # comments in the line was 0.2.10.

mainrs commented 5 years ago

Yes, I had to change the crate we use for parsing the ini file to merge the cli and config flags together and make them more uniform in their naming as well as remove some lookup logic for values. I didn't know that serde_ini doesn't support comment lines. Well, in fact they do, but they don't support inline comments. I opened up another issue for it, #300.

otahontas commented 5 years ago

I can take a closer look at it on monday, thanks for posting the outputs!

Edit: Bug from @otahontas: volume_controller gets unwrapped without having a value during SpotifydConfig creation. Either specify a default (softvol) or add an unwrap_or clause like I did for other values above the config creation: Here

Bug from @Felixoid: Probably this as it is the only one without checking for the return value. It directly unwraps the read config file. Do you have the right permissions on the file (that's the first thing that just comes into my mind 😄)?

Just confirming that setting volume_controller to default value (softvol) helped, thanks! After chancing that, everything runs fine and smootly 🎉 Btw, are you planning to set config values to fall back on defaults in future versions or should these be set to default in config file?

mainrs commented 5 years ago

@otahontas I think I just missed to set the value for volume_controller to its default. Every other config entry works correctly when not specifying something. This will definitely be fixed in the next release. Setting the flag explicitly is just a workaround for now :)

shackra commented 4 years ago

I'm experiencing this bug.

➜ RUST_BACKTRACE=full spotifyd --verbose --no-daemon
Loading config from "/home/jorge/.config/spotifyd/spotifyd.conf"
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Custom("unknown variant `\"alsa\"`, expected one of `alsa`, `portaudio`, `pulseaudio`, `rodio`")', src/config.rs:415:42
stack backtrace:
   0:     0x55ac9bd8c6f5 - <unknown>
   1:     0x55ac9bdb574c - <unknown>
   2:     0x55ac9bd84b33 - <unknown>
   3:     0x55ac9bd8f1b0 - <unknown>
   4:     0x55ac9bd8eefc - <unknown>
   5:     0x55ac9bd8f7e7 - <unknown>
   6:     0x55ac9bd8f3eb - <unknown>
   7:     0x55ac9bdb33c1 - <unknown>
   8:     0x55ac9bdb31e3 - <unknown>
   9:     0x55ac9b6b1289 - <unknown>
  10:     0x55ac9b6c93a5 - <unknown>
  11:     0x55ac9b6b4ee3 - <unknown>
  12:     0x55ac9bd8fc78 - <unknown>
  13:     0x55ac9b6c9b02 - main
  14:     0x7ff22f9bd152 - __libc_start_main
  15:     0x55ac9b69d11e - <unknown>
  16:                0x0 - <unknown>

my config:

[global]
username = "myusername"

password = "mypassword"

backend = "alsa"

device = "pulse"  # omit for macOS

control = "pulse"  # omit for macOS

mixer = "PCM"

volume_controller = "pulse"  # use softvol for macOS

device_name = "sanson-gnu"

bitrate = 160

cache_path = "cache_directory"

no_audio_cache = false

initial_volume = 90

volume_normalisation = true

normalisation_pregain = -10

zeroconf_port = 5353

device_type = "computer"
robinvd commented 4 years ago

@shackra where did you get the binary from?

Recently we updated the config spec, but i think you have an older version of spotifyd.

You can use the old format from the readme here https://github.com/Spotifyd/spotifyd/blob/7e346c8f2e4ec09e565b311d130fc91a01a244df/README.md

Or you can install spotifyd from the master branch

shackra commented 4 years ago

@shackra where did you get the binary from?

directly from Arch Linux official community repository

Recently we updated the config spec, but i think you have an older version of spotifyd.

Or you can install spotifyd from the master branch

I may try that instead

carlosplanchon commented 3 years ago

I'm experiencing this bug.

➜ RUST_BACKTRACE=full spotifyd --verbose --no-daemon
Loading config from "/home/jorge/.config/spotifyd/spotifyd.conf"
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Custom("unknown variant `\"alsa\"`, expected one of `alsa`, `portaudio`, `pulseaudio`, `rodio`")', src/config.rs:415:42
stack backtrace:
   0:     0x55ac9bd8c6f5 - <unknown>
   1:     0x55ac9bdb574c - <unknown>
   2:     0x55ac9bd84b33 - <unknown>
   3:     0x55ac9bd8f1b0 - <unknown>
   4:     0x55ac9bd8eefc - <unknown>
   5:     0x55ac9bd8f7e7 - <unknown>
   6:     0x55ac9bd8f3eb - <unknown>
   7:     0x55ac9bdb33c1 - <unknown>
   8:     0x55ac9bdb31e3 - <unknown>
   9:     0x55ac9b6b1289 - <unknown>
  10:     0x55ac9b6c93a5 - <unknown>
  11:     0x55ac9b6b4ee3 - <unknown>
  12:     0x55ac9bd8fc78 - <unknown>
  13:     0x55ac9b6c9b02 - main
  14:     0x7ff22f9bd152 - __libc_start_main
  15:     0x55ac9b69d11e - <unknown>
  16:                0x0 - <unknown>

my config:

[global]
username = "myusername"

password = "mypassword"

backend = "alsa"

device = "pulse"  # omit for macOS

control = "pulse"  # omit for macOS

mixer = "PCM"

volume_controller = "pulse"  # use softvol for macOS

device_name = "sanson-gnu"

bitrate = 160

cache_path = "cache_directory"

no_audio_cache = false

initial_volume = 90

volume_normalisation = true

normalisation_pregain = -10

zeroconf_port = 5353

device_type = "computer"

I am having the same problem here. Also Arch Linux.