mirror of
https://github.com/magefree/mage.git
synced 2025-12-27 14:02:05 -08:00
Added downloading and displaying emblem images
This commit is contained in:
parent
09bd74f26e
commit
e34ee2e7f6
10 changed files with 75 additions and 23 deletions
|
|
@ -1,8 +1,9 @@
|
|||
package org.mage.plugins.card.dl.sources;
|
||||
|
||||
import org.mage.plugins.card.utils.CardImageUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.mage.plugins.card.utils.CardImageUtils;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -15,6 +16,7 @@ public class MagicCardsImageSource implements CardImageSource {
|
|||
|
||||
{
|
||||
put("AVR", "avacyn-restored");
|
||||
put("DDI", "duel-decks-venser-vs-koth");
|
||||
put("DKA", "dark-ascension");
|
||||
put("ISD", "innistrad");
|
||||
put("DDH", "duel-decks-ajani-vs-nicol-bolas");
|
||||
|
|
@ -76,7 +78,7 @@ public class MagicCardsImageSource implements CardImageSource {
|
|||
|
||||
@Override
|
||||
public String generateTokenUrl(String name, String set) {
|
||||
String _name = name.replaceAll(" ", "-").toLowerCase();
|
||||
String _name = name.replaceAll(" ", "-").replace(",", "").toLowerCase();
|
||||
String _set = "not-supported-set";
|
||||
if (setNameReplacement.containsKey(set)) {
|
||||
_set = setNameReplacement.get(set);
|
||||
|
|
|
|||
|
|
@ -337,7 +337,11 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
|
|||
String set = params[2].substring(4);
|
||||
CardInfo card = new CardInfo(params[3], set, 0, 0, true);
|
||||
list.add(card);
|
||||
}
|
||||
} else if (params[1].toLowerCase().equals("generate") && params[2].startsWith("EMBLEM:")) {
|
||||
String set = params[2].substring(7);
|
||||
CardInfo card = new CardInfo("Emblem " + params[3], set, 0, 0, true);
|
||||
list.add(card);
|
||||
}
|
||||
} else {
|
||||
log.error("wrong format for image urls: " + line);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -146,10 +146,11 @@ public class CardImageUtils {
|
|||
|
||||
public static String getImagePath(CardInfo card, boolean withCollector, String imagesPath) {
|
||||
String type = card.getType() != 0 ? " " + Integer.toString(card.getType()) : "";
|
||||
String name = card.getName();
|
||||
if (withCollector) {
|
||||
return getImageDir(card, imagesPath) + File.separator + card.getName() + "." + card.getCollectorId() + ".full.jpg";
|
||||
return getImageDir(card, imagesPath) + File.separator + name + "." + card.getCollectorId() + ".full.jpg";
|
||||
} else {
|
||||
return getImageDir(card, imagesPath) + File.separator + card.getName() + type + ".full.jpg";
|
||||
return getImageDir(card, imagesPath) + File.separator + name + type + ".full.jpg";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,19 @@
|
|||
|Generate|TOK:AVR|Angel|
|
||||
|Generate|TOK:AVR|Human 1|
|
||||
|Generate|TOK:AVR|Spirit 1|
|
||||
|Generate|TOK:AVR|Spirit 2|
|
||||
|Generate|TOK:AVR|Demon|
|
||||
|Generate|TOK:AVR|Zombie|
|
||||
|Generate|TOK:AVR|Human 2|
|
||||
|
||||
|Generate|TOK:DKA|Human|
|
||||
|Generate|TOK:DKA|Vampire|
|
||||
|
||||
|Generate|EMBLEM:AVR|Tamiyo, the Moon Sage|
|
||||
|
||||
|Generate|TOK:AVR|Angel|
|
||||
|Generate|TOK:AVR|Human 1|
|
||||
|Generate|TOK:AVR|Spirit 1|
|
||||
|Generate|TOK:AVR|Spirit 2|
|
||||
|Generate|TOK:AVR|Demon|
|
||||
|Generate|TOK:AVR|Zombie|
|
||||
|Generate|TOK:AVR|Human 2|
|
||||
|
||||
|Generate|EMBLEM:DDI|Venser, the Sojourner|
|
||||
|Generate|EMBLEM:DDI|Koth of the Hammer|
|
||||
|
||||
|Generate|TOK:DKA|Human|
|
||||
|Generate|TOK:DKA|Vampire|
|
||||
|
||||
|Generate|TOK:ISD|Angel|
|
||||
|Generate|TOK:ISD|Spirit|
|
||||
|Generate|TOK:ISD|Homunculus|
|
||||
|
|
|
|||
|
|
@ -56,6 +56,6 @@ leg=lg
|
|||
ptk=p3k
|
||||
gur=guru
|
||||
mpr=mprp
|
||||
ignore.urls=TOK
|
||||
ignore.urls=TOK,EMBLEM
|
||||
# sets ordered by release time (newest goes first)
|
||||
token.lookup.order=NPH,MBS,SOM,M11,ROE,PVC,WWK,ZEN,M10,GVL,ARB,DVD,CFX,JVC,ALA,EVE,SHM,EVG,MOR,LRW,10E,CLS,CHK
|
||||
token.lookup.order=AVR,DDI,DKA,ISD,M12,NPH,MBS,SOM,M11,ROE,PVC,WWK,ZEN,M10,GVL,ARB,DVD,CFX,JVC,ALA,EVE,SHM,EVG,MOR,LRW,10E,CLS,CHK
|
||||
Loading…
Add table
Add a link
Reference in a new issue