Fixed symbols and images download from wizards;

This commit is contained in:
Oleg Agafonov 2019-06-23 18:56:25 +04:00
parent 63a9a505e1
commit d0638e71af
11 changed files with 18 additions and 18 deletions

View file

@ -332,7 +332,7 @@ public class GathererSets implements Iterable<DownloadJob> {
if (codeReplacements.containsKey(set)) { if (codeReplacements.containsKey(set)) {
set = codeReplacements.get(set); set = codeReplacements.get(set);
} }
String url = "http://gatherer.wizards.com/Handlers/Image.ashx?type=symbol&set=" + set + "&size=small&rarity=" + urlRarity; String url = "https://gatherer.wizards.com/Handlers/Image.ashx?type=symbol&set=" + set + "&size=small&rarity=" + urlRarity;
return new DownloadJob(set + '-' + rarity, fromURL(url), toFile(dst)); return new DownloadJob(set + '-' + rarity, fromURL(url), toFile(dst));
} }
} }

View file

@ -23,11 +23,11 @@ import static org.mage.plugins.card.utils.CardImageUtils.getImagesDir;
*/ */
public class GathererSymbols implements Iterable<DownloadJob> { public class GathererSymbols implements Iterable<DownloadJob> {
//TODO chaos and planeswalker symbol //TODO chaos and planeswalker symbol
//chaos: http://gatherer.wizards.com/Images/Symbols/chaos.gif //chaos: https://gatherer.wizards.com/Images/Symbols/chaos.gif
private static File outDir; private static File outDir;
private static final String urlFmt = "http://gatherer.wizards.com/handlers/image.ashx?size=%1$s&name=%2$s&type=symbol"; private static final String urlFmt = "https://gatherer.wizards.com/handlers/image.ashx?size=%1$s&name=%2$s&type=symbol";
private static final String[] sizes = {"small", "medium", "large"}; private static final String[] sizes = {"small", "medium", "large"};

View file

@ -501,8 +501,8 @@ public enum WizardCardsImageSource implements CardImageSource {
} }
} }
} }
if (link != null && !link.startsWith("http://")) { if (link != null && !link.startsWith("https://")) {
link = "http://gatherer.wizards.com" + link; link = "https://gatherer.wizards.com" + link;
} }
if (link != null) { if (link != null) {
@ -528,7 +528,7 @@ public enum WizardCardsImageSource implements CardImageSource {
int firstMultiverseIdLastPage = 0; int firstMultiverseIdLastPage = 0;
Pages: Pages:
while (page < 999) { while (page < 999) {
String searchUrl = "http://gatherer.wizards.com/Pages/Search/Default.aspx?sort=cn+&page=" + page + "&action=advanced&output=spoiler&method=visual&set=+%5B%22" + URLSetName + "%22%5D"; String searchUrl = "https://gatherer.wizards.com/Pages/Search/Default.aspx?sort=cn+&page=" + page + "&action=advanced&output=spoiler&method=visual&set=+%5B%22" + URLSetName + "%22%5D";
logger.debug("URL: " + searchUrl); logger.debug("URL: " + searchUrl);
Document doc = CardImageUtils.downloadHtmlDocument(searchUrl); Document doc = CardImageUtils.downloadHtmlDocument(searchUrl);
Elements cardsImages = doc.select("img[src^=../../Handlers/]"); Elements cardsImages = doc.select("img[src^=../../Handlers/]");
@ -588,7 +588,7 @@ public enum WizardCardsImageSource implements CardImageSource {
criteria.setCodes(cardSet); criteria.setCodes(cardSet);
List<CardInfo> cards = CardRepository.instance.findCards(criteria); List<CardInfo> cards = CardRepository.instance.findCards(criteria);
String urlLandDocument = "http://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=" + multiverseId; String urlLandDocument = "https://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=" + multiverseId;
Document landDoc = CardImageUtils.downloadHtmlDocument(urlLandDocument); Document landDoc = CardImageUtils.downloadHtmlDocument(urlLandDocument);
Elements variations = landDoc.select("a.variationlink"); Elements variations = landDoc.select("a.variationlink");
if (!variations.isEmpty()) { if (!variations.isEmpty()) {
@ -635,7 +635,7 @@ public enum WizardCardsImageSource implements CardImageSource {
} }
private HashMap<String, Integer> getlocalizedMultiverseIds(Integer englishMultiverseId) throws IOException { private HashMap<String, Integer> getlocalizedMultiverseIds(Integer englishMultiverseId) throws IOException {
String cardLanguagesUrl = "http://gatherer.wizards.com/Pages/Card/Languages.aspx?multiverseid=" + englishMultiverseId; String cardLanguagesUrl = "https://gatherer.wizards.com/Pages/Card/Languages.aspx?multiverseid=" + englishMultiverseId;
Document cardLanguagesDoc = CardImageUtils.downloadHtmlDocument(cardLanguagesUrl); Document cardLanguagesDoc = CardImageUtils.downloadHtmlDocument(cardLanguagesUrl);
Elements languageTableRows = cardLanguagesDoc.select("tr.cardItem"); Elements languageTableRows = cardLanguagesDoc.select("tr.cardItem");
HashMap<String, Integer> localizedIds = new HashMap<>(); HashMap<String, Integer> localizedIds = new HashMap<>();

View file

@ -62,7 +62,7 @@ class CreepingDreadEffect extends OneShotEffect {
each player selects a card from their hand without revealing it, each player selects a card from their hand without revealing it,
sets it aside, and then all of those cards are revealed and discarded at once. sets it aside, and then all of those cards are revealed and discarded at once.
http://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=409851 https://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=409851
*/ */
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {

View file

@ -69,7 +69,7 @@ public final class ScarredPuma extends CardImpl {
public boolean applies(Permanent permanent, Ability source, Game game) { public boolean applies(Permanent permanent, Ability source, Game game) {
if (permanent.getId().equals(source.getSourceId())) { if (permanent.getId().equals(source.getSourceId())) {
for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
//excludes itself (http://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=23067) //excludes itself (https://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=23067)
if (!Objects.equals(creature.getId(), source.getSourceId())) { if (!Objects.equals(creature.getId(), source.getSourceId())) {
ObjectColor color = creature.getColor(game); ObjectColor color = creature.getColor(game);
if (color.isBlack() || color.isGreen()) { if (color.isBlack() || color.isGreen()) {

View file

@ -69,7 +69,7 @@ public final class VulshokBattlemaster extends CardImpl {
filter.add(new SubtypePredicate(SubType.EQUIPMENT)); filter.add(new SubtypePredicate(SubType.EQUIPMENT));
for (Permanent equipment : game.getBattlefield().getAllActivePermanents(filter, game)) { for (Permanent equipment : game.getBattlefield().getAllActivePermanents(filter, game)) {
if (equipment != null) { if (equipment != null) {
//If an Equipment can't equip Vulshok Battlemaster, it isn't attached to the Battlemaster, and it doesn't become unattached (if it's attached to a creature). (http://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=48125) //If an Equipment can't equip Vulshok Battlemaster, it isn't attached to the Battlemaster, and it doesn't become unattached (if it's attached to a creature). (https://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=48125)
if (!battlemaster.cantBeAttachedBy(equipment, game)) { if (!battlemaster.cantBeAttachedBy(equipment, game)) {
battlemaster.addAttachment(equipment.getId(), game); battlemaster.addAttachment(equipment.getId(), game);
} }

View file

@ -51,7 +51,7 @@ public class SkylineCascadeTest extends CardTestPlayerBase {
* *
* "Skyline Cascade's triggered ability doesn't tap the creature. It can target any creature, tapped or untapped. * "Skyline Cascade's triggered ability doesn't tap the creature. It can target any creature, tapped or untapped.
* If that creature is already untapped at the beginning of its controller's next untap step, the effect won't do anything." * If that creature is already untapped at the beginning of its controller's next untap step, the effect won't do anything."
* http://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=402038 * https://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=402038
* *
* An untapped creature will remain untapped. * An untapped creature will remain untapped.
*/ */

View file

@ -19,7 +19,7 @@ public class ImprisonedInTheMoonTest extends CardTestPlayerBase {
/* /*
* Reported bug: Urza land enchanted with Imprisoned In the Moon incorrectly makes it so other Urza lands only tap for 1 <> . * Reported bug: Urza land enchanted with Imprisoned In the Moon incorrectly makes it so other Urza lands only tap for 1 <> .
* *
* Card ruling: http://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=414360 * Card ruling: https://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=414360
* If the enchanted permanent is a land and has land types, it retains those types even though it loses any intrinsic mana abilities associated with them. * If the enchanted permanent is a land and has land types, it retains those types even though it loses any intrinsic mana abilities associated with them.
* For example, a Plains enchanted by Imprisoned in the Moon is still a Plains, but it can't tap for {W}, only for {C}. * For example, a Plains enchanted by Imprisoned in the Moon is still a Plains, but it can't tap for {W}, only for {C}.
*/ */

View file

@ -102,7 +102,7 @@ public class LeylineOfTheVoidTest extends CardTestPlayerBase {
/* /*
"Leyline of the Void's second ability doesn't affect token permanents that would be put into an opponent's graveyard from the battlefield. "Leyline of the Void's second ability doesn't affect token permanents that would be put into an opponent's graveyard from the battlefield.
They'll be put into that graveyard as normal (causing any applicable triggered abilities to trigger), then they'll cease to exist." They'll be put into that graveyard as normal (causing any applicable triggered abilities to trigger), then they'll cease to exist."
http://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=107682 https://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=107682
*/ */
@Test @Test

View file

@ -9,7 +9,7 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
/** /**
* This test is based on rulings of the card Muraganda Petroglyphs in magic Gatherer site * This test is based on rulings of the card Muraganda Petroglyphs in magic Gatherer site
* (http://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=145110), accessed in * (https://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=145110), accessed in
* 08/01/2017. * 08/01/2017.
* *
* @author alexsandro. * @author alexsandro.

View file

@ -32,8 +32,8 @@ use POSIX qw(strftime);
print (" cut.pl bob.txt 0 0 str_condense (Used for making similar lines in files smaller..)\n"); print (" cut.pl bob.txt 0 0 str_condense (Used for making similar lines in files smaller..)\n");
print (" cut.pl stdin \"http://bob.com/a=XXX.id\" 1000 oneupcount \n"); print (" cut.pl stdin \"http://bob.com/a=XXX.id\" 1000 oneupcount \n");
print (" cut.pl stdin \"http://www.comlaw.gov.au/Details/XXX\" 1000 wget\n"); print (" cut.pl stdin \"http://www.comlaw.gov.au/Details/XXX\" 1000 wget\n");
print (" cut.pl stdin \"http://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=XXX\" 5274 oneupcount\n"); print (" cut.pl stdin \"https://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=XXX\" 5274 oneupcount\n");
print (" cut.pl stdin \"http://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=XXX' 5274 wget\n"); print (" cut.pl stdin \"https://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=XXX' 5274 wget\n");
print (" cut.pl modern_bluesa \";;;\" \"0,7\" fields | cut.pl stdin \";;;\" 3 wordcombos\n"); print (" cut.pl modern_bluesa \";;;\" \"0,7\" fields | cut.pl stdin \";;;\" 3 wordcombos\n");
print (" cut.pl modern_bluesa \";;;\" \"0,7\" fields | cut.pl stdin 0 0 uniquewords\n"); print (" cut.pl modern_bluesa \";;;\" \"0,7\" fields | cut.pl stdin 0 0 uniquewords\n");
print (" cut.pl modern_bluesa \";;;\" \"0,2\" images_html\n"); print (" cut.pl modern_bluesa \";;;\" \"0,2\" images_html\n");
@ -47,7 +47,7 @@ use POSIX qw(strftime);
print ('\necho "" | cut.pl stdin "http://mythicspoiler.com/c17/cards/stalkingleonin.html" 0 wget_card_spoiler\n'); print ('\necho "" | cut.pl stdin "http://mythicspoiler.com/c17/cards/stalkingleonin.html" 0 wget_card_spoiler\n');
print ('dir /a /b /s *.jar | cut.pl stdin "^" "7z l -r \"" replace | cut.pl stdin "$" "\"" replace > d:\temp\xyz.bat'); print ('dir /a /b /s *.jar | cut.pl stdin "^" "7z l -r \"" replace | cut.pl stdin "$" "\"" replace > d:\temp\xyz.bat');
print ("\n"); print ("\n");
print ('echo "1" | cut.pl stdin "http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=16431&type=card" "6ED/Phantasmal Terrain.full.jpg" wget_image'); print ('echo "1" | cut.pl stdin "https://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=16431&type=card" "6ED/Phantasmal Terrain.full.jpg" wget_image');
print ("\n"); print ("\n");
exit 0; exit 0;
} }