diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/GfycatRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/GfycatRipper.java index 78a0af19..97afef94 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/GfycatRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/GfycatRipper.java @@ -112,11 +112,7 @@ public class GfycatRipper extends AbstractHTMLRipper { @Override public String getStatusText() { - return String.valueOf(getCompletionPercentage()) + - "% - " + - Utils.bytesToHumanReadable(bytesCompleted) + - " / " + - Utils.bytesToHumanReadable(bytesTotal); + return Utils.getByteStatusText(getCompletionPercentage(), bytesCompleted, bytesTotal); } @Override diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/GfycatporntubeRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/GfycatporntubeRipper.java index d8f629ae..9010eb0e 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/GfycatporntubeRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/GfycatporntubeRipper.java @@ -65,11 +65,7 @@ public class GfycatporntubeRipper extends AbstractHTMLRipper { @Override public String getStatusText() { - return String.valueOf(getCompletionPercentage()) + - "% - " + - Utils.bytesToHumanReadable(bytesCompleted) + - " / " + - Utils.bytesToHumanReadable(bytesTotal); + return Utils.getByteStatusText(getCompletionPercentage(), bytesCompleted, bytesTotal); } @Override diff --git a/src/main/java/com/rarchives/ripme/utils/Utils.java b/src/main/java/com/rarchives/ripme/utils/Utils.java index 5821e9f3..e57acf77 100644 --- a/src/main/java/com/rarchives/ripme/utils/Utils.java +++ b/src/main/java/com/rarchives/ripme/utils/Utils.java @@ -715,4 +715,20 @@ public class Utils { } } + /** + * Formats and reuturns the status text for rippers using the byte progress bar + * + * @param completionPercentage An int between 0 and 100 which repersents how close the download is to complete + * @param bytesCompleted How many bytes have been downloaded + * @param bytesTotal The total size of the file that is being downloaded + * @return Returns the formatted status text for rippers using the byte progress bar + */ + public static String getByteStatusText(int completionPercentage, int bytesCompleted, int bytesTotal) { + return String.valueOf(completionPercentage) + + "% - " + + Utils.bytesToHumanReadable(bytesCompleted) + + " / " + + Utils.bytesToHumanReadable(bytesTotal); + } + } \ No newline at end of file