mirror of
https://github.com/correl/mage.git
synced 2024-11-25 03:00:11 +00:00
Images download: fixed broken download dialog
This commit is contained in:
parent
2954bbaf04
commit
3bf0f80033
5 changed files with 14 additions and 13 deletions
|
@ -4,8 +4,6 @@ import com.google.gson.JsonArray;
|
|||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import mage.cards.ExpansionSet;
|
||||
import mage.cards.Sets;
|
||||
import mage.client.util.CardLanguage;
|
||||
import mage.util.CardUtil;
|
||||
import org.apache.log4j.Logger;
|
||||
|
@ -30,7 +28,7 @@ public enum ScryfallImageSource implements CardImageSource {
|
|||
|
||||
private final Map<CardLanguage, String> languageAliases;
|
||||
private CardLanguage currentLanguage = CardLanguage.ENGLISH; // working language
|
||||
private Map<CardDownloadData, String> preparedUrls = new HashMap<>();
|
||||
private final Map<CardDownloadData, String> preparedUrls = new HashMap<>();
|
||||
|
||||
ScryfallImageSource() {
|
||||
// LANGUAGES
|
||||
|
@ -68,7 +66,7 @@ public enum ScryfallImageSource implements CardImageSource {
|
|||
// TOKENS TRY
|
||||
|
||||
// tokens support only direct links
|
||||
if (baseUrl == null && isToken) {
|
||||
if (isToken) {
|
||||
baseUrl = ScryfallImageSupportTokens.findTokenLink(card.getSet(), card.getName(), card.getType());
|
||||
alternativeUrl = null;
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package org.mage.plugins.card.images;
|
||||
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author North
|
||||
*/
|
||||
public class CardDownloadData {
|
||||
|
@ -106,10 +106,7 @@ public class CardDownloadData {
|
|||
if (this.secondSide != other.secondSide) {
|
||||
return false;
|
||||
}
|
||||
if (this.isType2 != other.isType2) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return this.isType2 == other.isType2;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -134,6 +131,12 @@ public class CardDownloadData {
|
|||
return CardUtil.parseCardNumberAsInt(collectorId);
|
||||
}
|
||||
|
||||
public String getCollectorIdAsFileName() {
|
||||
// return file names compatible card number (e.g. replace special symbols)
|
||||
return collectorId
|
||||
.replace("*", "star");
|
||||
}
|
||||
|
||||
public String getCollectorIdPostfix() {
|
||||
return getCollectorId().replaceAll(getCollectorIdAsInt().toString(), "");
|
||||
}
|
||||
|
|
|
@ -203,7 +203,7 @@ public final class CardImageUtils {
|
|||
String finalFileName = "";
|
||||
if (card.getUsesVariousArt()) {
|
||||
// different arts uses name + collector id
|
||||
finalFileName = cardName + prefixType + '.' + card.getCollectorId() + ".full.jpg";
|
||||
finalFileName = cardName + prefixType + '.' + card.getCollectorIdAsFileName() + ".full.jpg";
|
||||
} else {
|
||||
// basic arts uses name
|
||||
finalFileName = cardName + prefixType + ".full.jpg";
|
||||
|
|
Loading…
Reference in a new issue