mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
images: fixed broken images download from scryfall (#12817);
This commit is contained in:
parent
dadc677592
commit
8bd7e346fb
2 changed files with 9 additions and 0 deletions
|
|
@ -16,6 +16,7 @@ import java.util.Map;
|
||||||
*/
|
*/
|
||||||
public class ScryfallApiCard {
|
public class ScryfallApiCard {
|
||||||
|
|
||||||
|
public String id;
|
||||||
public String name;
|
public String name;
|
||||||
public String set; // set code
|
public String set; // set code
|
||||||
public String collector_number;
|
public String collector_number;
|
||||||
|
|
|
||||||
|
|
@ -451,6 +451,7 @@ public class ScryfallImageSource implements CardImageSource {
|
||||||
|
|
||||||
// bulk files are too big, so must read and parse it in stream mode only
|
// bulk files are too big, so must read and parse it in stream mode only
|
||||||
// 500k reprints in diff languages
|
// 500k reprints in diff languages
|
||||||
|
Set<String> usedCards = new HashSet<>();
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
try (TFileInputStream inputStream = new TFileInputStream(textBulkPath.toFile());
|
try (TFileInputStream inputStream = new TFileInputStream(textBulkPath.toFile());
|
||||||
InputStreamReader inputReader = new InputStreamReader(inputStream);
|
InputStreamReader inputReader = new InputStreamReader(inputStream);
|
||||||
|
|
@ -478,6 +479,13 @@ public class ScryfallImageSource implements CardImageSource {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// workaround for duplicated lines in bulk data, see https://github.com/magefree/mage/issues/12817
|
||||||
|
if (usedCards.contains(card.id)) {
|
||||||
|
logger.warn("WARNING, must report to scryfall about duplicated lines for bulk data: " + key + ", id " + card.id);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
usedCards.add(card.id);
|
||||||
|
|
||||||
// default versions list depends on scryfall bulk data order (en first)
|
// default versions list depends on scryfall bulk data order (en first)
|
||||||
bulkCardsDatabaseDefault.put(key, card);
|
bulkCardsDatabaseDefault.put(key, card);
|
||||||
bulkCardsDatabaseAll.add(card);
|
bulkCardsDatabaseAll.add(card);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue