Fix on Android downloader and code indent

This commit is contained in:
valfieri
2019-08-23 12:58:10 +02:00
parent 30622010df
commit 9dfd513ad3
2 changed files with 550 additions and 712 deletions
@@ -4,9 +4,11 @@ import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import java.util.Enumeration;
import net.lingala.zip4j.model.ZipParameters;
import net.lingala.zip4j.model.enums.CompressionMethod;
@@ -35,7 +37,8 @@ public class ImgDownloader {
break;
out.append(buffer, 0, rsz);
}
} catch (Exception e) {}
} catch (Exception e) {
}
return out.toString();
}
@@ -97,19 +100,21 @@ public class ImgDownloader {
bos.close();
cardsfilepath = filePath.toString();
todelete = true;
} catch (Exception ex) {}
} catch (Exception ex) {
}
break;
}
}
}
}
} catch (IOException ioe){ }
finally {
} catch (IOException ioe) {
} finally {
try {
if (zipFile != null) {
zipFile.close();
}
} catch (IOException ioe) {}
} catch (IOException ioe) {
}
}
} else {
File setFolder = new File(path + File.separator + "sets" + File.separator + setName + File.separator);
@@ -148,9 +153,11 @@ public class ImgDownloader {
return tokendoc;
}
}
} catch (Exception e) {}
} catch (Exception e) {
}
}
} catch (Exception e) {
}
} catch (Exception e){}
System.out.println("Warning: Token " + name + " has not been found between " + set + " tokens, i will search for it between any other set...");
for (int i = 1; i < availableSets.length; i++) {
String currentSet = availableSets[i].toLowerCase().split(" - ")[0];
@@ -170,9 +177,11 @@ public class ImgDownloader {
return tokendoc;
}
}
} catch (Exception e) {}
} catch (Exception e) {
}
}
} catch (Exception e) {
}
} catch (Exception e) {}
}
}
System.err.println("Error: Token " + name + " has not been found between any set of " + imageurl);
@@ -267,7 +276,7 @@ public class ImgDownloader {
int lastIndex = lines.indexOf(findStr);
String totals = lines.substring(lastIndex, lines.indexOf("\n", lastIndex));
totalcards = Integer.parseInt(totals.split("=")[1]);
for (int i = 0; i < totalcards; i++) {
while (lines.contains("[card]")) {
findStr = "[card]";
lastIndex = lines.indexOf(findStr);
String id = null;
@@ -593,7 +602,8 @@ public class ImgDownloader {
try {
File oldzip = new File(destinationPath + "/" + set + "/" + set + ".zip");
oldzip.delete();
} catch (Exception e) {}
} catch (Exception e) {
}
ZipParameters zipParameters = new ZipParameters();
zipParameters.setCompressionMethod(CompressionMethod.STORE);
File folder = new File(destinationPath + set + "/");
File diff suppressed because it is too large Load Diff