Idris Kadri
Front & Back End Developer & Animator

Bulk Image Downloader

Github

Languages & Tools: Java

Downloads a list of images from a text file to a specific folder.


Sample Code



	

int attempts = 0;
linkCount = thisThread-1;

while (linkCount < links.length && !finish){

int percentage = (count*100)/links.length;
System.out.println("Completed " + percentage + "%... " + count + "|" + links.length + " Elapsed Time : " + ElapsedTimer.getElapsedTime() +" Thread : " + thisThread + " Failed : " + failed + "n");


try {

getUrl(links[linkCount]);
attempts = 0;
count++;
//linkCount+=threads;
linkCount++;

} catch (Exception e) {

System.out.println("failed to download... " + " link : " + links[linkCount] + " Failed : " + failed + " : " + e.getMessage());
System.out.println("attempts : " + attempts);

if(attempts >= 3){
failed++;
linkCount++;
attempts = 0;

try {
writer.append(links[linkCount] + "n");
}catch (Exception e1){}
}

else {
attempts++;
}
}
}

Back