PaperToken: cleanup imageKey without collectorNumber

This commit is contained in:
Hans Mackowiak
2025-05-02 22:31:21 +02:00
committed by Chris H
parent b57a5e9ad1
commit 338bb09747

View File

@@ -62,29 +62,24 @@ public class PaperToken implements InventoryItemFromSet, IPaperCard {
this.collectorNumber = collectorNumber; this.collectorNumber = collectorNumber;
this.artist = artist; this.artist = artist;
if (edition != null && edition.getTokens().containsKey(imageFileName)) { if (collectorNumber != null && !collectorNumber.isEmpty() && edition != null && edition.getTokens().containsKey(imageFileName)) {
if (collectorNumber != null && !collectorNumber.isEmpty()) { int idx = 0;
int idx = 0; // count the one with the same collectorNumber
// count the one with the same collectorNumber for (CardEdition.TokenInSet t : edition.getTokens().get(imageFileName)) {
for (CardEdition.TokenInSet t : edition.getTokens().get(imageFileName)) { ++idx;
++idx; if (!t.collectorNumber.equals(collectorNumber)) {
if (!t.collectorNumber.equals(collectorNumber)) { continue;
continue;
}
// TODO make better image file names when collector number is known
// for the right index, we need to count the ones with wrong collector number too
this.imageFileName.add(String.format("%s|%s|%s|%d", imageFileName, edition.getCode().toLowerCase(), collectorNumber, idx));
} }
this.artIndex = this.imageFileName.size(); // TODO make better image file names when collector number is known
// for the right index, we need to count the ones with wrong collector number too
this.imageFileName.add(String.format("%s|%s|%s|%d", imageFileName, edition.getCode().toLowerCase(), collectorNumber, idx));
} }
} else if (imageFileName != null) { this.artIndex = this.imageFileName.size();
String formatEdition = null == edition || CardEdition.UNKNOWN == edition ? "" : "_" + edition.getCode().toLowerCase(); } else if (null == edition || CardEdition.UNKNOWN == edition) {
this.imageFileName.add(imageFileName);
if (null == edition || CardEdition.UNKNOWN == edition) { } else {
this.imageFileName.add(imageFileName); // Fallback if CollectorNumber is not used
} this.imageFileName.add(String.format("%s|%s", imageFileName, edition.getCode().toLowerCase()));
// Fallback for if the Edition doesn't know about the Token
this.imageFileName.add(String.format("%s|%s", imageFileName, formatEdition));
} }
} }