1
0
mirror of https://github.com/RipMeApp/ripme.git synced 2025-08-15 10:24:04 +02:00

Moved if statement outide of loop

This commit is contained in:
cyian-1756
2018-10-07 09:00:46 -04:00
parent bf6987174b
commit 21a86d8287

View File

@@ -214,27 +214,24 @@ class DownloadFileThread extends Thread {
} }
byte[] data = new byte[1024 * 256]; byte[] data = new byte[1024 * 256];
int bytesRead; int bytesRead;
boolean shouldSkipFileDownload = huc.getContentLength() / 10000000 >= 10; boolean shouldSkipFileDownload = huc.getContentLength() / 10000000 >= 10 && AbstractRipper.isThisATest();
while ( (bytesRead = bis.read(data)) != -1) { // If this is a test rip we skip large downloads
try { if (shouldSkipFileDownload) {
observer.stopCheck(); logger.debug("Not downloading whole file because it is over 10mb and this is a test");
} catch (IOException e) { } else {
observer.downloadErrored(url, rb.getString("download.interrupted")); while ((bytesRead = bis.read(data)) != -1) {
return; try {
} observer.stopCheck();
fos.write(data, 0, bytesRead); } catch (IOException e) {
if (observer.useByteProgessBar()) { observer.downloadErrored(url, rb.getString("download.interrupted"));
bytesDownloaded += bytesRead; return;
observer.setBytesCompleted(bytesDownloaded); }
observer.sendUpdate(STATUS.COMPLETED_BYTES, bytesDownloaded); fos.write(data, 0, bytesRead);
} if (observer.useByteProgessBar()) {
// If this is a test and we're downloading a large file bytesDownloaded += bytesRead;
if (AbstractRipper.isThisATest() && shouldSkipFileDownload) { observer.setBytesCompleted(bytesDownloaded);
logger.debug("Not downloading whole file because it is over 10mb and this is a test"); observer.sendUpdate(STATUS.COMPLETED_BYTES, bytesDownloaded);
bis.close(); }
fos.close();
break;
} }
} }
bis.close(); bis.close();