update imagefetcher

This commit is contained in:
Anthony Calosa
2023-04-09 07:55:57 +08:00
parent 2edb504444
commit 04e638b789
3 changed files with 15 additions and 0 deletions

View File

@@ -169,6 +169,17 @@ public class ImageUtil {
String cardCollectorNumber = cp.getCollectorNumber();
// Hack to account for variations in Arabian Nights
cardCollectorNumber = cardCollectorNumber.replace("+", "");
// override old planechase sets from their modified id since scryfall move the planechase cards outside their original setcode
if (cardCollectorNumber.startsWith("OHOP")) {
editionCode = "ohop";
cardCollectorNumber = cardCollectorNumber.substring("OHOP".length());
} else if (cardCollectorNumber.startsWith("OPCA")) {
editionCode = "opca";
cardCollectorNumber = cardCollectorNumber.substring("OPCA".length());
} else if (cardCollectorNumber.startsWith("OPC2")) {
editionCode = "opc2";
cardCollectorNumber = cardCollectorNumber.substring("OPC2".length());
}
String versionParam = useArtCrop ? "art_crop" : "normal";
String faceParam = "";
if (cp.getRules().getOtherPart() != null) {

View File

@@ -30,6 +30,8 @@ public class SwingImageFetcher extends ImageFetcher {
private void doFetch(String urlToDownload) throws IOException {
String newdespath = urlToDownload.contains(".fullborder.jpg") ?
TextUtil.fastReplace(destPath, ".full.jpg", ".fullborder.jpg") : destPath;
if (!newdespath.contains(".full") && urlToDownload.startsWith(ForgeConstants.URL_PIC_SCRYFALL_DOWNLOAD))
newdespath = newdespath.replace(".jpg", ".fullborder.jpg"); //fix planes/phenomenon for round border options
URL url = new URL(urlToDownload);
System.out.println("Attempting to fetch: " + url);
BufferedImage image = ImageIO.read(url);

View File

@@ -33,6 +33,8 @@ public class LibGDXImageFetcher extends ImageFetcher {
private void doFetch(String urlToDownload) throws IOException {
String newdespath = urlToDownload.contains(".fullborder.") || urlToDownload.startsWith(ForgeConstants.URL_PIC_SCRYFALL_DOWNLOAD) ?
TextUtil.fastReplace(destPath, ".full.", ".fullborder.") : destPath;
if (!newdespath.contains(".full") && urlToDownload.startsWith(ForgeConstants.URL_PIC_SCRYFALL_DOWNLOAD))
newdespath = newdespath.replace(".jpg", ".fullborder.jpg"); //fix planes/phenomenon for round border options
URL url = new URL(urlToDownload);
System.out.println("Attempting to fetch: " + url);
java.net.URLConnection c = url.openConnection();