From 03ffc9d9948e6e1f6526b2665eb7c2c2914b5c54 Mon Sep 17 00:00:00 2001 From: Nekojimi Date: Mon, 4 Oct 2021 18:55:21 +0100 Subject: [PATCH] Output artist and track number in Song.toString() --- src/main/java/moe/nekojimi/chords/Song.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main/java/moe/nekojimi/chords/Song.java b/src/main/java/moe/nekojimi/chords/Song.java index 72ba243..2a9557d 100644 --- a/src/main/java/moe/nekojimi/chords/Song.java +++ b/src/main/java/moe/nekojimi/chords/Song.java @@ -103,10 +103,17 @@ public class Song @Override public String toString() { + String ret = ""; + if (artist != null && !artist.isEmpty()) + ret += artist + " - "; + if (title != null && !title.isEmpty()) - return title; - else - return "track " + number; + ret += title; + + if (ret.isEmpty()) + ret = "track " + number; + + return "[" + number + "] " + ret; // return url.toExternalForm(); } }