diff options
-rw-r--r-- | src/main/java/soundchan/BotListener/BotListener.java | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/main/java/soundchan/BotListener/BotListener.java b/src/main/java/soundchan/BotListener/BotListener.java index a120a14..6e928e6 100644 --- a/src/main/java/soundchan/BotListener/BotListener.java +++ b/src/main/java/soundchan/BotListener/BotListener.java @@ -268,9 +268,13 @@ public class BotListener extends ListenerAdapter{ if(currentlyPlaying != null) { message = "Currently Playing: " + currentlyPlaying.getInfo().title + " by " + currentlyPlaying.getInfo().author; if(printStatus) { - message += ( "\nTime : " + currentlyPlaying.getPosition() + " | " + currentlyPlaying.getDuration() - + "\nPaused = " + musicManager.player.isPaused() - + "\nVolume = " + musicManager.player.getVolume() + "%"); + message += ( "\nTime : " + genTimeStamp(currentlyPlaying.getPosition()) + " | " + genTimeStamp(currentlyPlaying.getDuration()) ); + if(musicManager.player.isPaused()) { + message += "\n**Paused**"; + } else { + message += "\n*Playing*"; + } + message += ( "\nVolume = " + musicManager.player.getVolume() + "%"); } } else { message = "Nothing currently playing"; @@ -382,6 +386,19 @@ public class BotListener extends ListenerAdapter{ } /** + * Creates a timestamp string from a number of milliseconds + * @param durationInMillis Number of milliseconds to turn into timestamp + * @return Timestamp in form HH:MM:ss:SSSS + */ + private static String genTimeStamp(long durationInMillis) { + long millis = durationInMillis % 1000; + long second = (durationInMillis / 1000) % 60; + long minute = (durationInMillis / (1000 * 60)) % 60; + long hour = (durationInMillis / (1000 * 60 * 60)) % 24; + return String.format("%02d:%02d:%02d.%d", hour, minute, second, millis); + } + + /** * Checks the string for some reason to enable/disable a setting. * @param value A string (probably read in from config file) * @return True if it matches a value to enable, False otherwise |