feat: add %artist formatting option

* add %artist formating option to only show one artist

* add %artist formatting option to only show one artist + docs

* punctuation.
This commit is contained in:
e5
2024-12-29 22:07:12 +01:00
committed by GitHub
parent 37b4fc9339
commit 75d6b946f7
3 changed files with 16 additions and 2 deletions

View File

@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Added
- `%artist` formatting option to only show single artist name
### Fixed
- Missing automatic man page generation for subcommands

View File

@@ -361,8 +361,9 @@ It's possible to customize how tracks are shown in Queue/Library views and the
statusbar, whereas `statusbar_format` will hold the statusbar formatting and
`[track_format]` the formatting for tracks in list views.
If you don't define `center` for example, the default value will be used.
Available options for tracks: `%artists`, `%title`, `%album`, `%saved`,
`%duration`
Available options for tracks: `%artists`, `%artist`, `%title`, `%album`, `%saved`,
`%duration`.
`%artists` will show all contributing artists, while `%artist` only shows the first listed artist.
Default configuration:

View File

@@ -35,6 +35,15 @@ impl Playable {
}
.as_str(),
)
.replace(
"%artist",
if let Some(artists) = playable.artists() {
artists.first().unwrap().clone().name
} else {
String::new()
}
.as_str(),
)
.replace(
"%title",
match playable.clone() {