diff options
Diffstat (limited to '')
| -rw-r--r-- | src/queue.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/queue.rs b/src/queue.rs index dca8e3d..9e8e1af 100644 --- a/src/queue.rs +++ b/src/queue.rs | |||
| @@ -96,7 +96,7 @@ impl Track { | |||
| 96 | } | 96 | } |
| 97 | } | 97 | } |
| 98 | 98 | ||
| 99 | pub fn display_string(&self, index: usize) -> String { | 99 | pub fn display_string(&self, index: usize, total: usize) -> String { |
| 100 | let album_artist = self | 100 | let album_artist = self |
| 101 | .artist | 101 | .artist |
| 102 | .clone() | 102 | .clone() |
| @@ -109,11 +109,12 @@ impl Track { | |||
| 109 | .unwrap_or("Unknown") | 109 | .unwrap_or("Unknown") |
| 110 | .to_string() | 110 | .to_string() |
| 111 | }); | 111 | }); |
| 112 | let width = total.to_string().len(); | ||
| 112 | 113 | ||
| 113 | if album_artist.is_empty() { | 114 | if album_artist.is_empty() { |
| 114 | format!("{}. {}", index + 1, title) | 115 | format!("{:0width$}. {}", index + 1, title) |
| 115 | } else { | 116 | } else { |
| 116 | format!("{}. {} - {}", index + 1, album_artist, title) | 117 | format!("{:0width$}. {} - {}", index + 1, album_artist, title) |
| 117 | } | 118 | } |
| 118 | } | 119 | } |
| 119 | } | 120 | } |
