spjspj - Add in promos from scg to grabbag. Fixed some badly numbered lands (probably more are bad).

This commit is contained in:
spjspj 2016-10-27 16:02:00 +11:00
parent c663cd24e9
commit 1dae8ca6b2
2 changed files with 824 additions and 336 deletions

View file

@ -363,6 +363,7 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
for (CardDownloadData card : allCardsUrls) {
file = new TFile(CardImageUtils.generateImagePath(card));
if (!file.exists()) {
logger.debug("Missing: " + file.getAbsolutePath());
cardsToDownload.add(card);
}
}
@ -646,12 +647,21 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
BufferedOutputStream out;
// Logger.getLogger(this.getClass()).info(url.toString());
URLConnection httpConn = url.openConnection(p);
setUpConnection(httpConn);
boolean useTempFile = false;
int responseCode = 0;
URLConnection httpConn = null;
if (temporaryFile != null && temporaryFile.length() > 100) {
useTempFile = true;
} else {
httpConn = url.openConnection(p);
setUpConnection(httpConn);
httpConn.connect();
int responseCode = ((HttpURLConnection) httpConn).getResponseCode();
if (responseCode == 200) {
responseCode = ((HttpURLConnection) httpConn).getResponseCode();
}
if (responseCode == 200 || useTempFile) {
if (!useTempFile) {
try (BufferedInputStream in = new BufferedInputStream(((HttpURLConnection) httpConn).getInputStream())) {
//try (BufferedInputStream in = new BufferedInputStream(url.openConnection(p).getInputStream())) {
out = new BufferedOutputStream(new TFileOutputStream(temporaryFile));
@ -672,6 +682,7 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
}
out.flush();
out.close();
}
if (card != null && card.isTwoFacedCard()) {
BufferedImage image = ImageIO.read(temporaryFile);
@ -690,7 +701,7 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
outputFile.getParentFile().mkdirs();
new TFile(temporaryFile).cp_rp(outputFile);
}
temporaryFile.delete();
//temporaryFile.delete();
} else {
outputFile.getParentFile().mkdirs();
new TFile(temporaryFile).cp_rp(outputFile);
@ -712,7 +723,7 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
logger.error(e, e);
} finally {
if (temporaryFile != null) {
temporaryFile.delete();
//temporaryFile.delete();
}
}
synchronized (sync) {