Fixed a problem of image download for OGW.

This commit is contained in:
LevelX2 2016-01-10 22:13:30 +01:00
parent 688fe42f90
commit 7f4291ac07
2 changed files with 17 additions and 10 deletions

View file

@ -89,6 +89,8 @@ public class MythicspoilerComSource implements CardImageSource {
cardNameAliases.put("BFZ-unisonstrike", "tandemtactics");
cardNameAliases.put("BFZ-eldrazidevastator", "eldrazidevastator");
cardNameAliases.put("BFZ-kozliekschanneler", "kozilekschanneler");
cardNameAliases.put("OGW-wastes", "wastes1");
cardNameAliases.put("OGW-wastes2", "wastes2");
cardNameAliasesStart = new HashMap<>();
HashSet<String> names = new HashSet<>();
@ -156,16 +158,18 @@ public class MythicspoilerComSource implements CardImageSource {
if (cardName != null && !cardName.isEmpty()) {
if (cardNameAliases.containsKey(cardSet + "-" + cardName)) {
cardName = cardNameAliases.get(cardSet + "-" + cardName);
}
} else {
if (cardName.endsWith("1") || cardName.endsWith("2") || cardName.endsWith("3") || cardName.endsWith("4") || cardName.endsWith("5")) {
if (!cardName.startsWith("forest")
&& !cardName.startsWith("swamp")
&& !cardName.startsWith("mountain")
&& !cardName.startsWith("island")
&& !cardName.startsWith("plains")) {
cardName = cardName.substring(0, cardName.length() - 1);
}
}
}
setLinks.put(cardName, baseUrl + cardLink);
}
}
@ -203,7 +207,8 @@ public class MythicspoilerComSource implements CardImageSource {
}
@Override
public String generateTokenUrl(CardDownloadData card) {
public String generateTokenUrl(CardDownloadData card
) {
return null;
}

View file

@ -616,7 +616,9 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
new TFile(temporaryFile).cp_rp(outputFile);
}
} else {
logger.warn("Image download for " + card.getName() + "(" + card.getSet() + ") failed - responseCode: " + responseCode + " url: " + url.toString());
logger.warn("Image download for " + card.getName()
+ (!card.getDownloadName().equals(card.getName()) ? " downloadname: " + card.getDownloadName() : "")
+ "(" + card.getSet() + ") failed - responseCode: " + responseCode + " url: " + url.toString());
if (logger.isDebugEnabled()) { // Shows the returned html from the request to the web server
logger.debug("Return ed HTML ERROR:\n" + convertStreamToString(((HttpURLConnection) httpConn).getErrorStream()));
}