Thomas Frans
3c8e546445
refactor: general small refactors to simplify code
...
- Remove `expect` in favor of `unwrap` when the `Result`'s error variant
contains the info in the `expect` anyway (eg. when locking things).
The line number/context are given by the backtrace.
- Remove over-specification of types (`&T` instead of
`&RWReadLockGuard`)
- Put reused values into constants
- `FromStr` instead of manual function
- Change `if let Some(()) = ...` to `if T.is_some()`
2024-02-03 18:52:09 +01:00
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
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
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
cyqsimon
d8faa87431
Fix incorrect notification ID reuse on XDG ( #1150 )
...
* Fix incorrect notification ID reuse on XDG
* Remove `notification_id` persistence
---------
Co-authored-by: Henrik Friedrichsen <henrik@affekt.org >
2023-05-22 17:51:29 +00:00
Henrik Friedrichsen
3a460ea4ad
Revert "Display shuffle order"
...
This reverts commit e68f50ddff .
Will be reintroduced with #1075
2023-03-09 19:34:13 +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
Jonas Wunderlich
e8d652cc78
Always pass cover URL to notification
...
Regardless of the `cover` feature
2023-02-24 18:30:10 +01:00
Thomas Frans
7063c9a9aa
Document queue module.
2022-12-13 23:25:27 +01: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
Henrik Friedrichsen
f5bf1d527f
cargo clippy --fix
2022-08-17 19:41:23 +02:00
eulerfan271
593a4c9284
Add notification customization ( #893 )
...
* Add custom notification formatting
* Added `notification_format` to README
* cleaned up code formatting
* Fix typo
Co-authored-by: Henrik Friedrichsen <henrik@affekt.org >
2022-08-07 15:51:38 +02:00
cyqsimon
fefbd4191d
Fix some errors and warnings when enabling/disabling features ( #821 )
...
* Fix E&Ws when enabling features
* `share_clipboard` feature can be disabled more cleanly
* `notify` feature can be disabled more cleanly
2022-06-10 21:32:59 +02:00
cyqsimon
2e8f37e42b
Add desktop entry & notification icon hint ( #822 )
...
* Add desktop entry & notification icon hint
* Fix build for non-linux
* Set notification priority with hints
2022-06-05 23:59:42 +02:00
Henrik Friedrichsen
c41294cb8d
Update to librespot 0.4.0
...
Changes: https://github.com/librespot-org/librespot/compare/v0.3.1..v0.4.0
2022-05-22 17:15:02 +02:00
Bettehem
dfecb759a0
Added playback_state config option ( #783 )
...
* Added playback_state config option.
It can be used to pre-define a certain playback state for the player.
* Changed playback_state to use enums and removed redundant check for the "Playing" state.
2022-04-28 10:03:17 +02:00
Ronak Buch
f981b64687
Only download cover image when flag enabled ( #780 )
...
* Only download cover image when flag enabled
* fixup! Only download cover image when flag enabled
2022-04-18 17:10:56 +02:00
Henrik Friedrichsen
ee6d26baf3
Fix: only reuse notification on XDG platforms
...
Fixes compilation on Windows
2022-03-22 22:17:00 +01:00
Henrik Friedrichsen
1a7b5f90da
Reuse previous notification id
...
According to XDG specs, passing the previous notification ID will update it
instead of displaying a new notification.
Fixes #760
2022-03-22 22:02:37 +01:00
Henrik Friedrichsen
90dd1a03d2
Set notification app name to ncspot
...
In hopes of fixing #760
2022-03-22 00:15:04 +01:00
Henrik Friedrichsen
bb066c774b
Clippy cleanups
2022-02-18 22:10:21 +01:00
Rashil Gandhi
f29d263f41
Remove notifications' dependency on 'cover' ( #706 )
...
* Move functions from 'cover' to 'utils'
* Remove notify dependency on 'cover'
* Enable clipboard and notifications in CI/CD
* remove extra newline
2022-01-15 21:09:34 +01:00
Henrik Friedrichsen
68b3b9b510
Fix warnings
2022-01-09 21:39:14 +01:00
Henrik Friedrichsen
74b4e65b64
Refactor: move playable models to separate module
2021-11-08 20:44:21 +01:00
Henrik Friedrichsen
96f2d88696
Update to rspotify 0.11.2 ( #640 )
...
* Update to rspotify 0.11.x
Many breaking changes
* Minor cleanups via Clippy
2021-11-07 17:19:56 +01:00
Henrik Friedrichsen
6b8e1d33dc
Code cleanups
2021-08-15 15:05:49 +02:00
Henrik Friedrichsen
eb8d9ad294
Fix notify/cover platform config
2021-07-27 23:04:00 +02:00
nc
2edc22f251
add album cover to notification
2021-07-16 10:27:37 +02:00
Henrik Friedrichsen
f6a895e160
Update to librespot 0.2.0 and Tokio v1
...
This also brings some much need async/.await rewrites
2021-05-07 22:51:32 +02:00
Henrik Friedrichsen
71d42d489e
Remove extern crate statements
...
https://doc.rust-lang.org/edition-guide/rust-2018/module-system/path-clarity.html
2021-05-07 22:51:32 +02:00
Henrik Friedrichsen
98e572169b
Implement track preloading
...
Will preload the next track close to the end of the currently playing
track. Should make playback of queued tracks a little smoother.
2021-04-11 15:54:32 +02:00
Henrik Friedrichsen
decf7c2aef
Improve synchronization of playback times
...
Take librespot timestamps instead of approximating them in ncspot.
2021-04-11 15:17:10 +02:00
Henrik Friedrichsen
cea5228245
(Re)store currently playing track + shuffle state
...
Solves #448
2021-04-09 19:10:34 +02:00
Henrik Friedrichsen
0f573f8247
Refactor: Make Spotify cloneable
2021-04-03 22:35:08 +02:00
Henrik Friedrichsen
db894d7ce8
Add config values to override shuffle/repeat state
2021-02-25 21:07:12 +01:00
Henrik Friedrichsen
92d1978340
Save track queue when closing and restore at start
2021-02-22 22:14:34 +01:00
Henrik Friedrichsen
a880ffd1f6
Persist volume and shuffle/repeat state
2021-02-22 22:14:34 +01:00
André Andersson
92335594bc
Restart queue if pressing play when stopped ( #399 )
...
* Restart queue if pressing play when stopped
* Remove FinishedTrack from match
* Formatting
2021-01-19 21:47:41 +01:00
Henrik Friedrichsen
63e65c32c9
update dependencies
...
rand 0.8.0 now accepts ranges
2021-01-03 23:24:45 +01:00
Henrik Friedrichsen
3874dc42f8
cargo clippy
2021-01-02 21:30:52 +01:00
Henrik Friedrichsen
013beb245b
refactor: pass globally mutable config reference
...
Before, copies of the configuration were passed over. This change also
causes configuration reloads to affect the entire application and is
easier to maintain but introduces some RwLock overhead.
2020-10-18 13:09:45 +02:00
Moshe Sherman
fc79889665
play next ( #278 )
...
* add play next feature
* fix play_next insertion order
* fix play_next call for playable
* document play_next shortcut + reformat
Co-authored-by: Henrik Friedrichsen <henrik@affekt.org >
2020-10-04 16:58:55 +02:00
Moshe Sherman
7bf0cac6c0
handle last element removal in queue
2020-10-01 20:48:27 +02:00
Moshe Sherman
4e7ec60b0e
disable repeat track if manualy skip song
2020-10-01 20:48:27 +02:00
Moshe Sherman
9872a10bfa
adhere to repeat/shuffle settings on previous track
2020-10-01 20:48:27 +02:00
Moshe Sherman
181f5e4918
dont stop track
2020-10-01 20:48:27 +02:00
Henrik Friedrichsen
3893a6f5a0
add feature flag for song notifications
...
enables users/distributions to ship without dbus dependency
2020-09-07 23:50:45 +02:00
Henrik Friedrichsen
69f11cdcf7
gracefully handle error when showing notification
...
fixes #265
2020-09-07 23:38:37 +02:00