Commit Graph

564 Commits

Author SHA1 Message Date
Thomas Frans
b27e84a386 Add manpage generation using xtask
* 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.
2023-03-06 21:55:19 +01:00
Thomas Frans
0c5693c426 Disable autojump for add to playlist dialog.
Autojump seems to take precedence over regular keys, which isn't the
wanted behavior, especially when there are playlists in the list that
contain some of the most common Vim keybindings. For example when there
is a playlist called 'jazz', pressing `j` will jump to that playlist
instead of going down.

This commit disables autojump for now. If search inside the add to
playlist dialog would be a wanted feature, it could be implemented using
the default Vim search button `/` which would work the same way as
searching in other lists works right now.
2023-03-05 00:04:09 +01:00
Thomas Frans
98a0596c70 Change unnecessary usage of Arc to borrow instead
Some basic cleanup of function signatures that took ownership of their
parameters, even though they didn't need ownership. Switching over the
usage of `Arc` to a normal borrow has the added benefit of cleaning up
the code a bit since now a reference can be given instead of having to
clone the values. The other benefit is that a lot of clones aren't
necessary anymore. It's not going to have noticable performance
benefits, but it is still a good thing to have less clones all over the
code.
2023-03-05 00:02:25 +01:00
Thomas Frans
e68f50ddff Display shuffle order 2023-03-01 12:02:10 +01:00
inemajo
c2e030c2f0 Allow executing program to retrieve credentials
* 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>
2023-03-01 11:28:11 +01:00
Thomas Frans
9ca72e391d CI/CD: Add clippy and update actions
* Add clippy to CI.

* Update .github/workflows/ci.yml

* Update .github/workflows/ci.yml

* Use `cargo check` instead of `cargo build`

* Update CD workflow

---------

