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;
} }
} }
@ -43,63 +45,69 @@ public class GathererSets implements Iterable<DownloadJob> {
private static final Logger logger = Logger.getLogger(GathererSets.class); private static final Logger logger = Logger.getLogger(GathererSets.class);
private static final String[] symbolsBasic = {"10E", "9ED", "8ED", "7ED", "6ED", "5ED", "4ED", "3ED", "2ED", "LEB", "LEA", private static final String[] symbolsBasic = {"10E", "9ED", "8ED", "7ED", "6ED", "5ED", "4ED", "3ED", "2ED", "LEB", "LEA",
"HOP", "HOP",
"ARN", "ATQ", "LEG", "DRK", "FEM", "HML", "ARN", "ATQ", "LEG", "DRK", "FEM", "HML",
"ICE", "ALL", "CSP", "ICE", "ALL", "CSP",
"MIR", "VIS", "WTH", "MIR", "VIS", "WTH",
"TMP", "STH", "EXO", "TMP", "STH", "EXO",
"USG", "ULG", "UDS", "USG", "ULG", "UDS",
"MMQ", "NEM", "PCY", "MMQ", "NEM", "PCY",
"INV", "PLS", "APC", "INV", "PLS", "APC",
"ODY", "TOR", "JUD", "ODY", "TOR", "JUD",
"ONS", "LGN", "SCG", "ONS", "LGN", "SCG",
"MRD", "DST", "5DN", "MRD", "DST", "5DN",
"CHK", "BOK", "SOK", "CHK", "BOK", "SOK",
"RAV", "GPT", "DIS", "RAV", "GPT", "DIS",
"TSP", "TSB", "PLC", "FUT", "TSP", "TSB", "PLC", "FUT",
"LRW", "MOR", "LRW", "MOR",
"SHM", "EVE", "SHM", "EVE",
"MED", "ME2", "ME3", "ME4", "MED", "ME2", "ME3", "ME4",
"POR", "P02", "PTK", "POR", "P02", "PTK",
"ARC", "DD3EVG", "ARC", "DD3EVG",
"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
// current testing "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
}; };
private static final String[] symbolsBasicWithMyth = {"M10", "M11", "M12", "M13", "M14", "M15", "ORI", private static final String[] symbolsBasicWithMyth = {"M10", "M11", "M12", "M13", "M14", "M15", "ORI",
"DDF", "DDG", "DDH", "DDI", "DDJ", "DDK", "DDL", "DDM", "DDN", "DDF", "DDG", "DDH", "DDI", "DDJ", "DDK", "DDL", "DDM", "DDN",
"DD3DVD", "DD3JVC", "DDO", "DDP", "DDQ", "DDR", "DDS", "DDT", "DDU", "DD3DVD", "DD3JVC", "DDO", "DDP", "DDQ", "DDR", "DDS", "DDT", "DDU",
"ALA", "CON", "ARB", "ALA", "CON", "ARB",
"ZEN", "WWK", "ROE", "ZEN", "WWK", "ROE",
"SOM", "MBS", "NPH", "SOM", "MBS", "NPH",
"CMD", "C13", "C14", "C15", "C16", "CMA", "CMD", "C13", "C14", "C15", "C16", "CMA",
"PC2", "PCA", "PC2", "PCA",
"ISD", "DKA", "AVR", "ISD", "DKA", "AVR",
"RTR", "GTC", "DGM", "RTR", "GTC", "DGM",
"MMA", "MM2", "EMA", "MM3", "MMA", "MM2", "EMA", "MM3",
"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",
"AKH", "HOU", "AKH", "HOU",
"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() {
@ -172,7 +187,7 @@ public class GathererSets implements Iterable<DownloadJob> {
} }
private void CheckSearchResult(String searchCode, ExpansionSet foundedExp, boolean canDownloadTask, private void CheckSearchResult(String searchCode, ExpansionSet foundedExp, boolean canDownloadTask,
boolean haveCommon, boolean haveUncommon, boolean haveRare, boolean haveMyth) { boolean haveCommon, boolean haveUncommon, boolean haveRare, boolean haveMyth) {
// duplicated in settings // duplicated in settings
CheckResult res = setsToDownload.get(searchCode); CheckResult res = setsToDownload.get(searchCode);