mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
fix #4148 error on downloading double faces cards from scryfall
This commit is contained in:
parent
2a12e788d5
commit
badaed63cb
1 changed files with 12 additions and 4 deletions
|
@ -214,10 +214,18 @@ public enum ScryfallImageSource implements CardImageSource {
|
|||
|
||||
@Override
|
||||
public String generateURL(CardDownloadData card) throws Exception {
|
||||
return "https://api.scryfall.com/cards/" + formatSetName(card.getSet()) + "/"
|
||||
+ card.getCollectorId()
|
||||
+ (card.isSecondSide() ? "b" : "")
|
||||
+ "?format=image";
|
||||
|
||||
if (card.isTwoFacedCard()) {
|
||||
// double faced cards do not supporte by API (need direct link for img)
|
||||
// example: https://img.scryfall.com/cards/large/en/xln/173b.jpg
|
||||
return "https://img.scryfall.com/cards/large/en/" + formatSetName(card.getSet()) + "/"
|
||||
+ card.getCollectorId() + (card.isSecondSide() ? "b" : "a") + ".jpg";
|
||||
}else {
|
||||
// single face cards support by single API call (redirect to img link)
|
||||
// example: https://api.scryfall.com/cards/xln/121?format=image
|
||||
return "https://api.scryfall.com/cards/" + formatSetName(card.getSet()) + "/"
|
||||
+ card.getCollectorId() + "?format=image";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue