mirror of
https://github.com/RipMeApp/ripme.git
synced 2025-08-14 01:44:12 +02:00
Merge pull request #989 from cyian-1756/downloaderCleanUp
Moved if statement outide of loop
This commit is contained in:
@@ -228,7 +228,11 @@ 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();
|
||||||
|
// If this is a test rip we skip large downloads
|
||||||
|
if (shouldSkipFileDownload) {
|
||||||
|
logger.debug("Not downloading whole file because it is over 10mb and this is a test");
|
||||||
|
} else {
|
||||||
while ((bytesRead = bis.read(data)) != -1) {
|
while ((bytesRead = bis.read(data)) != -1) {
|
||||||
try {
|
try {
|
||||||
observer.stopCheck();
|
observer.stopCheck();
|
||||||
@@ -242,13 +246,6 @@ class DownloadFileThread extends Thread {
|
|||||||
observer.setBytesCompleted(bytesDownloaded);
|
observer.setBytesCompleted(bytesDownloaded);
|
||||||
observer.sendUpdate(STATUS.COMPLETED_BYTES, bytesDownloaded);
|
observer.sendUpdate(STATUS.COMPLETED_BYTES, bytesDownloaded);
|
||||||
}
|
}
|
||||||
// If this is a test and we're downloading a large file
|
|
||||||
if (AbstractRipper.isThisATest() && shouldSkipFileDownload) {
|
|
||||||
logger.debug("Not downloading whole file because it is over 10mb and this is a test");
|
|
||||||
bis.close();
|
|
||||||
fos.close();
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bis.close();
|
bis.close();
|
||||||
|
Reference in New Issue
Block a user