[ZNR] Added images download for modal double faces cards (#7012)

This commit is contained in:
Oleg Agafonov 2020-10-01 13:23:04 +04:00
parent a73c9bddae
commit c60bf3ccef
4 changed files with 21 additions and 7 deletions

View file

@ -86,9 +86,9 @@ public enum ScryfallImageSource implements CardImageSource {
}
}
// double faced card
// double faced cards (modal double faces cards too)
// the front face can be downloaded normally
// the back face is prepared beforehand
// the back face is prepared before hand
if (baseUrl == null && card.isTwoFacedCard() && !card.isSecondSide()) {
baseUrl = "https://api.scryfall.com/cards/" + formatSetName(card.getSet(), isToken) + "/"
+ card.getCollectorId() + "/" + localizedCode + "?format=image";

View file

@ -449,12 +449,30 @@ public class DownloadPicturesService extends DefaultBoundedRangeModel implements
if (card.getFlipCardName() == null || card.getFlipCardName().trim().isEmpty()) {
throw new IllegalStateException("Flipped card can't have empty name.");
}
CardDownloadData cardDownloadData = new CardDownloadData(card.getFlipCardName(), card.getSetCode(), card.getCardNumber(), card.usesVariousArt(), 0, "", "", false, card.isDoubleFaced(), card.isNightCard());
CardDownloadData cardDownloadData = new CardDownloadData(
card.getFlipCardName(),
card.getSetCode(),
card.getCardNumber(),
card.usesVariousArt(),
0, "", "", false, card.isDoubleFaced(), card.isNightCard());
cardDownloadData.setFlipCard(true);
cardDownloadData.setFlippedSide(true);
cardDownloadData.setType2(isType2);
allCardsUrls.add(cardDownloadData);
}
if (card.isModalDoubleFacesCard()) {
if (card.getModalDoubleFacesSecondSideName() == null || card.getModalDoubleFacesSecondSideName().trim().isEmpty()) {
throw new IllegalStateException("MDF card can't have empty name.");
}
CardDownloadData cardDownloadData = new CardDownloadData(
card.getModalDoubleFacesSecondSideName(),
card.getSetCode(),
card.getCardNumber(),
card.usesVariousArt(),
0, "", "", false, true, true);
cardDownloadData.setType2(isType2);
allCardsUrls.add(cardDownloadData);
}
} else if (card.getCardNumber().isEmpty() || "0".equals(card.getCardNumber())) {
logger.error("Card has no collector ID and won't be sent to client: " + card.getName());
} else if (card.getSetCode().isEmpty()) {