Co-authored-by: Henrik Friedrichsen <henrik@affekt.org>
2023-02-28 22:49:32 +01:00
inemajo
801e847c88 commands: Adding "disconnect" command to force socket shutdown (#1057)
* commands: Adding "disconnect" command to force socket shutdown

* Rename to `reconnect`

* Add documentation to README

Related to: #628 #1033

---------

Co-authored-by: Henrik Friedrichsen <henrik@affekt.org>
2023-02-26 20:46:41 +01:00
Jonas Wunderlich
e8d652cc78 Always pass cover URL to notification
Regardless of the `cover` feature
2023-02-24 18:30:10 +01:00
Thomas Frans
a3c4989571 Switch from MM:SS to HH:MM:SS duration representation if needed
* Contidionally switch from MM:SS to HH:MM:SS duration representation if needed.

* Correct tiny style issue.

* --amend
2023-02-17 09:22:12 +01:00
Thomas Frans
829b799cc5 Fix clippy warnings. 2023-02-16 13:33:56 +01:00
Henrik Friedrichsen
8222f1b2e4 Use variables directly inside format strings
Most systems should have an up to date Rust compiler by now, so we should be
fine.
2023-02-06 20:15:43 +01:00
Henrik Friedrichsen
2fe3b056bf Raise SIGTSTP on UNIX and ncurses backend
See also: gyscos/cursive#521

Fixes #1040
2023-02-06 20:01:48 +01:00
Harold Nieuwboer
8c0fbe5f43 Theme config support for HighlightInactive 2023-02-03 17:47:27 +01:00
Henrik Friedrichsen
ec4b7c209a Create IPC socket on UNIX platforms (#1018)
* 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
2022-12-28 19:01:59 +01:00
Henrik Friedrichsen
93816af654 Linter fixes 2022-12-28 14:37:08 +01:00
Henrik Friedrichsen
703ffc76ba Refactor: Don't clone references 2022-12-15 23:42:55 +01:00
Henrik Friedrichsen
23e9ecfd5c Upgrade rspotify to 0.11.6
Passing IDs to rspotify still feels a little wonky with their `Id` changes
making use of `Cow`. Maybe it can be simplified on our end, but it's a start.

Fixes #844

See also:

https://github.com/ramsayleung/rspotify/pull/332
2022-12-14 21:12:08 +01:00
Thomas Frans
7063c9a9aa Document queue module. 2022-12-13 23:25:27 +01:00
Thomas
ccce78af66 Convert main from async to sync again
* Make entry point synchronous and switch to global runtime instead.

* Switch all futures::block_on() to global runtime.

* Fix formatting.
2022-12-11 19:09:22 +01:00
Thomas Frans
8a41815bb2 Add back PanicInfo to backtrace. 2022-12-07 17:03:40 +01:00
pghvlaans
92a7903825 main.rs: println before setting up cursive backend. (#969)
Co-authored-by: Henrik Friedrichsen <henrik@affekt.org>
2022-11-24 20:52:23 +01:00
Thomas
e15657ae67 fix(backtrace): Fix backtrace logging and stdout (#988)
* 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>
2022-11-18 22:20:57 +01:00
Henrik Friedrichsen
1dcebeace1 Add "save/unsave album" to context menu
Fixes #964
2022-10-22 14:20:43 +02:00
Thomas
6a5efb1052 Fix Clone impl marked todo on Pagination
- Fixed a manual implementation of Clone on Pagination (needed extra
  trait bounds to be derivable)
- Made clippy happy :)
2022-10-19 22:02:39 +02:00
Henrik Friedrichsen
5dcbc18f85 Save current state on SIGHUP as well
Fixes #948
2022-10-04 08:30:18 +02:00
Henrik Friedrichsen
b1f1c20484 Exit gracefully on SIGTERM
* Exit gracefully on `SIGTERM`

Save current state and close ncspot on `SIGTERM`

Fixes #948

* Disable signal handling on non-UNIX platforms
2022-10-03 00:07:40 +02:00
Henrik Friedrichsen
c2ab691722 Upgrade to Clap v4 2022-10-02 22:11:10 +02:00
Thomas Frans
655d663aed Fix: fixes a bug that crashed ncspot.
Like mentioned in the corresponding issue by ayushjaipuriyar, ncspot
would crash when the queue was empty, shuffled, and played. This commit
fixes that, together with some minor clippy fixes.
2022-10-02 21:46:57 +02:00
Thomas Frans
be7ed20897 Cleanup: Remove PlayTrackMenu
PlayTrackMenu was used before the refactor of the contextmenus. I forgot
to clean up the struct before making the commit since rustc didn't
complain. Just cleaning up my mistakes ;)
2022-09-23 13:38:32 +02:00
Thomas
0eedc38b8a Improve context menus to make the UX/UI more consistent (#923)
* Add save option to context menu of all possible ListItems

* Add play options to context menus

* Fix for playlists and tracks

* Move playback controls into main menu
2022-09-20 22:09:51 +02:00
Henrik Friedrichsen
a668574376 Fix: properly set up Browse screen
Previously two vectors of categories were created. The pagination was set up to
store the newly fetched page in the `Vec` that was not displayed.

With this change newly fetched pages should correctly show up in the "Browse"
screen.

As reported in #939
2022-09-16 22:12:37 +02:00
Thomas Frans
2be126430d Fixed pagination bug that caused items not to load 2022-09-16 21:31:47 +02:00
Henrik Friedrichsen
c1f0c5409c Fix: Re-request album tracks if it has >50 tracks
Fixes #926
2022-09-12 23:29:12 +02:00
Henrik Friedrichsen
f4ef7e1b56 Fix: remove broken staleness detection
Ever since albums were sorted the cache staleness detection stopped working as
the order of items plays into the check. Remove it as it currently doesn't
work. It also wasn't a very good check.
2022-09-12 23:16:06 +02:00
Henrik Friedrichsen
63722c5be3 Fix: Use buffered backend to prevent flickering
This is reported to be occuring with the Cursive Termion backend as it redraws
the screen every time, resulting in flickering for some users.

Should be removed once Cursive has integrated this.

See also:
- https://github.com/gyscos/cursive/issues/142
- https://github.com/gyscos/cursive/issues/667

Fixes #934
2022-09-11 23:34:24 +02:00
Henrik Friedrichsen
10213f9bcf Fix: set track position only for clicks, not hold
Fixes #920
2022-08-29 21:45:29 +02:00
Henrik Friedrichsen
816d2f133d Mouse wheel: scroll up/down without changing focus
Fixes #918
2022-08-25 22:53:03 +02:00
Ronak Buch
56c8817aa8 Fix order of parameters to Cache::new
When updating to librespot 0.4.0 in c41294c, the volume and audio path
parameters were specified in the wrong order.
2022-08-25 09:22:26 +02:00
Thomas
b8b565d0c3 Fix back button mouse left click 2022-08-24 20:41:55 +02:00
Henrik Friedrichsen
a9f7f3cddc Fix: align with color palette of Cursive
Should make context menus (`SelectView`) look like ncspot's `ListView`.

Fixes #431
2022-08-20 23:40:33 +02:00
Henrik Friedrichsen
966223392e Handle clicks on back button (pop view from stack) 2022-08-20 23:05:14 +02:00
Henrik Friedrichsen
8905db457a Implement category playlist browsing in library
Fixes #187
2022-08-20 22:32:25 +02:00
Henrik Friedrichsen
a04bc40051 Refactor: Extract command handling for ListView 2022-08-20 00:40:21 +02:00
Henrik Friedrichsen
38dfba1db5 Use ViewExt.title() in TabView
Instead of storing a separate copy of the view title.

Additionally, rename `ViewExt.set_title()` to `ViewExt.with_title()` as it
consumes `self` and returns ownership.
2022-08-19 20:42:46 +02:00
Henrik Friedrichsen
5db79d5b2e Fix ListView scrollbar dragging
With af08a56 properly passing down relativized events we don't have to implement
to scrollbar dragging logic ourselves anymore, but can rely on the one in
cursive.

This also fixes #839
2022-08-19 19:02:15 +02:00
Henrik Friedrichsen
2311e49ea2 Don't open item/context menu for clicks after end
The previous behavior would select and open the last item if the user clicked a
row after the last item. This change prevents such a behavior as it can be
misleading.

Related to #840
2022-08-19 00:41:19 +02:00
Henrik Friedrichsen
81010fc453 Refactor: Unify list size calculation 2022-08-19 00:31:56 +02:00
Henrik Friedrichsen
82716b267b Handle left mouse click on item, i.e. albums/lists
Another part of #840
2022-08-19 00:31:47 +02:00
Henrik Friedrichsen
4315cdc077 Add CursiveExt trait
For easier usage of shared logic involving the `Cursive` instance.
2022-08-19 00:18:34 +02:00
Henrik Friedrichsen
f5bf1d527f cargo clippy --fix 2022-08-17 19:41:23 +02:00