Removed obsolete 6th Edition workarounds.

Removed from the ScryfallImageSource and ScryfallImageSupportCards classes.
This commit is contained in:
Thomas Hess 2020-03-18 21:44:05 +01:00
parent 7219d51572
commit 5a812a448f
No known key found for this signature in database
GPG key ID: 98602F47D161B13C
2 changed files with 0 additions and 125 deletions

View file

@ -152,8 +152,6 @@ public enum ScryfallImageSource implements CardImageSource {
preparedUrls.clear();
final List<ExpansionSet.SetCardInfo> sixthEditionCards = Sets.findSet("6ED").getSetCardInfo();
for (CardDownloadData card : downloadList) {
// need cancel
if (downloadServiceInfo.isNeedCancel()) {
@ -179,27 +177,6 @@ public enum ScryfallImageSource implements CardImageSource {
preparedUrls.put(card, url);
}
// if a S00 card is in 6ED, it's actually a 6ED card
if (card.getSet().equals("S00") && sixthEditionCards.stream().anyMatch(sixthEditionCard -> sixthEditionCard.getName().equals(card.getName()))) {
// we have direct links for the lands because there are multiple search results
if (card.getUsesVariousArt()) { // lands are the only defined multiple art cards in S00 in XMage
continue;
}
String url = null;
try {
url = searchCard(proxy, "6ED", card.getName());
} catch (Exception e) {
logger.warn("Failed to prepare image URL (S00) for " + card.getName() + " (" + card.getSet() + ") #" + card.getCollectorId());
downloadServiceInfo.incErrorCount();
continue;
}
preparedUrls.put(card, url);
}
// inc error count to stop on too many errors
// downloadServiceInfo.incErrorCount();
}
@ -207,24 +184,6 @@ public enum ScryfallImageSource implements CardImageSource {
return true;
}
private String searchCard(Proxy proxy, String set, String name) throws Exception {
final URL searchUrl = new URL("https://api.scryfall.com/cards/search?q=s:" + CardUtil.urlEncode(set + " " + name));
URLConnection request = proxy == null ? searchUrl.openConnection() : searchUrl.openConnection(proxy);
request.connect();
// parse the response and return the image URI from the correct card face
JsonParser jp = new JsonParser();
JsonElement root = jp.parse(new InputStreamReader((InputStream) request.getContent()));
JsonObject searchResult = root.getAsJsonObject();
if (searchResult.get("total_cards").getAsInt() != 1) {
throw new Exception("Card not found in Scryfall.");
}
JsonObject jsonCard = searchResult.getAsJsonArray("data").get(0).getAsJsonObject();
JsonObject jsonImageUris = jsonCard.getAsJsonObject("image_uris");
return jsonImageUris.get("large").getAsString();
}
@Override
public CardImageUrls generateCardUrl(CardDownloadData card) throws Exception {
return innerGenerateURL(card, false);

View file

@ -513,90 +513,6 @@ public class ScryfallImageSupportCards {
// 2014 - https://scryfall.com/sets/pdp14
put("DPAP/Soul of Ravnica", "https://api.scryfall.com/cards/pdp14/1/en?format=image");
put("DPAP/Soul of Zendikar", "https://api.scryfall.com/cards/pdp14/2/en?format=image");
// Gateway Promos -- xmage uses one set (GRC), but scryfall store it by years
// 2006 - https://scryfall.com/sets/pgtw
put("GRC/Fiery Temper", "https://api.scryfall.com/cards/pgtw/3/en?format=image");
put("GRC/Icatian Javelineers", "https://api.scryfall.com/cards/pgtw/2/en?format=image");
put("GRC/Wood Elves", "https://api.scryfall.com/cards/pgtw/1/en?format=image");
// 2007 - https://scryfall.com/sets/pg07
put("GRC/Boomerang", "https://api.scryfall.com/cards/pg07/4/en?format=image");
put("GRC/Calciderm", "https://api.scryfall.com/cards/pg07/5/en?format=image");
put("GRC/Dauntless Dourbark", "https://api.scryfall.com/cards/pg07/12/en?format=image");
put("GRC/Llanowar Elves", "https://api.scryfall.com/cards/pg07/9/en?format=image");
put("GRC/Mind Stone", "https://api.scryfall.com/cards/pg07/11/en?format=image");
put("GRC/Mogg Fanatic", "https://api.scryfall.com/cards/pg07/10/en?format=image");
put("GRC/Reckless Wurm", "https://api.scryfall.com/cards/pg07/6/en?format=image");
put("GRC/Yixlid Jailer", "https://api.scryfall.com/cards/pg07/7/en?format=image");
put("GRC/Zoetic Cavern", "https://api.scryfall.com/cards/pg07/8/en?format=image");
// 2008a - https://scryfall.com/sets/pg08
put("GRC/Boggart Ram-Gang", "https://api.scryfall.com/cards/pg08/17/en?format=image");
put("GRC/Cenn's Tactician", "https://api.scryfall.com/cards/pg08/14/en?format=image");
put("GRC/Duergar Hedge-Mage", "https://api.scryfall.com/cards/pg08/19/en?format=image");
put("GRC/Gravedigger", "https://api.scryfall.com/cards/pg08/16/en?format=image");
put("GRC/Lava Axe", "https://api.scryfall.com/cards/pg08/13/en?format=image");
put("GRC/Oona's Blackguard", "https://api.scryfall.com/cards/pg08/15/en?format=image");
put("GRC/Selkie Hedge-Mage", "https://api.scryfall.com/cards/pg08/20/en?format=image");
put("GRC/Wilt-Leaf Cavaliers", "https://api.scryfall.com/cards/pg08/18/en?format=image");
// Wizards Play Network Promos -- xmage uses one set (GRC), but scryfall store it by years
// 2008b - https://scryfall.com/sets/pwpn
put("GRC/Sprouting Thrinax", "https://api.scryfall.com/cards/pwpn/21/en?format=image");
put("GRC/Woolly Thoctar", "https://api.scryfall.com/cards/pwpn/22/en?format=image");
// 2009 - https://scryfall.com/sets/pwp09
put("GRC/Hellspark Elemental", "https://api.scryfall.com/cards/pwp09/25/en?format=image");
put("GRC/Kor Duelist", "https://api.scryfall.com/cards/pwp09/32/en?format=image");
put("GRC/Marisi's Twinclaws", "https://api.scryfall.com/cards/pwp09/26/en?format=image");
put("GRC/Mind Control", "https://api.scryfall.com/cards/pwp09/30/en?format=image");
put("GRC/Path to Exile", "https://api.scryfall.com/cards/pwp09/24/en?format=image");
put("GRC/Rise from the Grave", "https://api.scryfall.com/cards/pwp09/31/en?format=image");
put("GRC/Slave of Bolas", "https://api.scryfall.com/cards/pwp09/27/en?format=image");
put("GRC/Vampire Nighthawk", "https://api.scryfall.com/cards/pwp09/33/en?format=image");
// 2010 - https://scryfall.com/sets/pwp10
put("GRC/Kor Firewalker", "https://api.scryfall.com/cards/pwp10/36/en?format=image");
put("GRC/Leatherback Baloth", "https://api.scryfall.com/cards/pwp10/37/en?format=image");
put("GRC/Syphon Mind", "https://api.scryfall.com/cards/pwp10/40/en?format=image");
put("GRC/Pathrazer of Ulamog", "https://api.scryfall.com/cards/pwp10/46/en?format=image");
put("GRC/Curse of Wizardry", "https://api.scryfall.com/cards/pwp10/47/en?format=image");
put("GRC/Fling/50", "https://api.scryfall.com/cards/pwp10/50/en?format=image"); // same card but different year
put("GRC/Sylvan Ranger/51", "https://api.scryfall.com/cards/pwp10/51/en?format=image"); // same card but different year
put("GRC/Plague Stinger", "https://api.scryfall.com/cards/pwp10/59/en?format=image");
put("GRC/Golem's Heart", "https://api.scryfall.com/cards/pwp10/60/en?format=image");
put("GRC/Skinrender", "https://api.scryfall.com/cards/pwp10/63/en?format=image");
// 2011 - https://scryfall.com/sets/pwp11
put("GRC/Auramancer", "https://api.scryfall.com/cards/pwp11/77/en?format=image");
put("GRC/Bloodcrazed Neonate", "https://api.scryfall.com/cards/pwp11/83/en?format=image");
put("GRC/Boneyard Wurm", "https://api.scryfall.com/cards/pwp11/84/en?format=image");
put("GRC/Circle of Flame", "https://api.scryfall.com/cards/pwp11/78/en?format=image");
put("GRC/Curse of the Bloody Tome", "https://api.scryfall.com/cards/pwp11/80/en?format=image");
put("GRC/Fling/69", "https://api.scryfall.com/cards/pwp11/69/en?format=image"); // same card but different year
put("GRC/Master's Call", "https://api.scryfall.com/cards/pwp11/64/en?format=image");
put("GRC/Maul Splicer", "https://api.scryfall.com/cards/pwp11/72/en?format=image");
put("GRC/Plague Myr", "https://api.scryfall.com/cards/pwp11/65/en?format=image");
put("GRC/Shrine of Burning Rage", "https://api.scryfall.com/cards/pwp11/73/en?format=image");
put("GRC/Signal Pest", "https://api.scryfall.com/cards/pwp11/66/en?format=image");
put("GRC/Sylvan Ranger/70", "https://api.scryfall.com/cards/pwp11/70/en?format=image"); // same card but different year
put("GRC/Tormented Soul", "https://api.scryfall.com/cards/pwp11/76/en?format=image");
put("GRC/Vault Skirge", "https://api.scryfall.com/cards/pwp11/71/en?format=image");
// 2012 - https://scryfall.com/sets/pwp12
put("GRC/Curse of Thirst", "https://api.scryfall.com/cards/pwp12/81/en?format=image");
put("GRC/Gather the Townsfolk", "https://api.scryfall.com/cards/pwp12/79/en?format=image");
put("GRC/Nearheath Stalker", "https://api.scryfall.com/cards/pwp12/82/en?format=image");
// Spined Wurm print in Starter 2000 is actually from Magazine Inserts
put("S00/Spined Wurm", "https://api.scryfall.com/cards/pmei/11/en?format=image");
// Most of the other S00 cards are from 6ED
// We'll download lands manually because we have multiple arts and XMage has totally different ID's
put("S00/Forest/49", "https://api.scryfall.com/cards/6ed/347/en?format=image");
put("S00/Forest/50", "https://api.scryfall.com/cards/6ed/348/en?format=image");
put("S00/Island/51", "https://api.scryfall.com/cards/6ed/335/en?format=image");
put("S00/Island/52", "https://api.scryfall.com/cards/6ed/336/en?format=image");
put("S00/Mountain/53", "https://api.scryfall.com/cards/6ed/343/en?format=image");
put("S00/Mountain/54", "https://api.scryfall.com/cards/6ed/344/en?format=image");
put("S00/Plains/55", "https://api.scryfall.com/cards/6ed/331/en?format=image");
put("S00/Plains/56", "https://api.scryfall.com/cards/6ed/332/en?format=image");
put("S00/Swamp/57", "https://api.scryfall.com/cards/6ed/339/en?format=image");
put("S00/Swamp/58", "https://api.scryfall.com/cards/6ed/340/en?format=image");
}
};