Commit Graph

29 Commits

Author SHA1 Message Date
Thomas Frans
c5d666f35c docs: small overall documentation improvements (#1381)
* docs: small overall documentation improvements

- Add documentation comments to various items
- Change web API return types from bool/Option to Result
- Create helper functions with descriptive names instead of comments
- Remove redundant/confusing types
- Fix some documentation comments as instructed by `cargo doc`
- Rename variables to clear names

* docs: small fixes to the documentation update
2024-02-01 19:42:53 +01:00
Thomas Frans
7940365344 refactor(library): various Rust style optimizations
Lots of small fixes to the APIs and functions in the `library` module,
mostly following best practices outlined in the Rust library guidelines.
Changes outside the `library` module were mostly required changes after
changing function signatures.
2024-01-29 21:58:01 +01:00
dependabot[bot]
2a44323d59 chore(deps): bump the cargo group with 8 updates (#1359)
* chore(deps): bump the cargo group with 8 updates

Bumps the cargo group with 8 updates:

| Package | From | To |
| --- | --- | --- |
| [clap](https://github.com/clap-rs/clap) | `4.4.11` | `4.4.12` |
| [crossbeam-channel](https://github.com/crossbeam-rs/crossbeam) | `0.5.9` | `0.5.10` |
| [futures](https://github.com/rust-lang/futures-rs) | `0.3.29` | `0.3.30` |
| [reqwest](https://github.com/seanmonstar/reqwest) | `0.11.22` | `0.11.23` |
| [serde_json](https://github.com/serde-rs/json) | `1.0.108` | `1.0.109` |
| [tokio](https://github.com/tokio-rs/tokio) | `1.35.0` | `1.35.1` |
| [clap_mangen](https://github.com/clap-rs/clap) | `0.2.15` | `0.2.16` |
| [clap_complete](https://github.com/clap-rs/clap) | `4.4.4` | `4.4.5` |


Updates `clap` from 4.4.11 to 4.4.12
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.4.11...v4.4.12)

Updates `crossbeam-channel` from 0.5.9 to 0.5.10
- [Release notes](https://github.com/crossbeam-rs/crossbeam/releases)
- [Changelog](https://github.com/crossbeam-rs/crossbeam/blob/master/CHANGELOG.md)
- [Commits](https://github.com/crossbeam-rs/crossbeam/compare/crossbeam-channel-0.5.9...crossbeam-channel-0.5.10)

Updates `futures` from 0.3.29 to 0.3.30
- [Release notes](https://github.com/rust-lang/futures-rs/releases)
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.29...0.3.30)

Updates `reqwest` from 0.11.22 to 0.11.23
- [Release notes](https://github.com/seanmonstar/reqwest/releases)
- [Changelog](https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/seanmonstar/reqwest/compare/v0.11.22...v0.11.23)

Updates `serde_json` from 1.0.108 to 1.0.109
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.108...v1.0.109)

Updates `tokio` from 1.35.0 to 1.35.1
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.35.0...tokio-1.35.1)

Updates `clap_mangen` from 0.2.15 to 0.2.16
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_mangen-v0.2.15...clap_mangen-v0.2.16)

Updates `clap_complete` from 4.4.4 to 4.4.5
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.4.4...clap_complete-v4.4.5)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: crossbeam-channel
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: futures
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: reqwest
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: tokio
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: clap_mangen
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: clap_complete
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
...

Signed-off-by: dependabot[bot] <support@github.com>

* Use `.first()` instead of `.get(0)`

* Update dependencies

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Henrik Friedrichsen <henrik@affekt.org>
2024-01-01 14:56:39 +00:00
Henrik Friedrichsen
6ee00e39d3 Change color of unavailable song
If song is not available/playable, use secondary text color.

Fixes #1300
2023-10-14 22:36:22 +02:00
Thomas Frans
fe8f8e78ee style(clippy): enforce clippy use_self lint
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.
2023-09-27 22:06:54 +02:00
Henrik Friedrichsen
bef4742cec Remove duplicate album query 2023-07-23 14:49:21 +02:00
Henrik Friedrichsen
92cd4f1c8b Handle local tracks in playlist
- Show error on deletion, as we currently do not have a Uri we can pass to the
  Spotify API to delete local files in playlists
- Mark local files in `ListView`

fixes #1213
2023-07-22 15:42:14 +02:00
Henrik Friedrichsen
90b4560a2d Gracefully handle tracks without IDs
As reported in #1231:

Local files in playlists have no IDs. When trying to delete them ncspot crashes
as it tries to extract a track ID.
2023-07-22 15:42:14 +02:00
Jakub Jirutka
ba60fbddd0 Fix: breaking changes in rpostify 0.11.7 2023-05-09 10:36:04 +02:00
Callum Wishart
43a4883bd3 Update Nerdfont glyphs (#1141) 2023-05-04 23:43:50 +02: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
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
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
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
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
c1f0c5409c Fix: Re-request album tracks if it has >50 tracks
Fixes #926
2022-09-12 23:29:12 +02:00
Henrik Friedrichsen
8905db457a Implement category playlist browsing in library
Fixes #187
2022-08-20 22:32:25 +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
249a4ef5a7 Add statusbar_format configuration option
Fixes #877
2022-07-31 11:24:22 +02:00
James Adam
ed10872ca3 Add 'hide_display_names' config option 2022-07-11 08:27:41 +02:00
Bettehem
f7450321da Add track_format config option (#800)
* Added track_name_first config option to allow choosing if artists' names should be shown before or after the track name.

* Added active_fields config option, which allows configuration of which columns are visible in Queue/Library view.
This also removes the need for a separate track_name_first and album_column option.

* Fixed README

* Made custom tracklist formatting more flexible.
Updated readme with new instructions.
Reformatted impl member order to match the definitions in traits.rs.

* Added track_name_first config option to allow choosing if artists' names should be shown before or after the track name.

* Added active_fields config option, which allows configuration of which columns are visible in Queue/Library view.
This also removes the need for a separate track_name_first and album_column option.

* Fixed README

* Made custom tracklist formatting more flexible.
Updated readme with new instructions.
Reformatted impl member order to match the definitions in traits.rs.

* Fetch formatting config from library config

Instead of the lazy static mutex

* Moved custom format function to Playable impl as it's a better location to handle both Tracks and Episodes

* Rename from `tracklist_formatting` to `track_format`

Also shorten `format_{left|center|right}` to `{left|center|right}`

Co-authored-by: Henrik Friedrichsen <henrik@affekt.org>
2022-05-28 14:13:37 +02:00
Henrik Friedrichsen
0bbb4932e5 Clean up clippy warnings 2022-04-27 22:41:04 +02:00
Henrik Friedrichsen
bb066c774b Clippy cleanups 2022-02-18 22:10:21 +01:00
Roger Roger
23bae723eb Improve playlist sorting
Add secondary and tertiary sorting options to behave more like spotify
when sorting by artist or album.
2022-02-11 10:41:18 +01:00
Henrik Friedrichsen
68b3b9b510 Fix warnings 2022-01-09 21:39:14 +01:00
Henrik Friedrichsen
b826552a1c Fix: Save track ID instead of URI
fixes #661
2021-11-30 20:16:41 +01:00
Henrik Friedrichsen
ebc49117b0 Update rspotify to 0.11.3 (et al)
Also allows us to revert the previously applied fix where the market parameter had to be removed.
2021-11-29 22:43:06 +01:00
Henrik Friedrichsen
048658a529 Show playlist owner name
Requires clearing the playlist cache:
`rm ~/.cache/ncspot/playlists.db`

fixes #652
2021-11-22 20:28:33 +01:00
Henrik Friedrichsen
74b4e65b64 Refactor: move playable models to separate module 2021-11-08 20:44:21 +01:00