Fix set symbols in gatherer

This commit is contained in:
rafaeldamasceno 2019-06-23 19:54:58 +01:00
parent d0638e71af
commit a6f09e5e60

View file

@ -6,12 +6,14 @@ import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import mage.cards.ExpansionSet; import mage.cards.ExpansionSet;
import mage.cards.Sets; import mage.cards.Sets;
import mage.client.constants.Constants; import mage.client.constants.Constants;
import mage.constants.Rarity; import mage.constants.Rarity;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.mage.plugins.card.dl.DownloadJob; import org.mage.plugins.card.dl.DownloadJob;
import static org.mage.plugins.card.dl.DownloadJob.fromURL; import static org.mage.plugins.card.dl.DownloadJob.fromURL;
import static org.mage.plugins.card.dl.DownloadJob.toFile; import static org.mage.plugins.card.dl.DownloadJob.toFile;
import static org.mage.plugins.card.utils.CardImageUtils.getImagesDir; import static org.mage.plugins.card.utils.CardImageUtils.getImagesDir;
@ -27,12 +29,12 @@ public class GathererSets implements Iterable<DownloadJob> {
boolean haveRare; boolean haveRare;
boolean haveMyth; boolean haveMyth;
private CheckResult(String ACode, ExpansionSet ASet, boolean AHaveCommon, boolean AHaveUncommon, boolean AHhaveRare, boolean AHaveMyth) { private CheckResult(String ACode, ExpansionSet ASet, boolean AHaveCommon, boolean AHaveUncommon, boolean AHaveRare, boolean AHaveMyth) {
code = ACode; code = ACode;
set = ASet; set = ASet;
haveCommon = AHaveCommon; haveCommon = AHaveCommon;
haveUncommon = AHaveUncommon; haveUncommon = AHaveUncommon;
haveRare = AHhaveRare; haveRare = AHaveRare;
haveMyth = AHaveMyth; haveMyth = AHaveMyth;
} }
} }
@ -65,8 +67,9 @@ public class GathererSets implements Iterable<DownloadJob> {
"W16", "W17", "W16", "W17",
// "APAC" -- gatherer do not have that set, scryfall has PALP // "APAC" -- gatherer do not have that set, scryfall has PALP
// "ARENA" -- is't many set with different codes, not one // "ARENA" -- is't many set with different codes, not one
"CLASH", "CP", "DD3GVL", "DPA", "EURO", "FNMP", "GPX", "GRC", "GUR", "H17", "JR", "MBP", "MGDC", "MLP", "MPRP", "MPS-AKH", "PTC", "S00", "S99", "SUS", "SWS", "UGIN", "UGL", "V10", "V17", "WMCQ", // need to fix // "ATH" -- has cards from many sets, symbol does not exist on gatherer
"H09", "PD2", "PD3", "UNH", "CM1", "V11", "A25", "UST", "IMA", "DD2", "EVG", "DDC", "DDE", "DDD", "8EB", "9EB", "CHR" // ok // "CLASH", "CP", "DPA", "EURO", "FNMP", "GPX", "GRC", "GUR", "H17", "JR", "MBP", "MGDC", "MLP", "MPRP", "PTC", "SUS", "SWS", "WMCQ", // need to fix
"H09", "PD2", "PD3", "UNH", "CM1", "V11", "A25", "UST", "IMA", "DD2", "EVG", "DDC", "DDE", "DDD", "8EB", "9EB", "CHR", "G18", "DD3GVL", "S00", "S99", "UGL" // ok
// current testing // current testing
}; };
@ -84,7 +87,7 @@ public class GathererSets implements Iterable<DownloadJob> {
"THS", "BNG", "JOU", "THS", "BNG", "JOU",
"CNS", "CN2", "CNS", "CN2",
"VMA", "TPR", "VMA", "TPR",
"KTK", "FRF", "DTK", "KTK", "FRF", "UGIN", "DTK",
"BFZ", "OGW", "BFZ", "OGW",
"SOI", "EMN", "SOI", "EMN",
"KLD", "AER", "KLD", "AER",
@ -92,14 +95,19 @@ public class GathererSets implements Iterable<DownloadJob> {
"XLN", "C17", "XLN", "C17",
"RIX", "DOM", "M19", "RIX", "DOM", "M19",
"E01", "CM2", "E02", "E01", "CM2", "E02",
"GS1", "BBD", "C18" "GS1", "BBD", "C18",
"GNT", "UMA", "GRN",
"RNA", "WAR", "MH1",
"M20"
// "HHO", "ANA" -- do not exist on gatherer
}; };
private static final String[] symbolsOnlyMyth = { private static final String[] symbolsOnlyMyth = {
"DRB", "V09", "V12", "V13", "V14", "V15", "V16", "EXP" "DRB", "V09", "V10", "V12", "V13", "V14", "V15", "V16", "V17", "EXP", "MEDM"
// "HTR" does not exist
}; };
private static final String[] symbolsOnlySpecial = { private static final String[] symbolsOnlySpecial = {
"MPS" "MPS", "MPS-AKH"
}; };
private static final HashMap<String, String> codeReplacements = new HashMap<>(); private static final HashMap<String, String> codeReplacements = new HashMap<>();
@ -116,8 +124,10 @@ public class GathererSets implements Iterable<DownloadJob> {
codeReplacements.put("ARN", "AN"); codeReplacements.put("ARN", "AN");
codeReplacements.put("ATQ", "AQ"); codeReplacements.put("ATQ", "AQ");
codeReplacements.put("CMA", "CM1"); codeReplacements.put("CMA", "CM1");
codeReplacements.put("CHR", "CH");
codeReplacements.put("DD3DVD", "DD3_DVD"); codeReplacements.put("DD3DVD", "DD3_DVD");
codeReplacements.put("DD3EVG", "DD3_EVG"); codeReplacements.put("DD3EVG", "DD3_EVG");
codeReplacements.put("DD3GVL", "DD3_GVL");
codeReplacements.put("DD3JVC", "DD3_JVC"); codeReplacements.put("DD3JVC", "DD3_JVC");
codeReplacements.put("DRK", "DK"); codeReplacements.put("DRK", "DK");
codeReplacements.put("EXO", "EX"); codeReplacements.put("EXO", "EX");
@ -128,7 +138,9 @@ public class GathererSets implements Iterable<DownloadJob> {
codeReplacements.put("LEA", "1E"); codeReplacements.put("LEA", "1E");
codeReplacements.put("LEB", "2E"); codeReplacements.put("LEB", "2E");
codeReplacements.put("LEG", "LE"); codeReplacements.put("LEG", "LE");
codeReplacements.put("MEDM", "MPS_WAR");
codeReplacements.put("MPS", "MPS_KLD"); codeReplacements.put("MPS", "MPS_KLD");
codeReplacements.put("MPS-AKH", "MPS_AKH");
codeReplacements.put("MIR", "MI"); codeReplacements.put("MIR", "MI");
codeReplacements.put("MMQ", "MM"); codeReplacements.put("MMQ", "MM");
codeReplacements.put("NEM", "NE"); codeReplacements.put("NEM", "NE");
@ -138,16 +150,19 @@ public class GathererSets implements Iterable<DownloadJob> {
codeReplacements.put("POR", "PO"); codeReplacements.put("POR", "PO");
codeReplacements.put("P02", "P2"); codeReplacements.put("P02", "P2");
codeReplacements.put("PTK", "PK"); codeReplacements.put("PTK", "PK");
codeReplacements.put("S00", "P4");
codeReplacements.put("S99", "P3");
codeReplacements.put("STH", "ST"); codeReplacements.put("STH", "ST");
codeReplacements.put("TMP", "TE"); codeReplacements.put("TMP", "TE");
codeReplacements.put("UDS", "CG"); codeReplacements.put("UDS", "CG");
codeReplacements.put("UGIN", "FRF_UGIN");
codeReplacements.put("UGL", "UG");
codeReplacements.put("ULG", "GU"); codeReplacements.put("ULG", "GU");
codeReplacements.put("USG", "UZ"); codeReplacements.put("USG", "UZ");
codeReplacements.put("VIS", "VI"); codeReplacements.put("VIS", "VI");
codeReplacements.put("WTH", "WL"); codeReplacements.put("WTH", "WL");
codeReplacements.put("8EB", "8ED"); // inner xmage set for 8th edition codeReplacements.put("8EB", "8ED"); // inner xmage set for 8th edition
codeReplacements.put("9EB", "8ED"); // inner xmage set for 9th edition codeReplacements.put("9EB", "8ED"); // inner xmage set for 9th edition
codeReplacements.put("CHR", "CH");
} }
public GathererSets() { public GathererSets() {