mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
Fixed that not BFZ images were downloaded from mysticspoliers source. Fixed that Zendikar Expeditions images were not downloaded from mysticspoliers source.
This commit is contained in:
parent
75bb39cae8
commit
ed15f0b86b
3 changed files with 41 additions and 20 deletions
|
@ -36,7 +36,10 @@ import java.net.Proxy;
|
|||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.prefs.Preferences;
|
||||
import mage.client.MageFrame;
|
||||
import mage.remote.Connection;
|
||||
|
@ -56,6 +59,7 @@ public class MythicspoilerComSource implements CardImageSource {
|
|||
private static CardImageSource instance;
|
||||
private static Map<String, String> setsAliases;
|
||||
private static Map<String, String> cardNameAliases;
|
||||
private static Map<String, Set<String>> cardNameAliasesStart;
|
||||
private final Map<String, Map<String, String>> sets;
|
||||
|
||||
public static CardImageSource getInstance() {
|
||||
|
@ -71,8 +75,9 @@ public class MythicspoilerComSource implements CardImageSource {
|
|||
}
|
||||
|
||||
public MythicspoilerComSource() {
|
||||
sets = new HashMap<>();
|
||||
sets = new LinkedHashMap<>();
|
||||
setsAliases = new HashMap<>();
|
||||
setsAliases.put("exp", "bfz");
|
||||
cardNameAliases = new HashMap<>();
|
||||
// set+wrong name from web side => correct card name
|
||||
cardNameAliases.put("MM2-otherwordlyjourney", "otherworldlyjourney");
|
||||
|
@ -81,12 +86,21 @@ public class MythicspoilerComSource implements CardImageSource {
|
|||
cardNameAliases.put("THS-soldierofpantheon", "soldierofthepantheon");
|
||||
cardNameAliases.put("THS-vulpinegolaith", "vulpinegoliath");
|
||||
cardNameAliases.put("ORI-kothopedhoarderofsouls", "kothophedsoulhoarder");
|
||||
cardNameAliases.put("BFZ-unisonstrike", "tandemtactics");
|
||||
cardNameAliases.put("BFZ-eldrazidevastator", "eldrazidevastator");
|
||||
cardNameAliases.put("BFZ-kozliekschanneler", "kozilekschanneler");
|
||||
|
||||
cardNameAliasesStart = new HashMap<>();
|
||||
HashSet<String> names = new HashSet<>();
|
||||
names.add("eldrazidevastator.jpg");
|
||||
cardNameAliasesStart.put("BFZ", names);
|
||||
}
|
||||
|
||||
private Map<String, String> getSetLinks(String cardSet) {
|
||||
Map<String, String> setLinks = new HashMap<>();
|
||||
try {
|
||||
String setNames = setsAliases.get(cardSet.toLowerCase());
|
||||
Set<String> aliasesStart = cardNameAliasesStart.get(cardSet);
|
||||
if (setNames == null) {
|
||||
setNames = cardSet.toLowerCase();
|
||||
}
|
||||
|
@ -119,14 +133,21 @@ public class MythicspoilerComSource implements CardImageSource {
|
|||
}
|
||||
|
||||
Elements cardsImages = doc.select("img[src^=cards/]"); // starts with cards/
|
||||
for (String text : aliasesStart) {
|
||||
cardsImages.addAll(doc.select("img[src^=" + text + "]"));
|
||||
}
|
||||
if (cardsImages.isEmpty()) {
|
||||
break;
|
||||
}
|
||||
|
||||
for (Element cardsImage : cardsImages) {
|
||||
String cardLink = cardsImage.attr("src");
|
||||
String cardName = null;
|
||||
if (cardLink.startsWith("cards/") && cardLink.endsWith(".jpg")) {
|
||||
String cardName = cardLink.substring(6, cardLink.length() - 4);
|
||||
cardName = cardLink.substring(6, cardLink.length() - 4);
|
||||
} else if (aliasesStart.contains(cardLink)) {
|
||||
cardName = cardLink.substring(0, cardLink.length() - 4);;
|
||||
}
|
||||
if (cardName != null && !cardName.isEmpty()) {
|
||||
if (cardNameAliases.containsKey(cardSet + "-" + cardName)) {
|
||||
cardName = cardNameAliases.get(cardSet + "-" + cardName);
|
||||
|
@ -145,7 +166,7 @@ public class MythicspoilerComSource implements CardImageSource {
|
|||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
} catch (IOException ex) {
|
||||
System.out.println("Exception when parsing the mythicspoiler page: " + ex.getMessage());
|
||||
}
|
||||
|
|
|
@ -64,6 +64,6 @@ ddd=gvl
|
|||
unh=uh
|
||||
dde=pvc
|
||||
# Remove setname as soon as the images can be downloaded
|
||||
ignore.urls=TOK,EXP,OGW
|
||||
ignore.urls=TOK, OGW
|
||||
# sets ordered by release time (newest goes first)
|
||||
token.lookup.order=OGW,EXP,DDP,BFZ,FVD,FVE,FVL,FVR,V12,V13,V14,V15,TPR,MPRP,DD3,DDO,ORI,MM2,PTC,DTK,FRF,KTK,M15,VMA,CNS,JOU,BNG,THS,DDL,M14,MMA,DGM,GTC,RTR,M13,AVR,DDI,DKA,ISD,M12,NPH,MBS,SOM,M11,ROE,DDE,WWK,ZEN,M10,GVL,ARB,DVD,CFX,JVC,ALA,EVE,SHM,EVG,MOR,LRW,10E,CLS,CHK,GRC
|
|
@ -52,7 +52,7 @@ import mage.target.common.TargetCreaturePermanent;
|
|||
*/
|
||||
public class TitansPresence extends CardImpl {
|
||||
|
||||
private static final FilterCreatureCard filter = new FilterCreatureCard("a colorless creature card from your hand to reveal");
|
||||
private static final FilterCreatureCard filter = new FilterCreatureCard("a colorless creature card from your hand");
|
||||
|
||||
static {
|
||||
filter.add(new ColorlessPredicate());
|
||||
|
|
Loading…
Reference in a new issue