mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
spjspj - Add in promos from scg to grabbag. Fixed some badly numbered lands (probably more are bad).
This commit is contained in:
parent
c663cd24e9
commit
1dae8ca6b2
2 changed files with 824 additions and 336 deletions
File diff suppressed because it is too large
Load diff
|
@ -363,6 +363,7 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
|
||||||
for (CardDownloadData card : allCardsUrls) {
|
for (CardDownloadData card : allCardsUrls) {
|
||||||
file = new TFile(CardImageUtils.generateImagePath(card));
|
file = new TFile(CardImageUtils.generateImagePath(card));
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
|
logger.debug("Missing: " + file.getAbsolutePath());
|
||||||
cardsToDownload.add(card);
|
cardsToDownload.add(card);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -646,32 +647,42 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
|
||||||
BufferedOutputStream out;
|
BufferedOutputStream out;
|
||||||
|
|
||||||
// Logger.getLogger(this.getClass()).info(url.toString());
|
// Logger.getLogger(this.getClass()).info(url.toString());
|
||||||
URLConnection httpConn = url.openConnection(p);
|
boolean useTempFile = false;
|
||||||
setUpConnection(httpConn);
|
int responseCode = 0;
|
||||||
|
URLConnection httpConn = null;
|
||||||
httpConn.connect();
|
|
||||||
int responseCode = ((HttpURLConnection) httpConn).getResponseCode();
|
if (temporaryFile != null && temporaryFile.length() > 100) {
|
||||||
if (responseCode == 200) {
|
useTempFile = true;
|
||||||
try (BufferedInputStream in = new BufferedInputStream(((HttpURLConnection) httpConn).getInputStream())) {
|
} else {
|
||||||
//try (BufferedInputStream in = new BufferedInputStream(url.openConnection(p).getInputStream())) {
|
httpConn = url.openConnection(p);
|
||||||
out = new BufferedOutputStream(new TFileOutputStream(temporaryFile));
|
setUpConnection(httpConn);
|
||||||
byte[] buf = new byte[1024];
|
httpConn.connect();
|
||||||
int len;
|
responseCode = ((HttpURLConnection) httpConn).getResponseCode();
|
||||||
while ((len = in.read(buf)) != -1) {
|
}
|
||||||
// user cancelled
|
|
||||||
if (cancel) {
|
if (responseCode == 200 || useTempFile) {
|
||||||
in.close();
|
if (!useTempFile) {
|
||||||
out.flush();
|
try (BufferedInputStream in = new BufferedInputStream(((HttpURLConnection) httpConn).getInputStream())) {
|
||||||
out.close();
|
//try (BufferedInputStream in = new BufferedInputStream(url.openConnection(p).getInputStream())) {
|
||||||
temporaryFile.delete();
|
out = new BufferedOutputStream(new TFileOutputStream(temporaryFile));
|
||||||
return;
|
byte[] buf = new byte[1024];
|
||||||
|
int len;
|
||||||
|
while ((len = in.read(buf)) != -1) {
|
||||||
|
// user cancelled
|
||||||
|
if (cancel) {
|
||||||
|
in.close();
|
||||||
|
out.flush();
|
||||||
|
out.close();
|
||||||
|
temporaryFile.delete();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
out.write(buf, 0, len);
|
||||||
}
|
}
|
||||||
out.write(buf, 0, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
out.flush();
|
||||||
|
out.close();
|
||||||
}
|
}
|
||||||
out.flush();
|
|
||||||
out.close();
|
|
||||||
|
|
||||||
if (card != null && card.isTwoFacedCard()) {
|
if (card != null && card.isTwoFacedCard()) {
|
||||||
BufferedImage image = ImageIO.read(temporaryFile);
|
BufferedImage image = ImageIO.read(temporaryFile);
|
||||||
|
@ -690,7 +701,7 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
|
||||||
outputFile.getParentFile().mkdirs();
|
outputFile.getParentFile().mkdirs();
|
||||||
new TFile(temporaryFile).cp_rp(outputFile);
|
new TFile(temporaryFile).cp_rp(outputFile);
|
||||||
}
|
}
|
||||||
temporaryFile.delete();
|
//temporaryFile.delete();
|
||||||
} else {
|
} else {
|
||||||
outputFile.getParentFile().mkdirs();
|
outputFile.getParentFile().mkdirs();
|
||||||
new TFile(temporaryFile).cp_rp(outputFile);
|
new TFile(temporaryFile).cp_rp(outputFile);
|
||||||
|
@ -712,7 +723,7 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
|
||||||
logger.error(e, e);
|
logger.error(e, e);
|
||||||
} finally {
|
} finally {
|
||||||
if (temporaryFile != null) {
|
if (temporaryFile != null) {
|
||||||
temporaryFile.delete();
|
//temporaryFile.delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
synchronized (sync) {
|
synchronized (sync) {
|
||||||
|
|
Loading…
Reference in a new issue