Skip to content

Commit

Permalink
Revert "Use scryfall for Download LQ Set Pictures instead of https://…
Browse files Browse the repository at this point in the history
  • Loading branch information
misha-colbourne committed Nov 20, 2024
1 parent ace3075 commit 3c94e14
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@ public void run() {
if(url.contains("api.scryfall.com")) {
conn.setInstanceFollowRedirects(true);
TimeUnit.MILLISECONDS.sleep(100);
fullborder = true;
} else {
conn.setInstanceFollowRedirects(false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,23 +62,20 @@ protected final Map<String, String> getNeededFiles() {
continue;
}

// if (!(existingSets.contains(setCode3) || existingSets.contains(setCode2))) {
// // If set doesn't exist on server, don't try to download cards for it
// if (!missingSets.contains(setCode3)) {
// missingSets.add(setCode3);
// System.out.println(setCode3 + " not found on server. Ignoring downloads for this set.");
// }
//
// continue;
// }

final String setCode = setCode3.toLowerCase();
addDLObject(ImageUtil.getScryfallDownloadUrl(c, "", setCode, "", false), ImageUtil.getImageKey(c, "", true), downloads, true);
// addDLObject(ImageUtil.getDownloadUrl(c, ""), ImageUtil.getImageKey(c, "", true), downloads);
if (!(existingSets.contains(setCode3) || existingSets.contains(setCode2))) {
// If set doesn't exist on server, don't try to download cards for it
if (!missingSets.contains(setCode3)) {
missingSets.add(setCode3);
System.out.println(setCode3 + " not found on server. Ignoring downloads for this set.");
}

continue;
}

addDLObject(ImageUtil.getDownloadUrl(c, ""), ImageUtil.getImageKey(c, "", true), downloads);

if (c.hasBackFace()) {
// addDLObject(ImageUtil.getDownloadUrl(c, "back"), ImageUtil.getImageKey(c, "back", true), downloads);
addDLObject(ImageUtil.getScryfallDownloadUrl(c, "back", setCode, "", false), ImageUtil.getImageKey(c, "back", true), downloads, true);
addDLObject(ImageUtil.getDownloadUrl(c, "back"), ImageUtil.getImageKey(c, "back", true), downloads);
}
}

Expand All @@ -90,7 +87,7 @@ protected final Map<String, String> getNeededFiles() {
return downloads;
}

private static void addDLObject(final String urlPath, final String filename, final Map<String, String> downloads, final boolean scryfall) {
private static void addDLObject(final String urlPath, final String filename, final Map<String, String> downloads) {
final File destFile = new File(ForgeConstants.CACHE_CARD_PICS_DIR, filename + ".jpg");
String modifier = !filename.contains(".full") ? ".fullborder" : "";
final File fullborder = new File(ForgeConstants.CACHE_CARD_PICS_DIR, TextUtil.fastReplace(filename, ".full", ".fullborder") + modifier + ".jpg");
Expand All @@ -99,8 +96,7 @@ private static void addDLObject(final String urlPath, final String filename, fin
return; //don't add on download if you have an existing fullborder image in this set...

if (!destFile.exists()) {
String url = scryfall ? ForgeConstants.URL_PIC_SCRYFALL_DOWNLOAD + urlPath : ForgeConstants.URL_PIC_DOWNLOAD + urlPath;
downloads.put(destFile.getAbsolutePath(), url);
downloads.put(destFile.getAbsolutePath(), ForgeConstants.URL_PIC_DOWNLOAD + urlPath);
}
}
}

0 comments on commit 3c94e14

Please sign in to comment.