Added the helper func getByteStatusText to cut down on copy pasted code
This commit is contained in:
parent
ed7df108e5
commit
1f8e9184c7
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user