Skip to content

Commit

Permalink
feat: add %artist formatting option
Browse files Browse the repository at this point in the history
* add %artist formating option to only show one artist

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

* punctuation.
  • Loading branch information
emrik5 authored Dec 29, 2024
1 parent 37b4fc9 commit 75d6b94
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions doc/users.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
9 changes: 9 additions & 0 deletions src/model/playable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 75d6b94

Please sign in to comment.