Commit Graph

19 Commits

Author SHA1 Message Date
Jonte Bergfeld
3893a0ef6d feat(mpris): Restructuring and cleanup
* MPRIS: Restructured existing implementation

My pr addresses some of the inconsistencies in ncspot's mpris
implementation. While the previous logic was technically good enough, it
was inflexible and reported redundant information.
This will make it easier for software, that processes mpris events in
some way, to accurately react to player updates.

- 'Metadata' and 'Playback' updates have been separated into there own
  command
- Mpris commands are only emitted from within spotify.rs
- Some parts of the application creation logic has been
  restructured to allow for mpris events to be emitted upon startup
    - The initial song loading code has been moved from 'Queue::new'
      into 'Application::new'.

* MPRIS: implemented most clippy suggestions

* Fix: applied clippy suggestions + format

* MPRIS: Renamed MprisCommands to be more resonable

I've added a clippy exception so it does not complain to us about enum
variants starting with the same prefix.

---------

Co-authored-by: haruInDisguise <--help>
2024-09-19 21:31:29 +00:00
Alexandre Bury
02f72b1c21 chore: Update cursive to 0.21.0
* Update cursive to 0.21.0

* Inject TERM=xterm in CI to help build ncurses backend
2024-08-04 17:27:58 +02:00
Thomas Frans
5b4a17597d fix(mpris): missing PropertyChanged signal for volume
fix(mpris): missing PropertyChanged signal for volume

Send a `PropertyChanged` signal for the MPRIS volume when the volume
changes inside `ncspot`.
2024-02-19 22:46:00 +01:00
Thomas Frans
38010b4c76 fix: gracefully exit when misconfigured or unavailable audio backend
When the user has an error in their audio backend configuration or
doesn't have audio backends available, gracefully exit instead of
panicking.
2024-02-06 20:39:29 +01:00
Thomas Frans
0eee40e877 fix: crash on Termux due to missing runtime directory
Instead of crashing on Termux, no IPC socket is created. This is a
temporary solution until a suitable runtime directory for the Termux
platform can be found.
2024-01-06 11:35:38 +01:00
Thomas Frans
fcf68995cb fix!: create IPC socket in user runtime directory (#1313)
Each user has their own runtime directory at `/run/user/<uid>`. Creating
the IPC socket in there makes sure it is cleaned up regardless of
whether `ncspot` exits normally.

BREAKING CHANGE: move IPC socket location
2023-10-28 18:43:33 +02:00
Henrik Friedrichsen
a1a986344f Revert "feat: move to async POSIX signal handler"
This reverts commit a067ab2ae2.
2023-10-14 12:44:47 +02:00
Thomas Frans
a69e2d763b fix: disable cursive_buffered_backend tracing
Disable the useless trace logs from the `cursive_buffered_backend`
crate.
2023-10-12 11:14:51 +02:00
Thomas Frans
a067ab2ae2 feat: move to async POSIX signal handler
Instead of trying to handle signals for every step of the `cursive`
event loop, move the signal handling into its own asynchronous task and
send callbacks to `cursive` when a signal arrives.
2023-10-08 10:47:43 +02:00
Thomas Frans
209d8e260b refactor: remove lazy_static crate
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>
2023-10-07 17:33:48 +02:00
Henrik Friedrichsen
b4a397c84d Use Rc for UserData as it's !Sync 2023-08-26 15:06:23 +02:00
Thomas Frans
6d2a0552bf refactor: move layout functionality under layout 2023-06-02 23:20:24 +02:00
Thomas Frans
d0efc0868f chore: fix Application::new documentation 2023-06-02 23:20:24 +02:00
Thomas Frans
0c97bd36c3 fix: remove ipc import on non-unix systems 2023-06-02 23:20:24 +02:00
Thomas Frans
c36d3cf272 refactor: move and add functions 2023-06-02 23:20:24 +02:00
Thomas Frans
04cbe8ac20 refactor: move base path config + documentation 2023-06-02 23:20:24 +02:00
Thomas Frans
abffb3c2a9 refactor: move cli argument parsing to main
Command line arguments are part of the OS process and should be under
main.
2023-06-02 23:20:24 +02:00
Thomas Frans
ae090b6073 refactor: move async runtime to application module
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.
2023-06-02 23:20:24 +02:00
Thomas Frans
6d32f3d1f8 refactor: move 'global' data into Application
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.
2023-06-02 23:20:24 +02:00