Move the Rust and Clippy linting options into the Cargo manifest and
share them with all the packages in the workspace. This ensures a
consistent style in all packages.
* feat: add `info` command line subcommand
Adding an info command allows the documentation to refer to it when
mentioning platform specific information. This gives users a nicer
experience since they don't need to think about how `ncspot` will behave
on their system, but can run `ncspot info` to get that information.
* fix: info command don't create runtime directory
* fix: don't print runtime path on Windows
Windows doesn't use the runtime path so it shouldn't be printed there.
* fix: make `info` command easier to parse
* docs: add back the default configuration directory
The `lazy_static` crate was superseded by the `once_cell` crate which
has been included in Rust's standard library since version `1.70`.
Remove the `lazy_static` dependency and refactor all use cases to use
`std::sync::OnceLock` instead.
Co-authored-by: Henrik Friedrichsen <henrik@affekt.org>
Clippy's `use_self` line ensures that `Self` is used instead of the real
name whenever possible. This makes searching easier and cleans up the
code a bit.
To have a clear distinction between code dealing with OS process
characteristics and code of ncspot itself, it makes sense to move the
async runtime together with ncspot as it doesn't have anything to do
with the OS process.
Some applications move their 'global' data into a struct called `App` or
`Application`. This makes it very clear what data belongs to the
'global' scope or in other words, to the application itself.
Some systems may have an ncspot binary with enabled MPRIS/DBus support, even
though DBus is not actually running on the system or the session is broken.
ncspot should not panic in such a situation, but handle gracefully instead.
Should help with #1139
* Rewrite MPRIS implementation using zbus
The initial DBus implementation was getting harder to maintain and `zbus` offers
some nice convenience features that should make our MPRIS implementation
cleaner.
For now this only implements the `org.mpris.MediaPlayer2` interface which does
not do much.
Should help with #1103
* Implement MPRIS properties
- `PlaybackStatus`
- `PlaybackRate`
- `Volume` (get/set)
* Implement remaining player properties/functions
* Emit signal for changed properties on track change
* Add manpage generation.
* Hide xtask compilation info.
This changes the default behavior of the `cargo run` command for xtasks
to hide the compilation info. This makes sense as xtask's are run as a
program, and showing the compilation info every time clutters stdout
with unrelated info.
* Move ncspot's `clap::Command` to `lib.rs`.
Moving the `clap::Command` used internally by ncspot to a library allows
it to be easily shared between different packages (xtask and ncspot
itself).
This commit also reworks the xtasks to use clap for parsing the xtask
arguments, which simplifies writing new xtasks.
* Make `generate-manpage` `--output` optional.
When more xtasks get added, it would make sense to have a `generate-all`
subcommand that executes all xtasks, which wouldn't be able to have
options for every separate subcommand. Therefore the `output` argument
should be optional, and by default output to the `misc` directory which
contains extra metadata files already.
* Add packaging info to `README.md`.
Update the README to include information for packagers. The information
includes provided files as well as info on how to generate some of them.
* config / authentication: permit to call external program for getting credentials
You can add into your ncspot/config.toml like this:
```
creds_username = "mylogin"
creds_passeval = "pass my_pass_path_to_spot_password"
```
Or using any password manager who send your password.to stdout.
If a newline is detected it will be automatically removed
* Move credential commands into separate structure
Also add an option for a username command
* Document credential commands
---------
Co-authored-by: Henrik Friedrichsen <henrik@affekt.org>
* Create IPC socket on UNIX platforms
Creates an IPC socket which remote programs/scripts can connect to. This
can be used to control ncspot or fetch the current playback status.
At the moment, only remote control is implemented. Next step is to send
the current player status as a JSON object.
Fixes#524
* Publish status changes to connected sockets
Whenever the playback mode (playing, paused, stopped) or the track changes, all
socket listeners will be notified.
Fixes#924, fixes#1019
* Document IPC feature
* fix(backtrace): Fix backtrace logging and stdout
- Add manual implementation for panic that logs backtrace to a file.
- Remove all manual output to stdout.
- Fix new clippy warnings from Rust 1.65.
* Update docs
Co-authored-by: Henrik Friedrichsen <henrik@affekt.org>
* Refactored `command::parse`
* Removed unnecessary duplication in error msg
* Renamed `NotEnoughArgs` -> `InsufficientArgs`
* Inaccurate var name
* Ditch wordy error prefix
* Use `split_whitespace` instead of regex
* Cleanup unused regex import
* `insert` cmd fails fast
* Refactor: use `and_then` instead of `unwrap`
* Updated `Command::to_string`
* Added `Command::basename`
* Better err msg when running cmd in unsupported view, fully closes#597
* Sort `match` branches by their order in the enum