aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Kohls <mattkohls13@gmail.com>2018-10-30 15:27:36 -0400
committerMatt Kohls <mattkohls13@gmail.com>2018-10-30 15:27:36 -0400
commit7360a197c9c09ffa239b0c56712202e8320b9e22 (patch)
tree679dafd7282fed46d3fde19b9c6f9aa70b8b31e2
parentb8e124c7ed303dfb1a3ad4295936abea79533101 (diff)
downloadSoundChan-7360a197c9c09ffa239b0c56712202e8320b9e22.tar.gz
SoundChan-7360a197c9c09ffa239b0c56712202e8320b9e22.tar.bz2
SoundChan-7360a197c9c09ffa239b0c56712202e8320b9e22.zip
Adding progressbar
-rw-r--r--src/main/java/soundchan/BotListener/BotListener.java22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/main/java/soundchan/BotListener/BotListener.java b/src/main/java/soundchan/BotListener/BotListener.java
index 6e928e6..05ebec1 100644
--- a/src/main/java/soundchan/BotListener/BotListener.java
+++ b/src/main/java/soundchan/BotListener/BotListener.java
@@ -268,7 +268,7 @@ public class BotListener extends ListenerAdapter{
if(currentlyPlaying != null) {
message = "Currently Playing: " + currentlyPlaying.getInfo().title + " by " + currentlyPlaying.getInfo().author;
if(printStatus) {
- message += ( "\nTime : " + genTimeStamp(currentlyPlaying.getPosition()) + " | " + genTimeStamp(currentlyPlaying.getDuration()) );
+ message += genTimeInformation(currentlyPlaying.getPosition(), currentlyPlaying.getDuration());
if(musicManager.player.isPaused()) {
message += "\n**Paused**";
} else {
@@ -386,6 +386,26 @@ public class BotListener extends ListenerAdapter{
}
/**
+ * Creates a block of time information with a progressbar
+ * @param currentMillis Current position in the audio in milliseconds
+ * @param durationMillis Length of audio in milliseconds
+ * @return Time information block
+ */
+ private static String genTimeInformation(long currentMillis, long durationMillis) {
+ String message = "|";
+ int fill = (int) ((double)(currentMillis / durationMillis)) * 10;
+ for(int i = 0; i < fill; i++) {
+ message += "--";
+ }
+ message += "<>";
+ for(int i = fill; i < 10; i++) {
+ message += "--";
+ }
+ message += "|\nTime : " + genTimeStamp(currentMillis) + " | " + genTimeStamp(durationMillis);
+ return message;
+ }
+
+ /**
* 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