LQ setless images will be appended a number (1) if they exist in multiple prints in any set.

This commit is contained in:
Maxmtg
2013-03-17 20:43:04 +00:00
parent bc5b475fb4
commit fc495eee9d
2 changed files with 14 additions and 12 deletions

View File

@@ -196,24 +196,26 @@ public class ImageCache {
s.append(ImageCache.toMWSFilename(nameToUse));
final int cntPictures;
final boolean hasManyPictures;
if (includeSet) {
cntPictures = card.getEditionInfo(edition).getCopiesCount();
hasManyPictures = cntPictures > 1;
} else {
// without set number of pictures equals number of urls provided in Svar:Picture
String urls = backFace ? card.getPictureOtherSideUrl() : card.getPictureUrl();
cntPictures = StringUtils.countMatches(urls, "\\\\") + 1;
// // raise the art index limit to the maximum of the sets this card was printed in
// int maxCntPictures = 1;
// for (String set : card.getSets()) {
// maxCntPictures = Math.max(maxCntPictures, card.getEditionInfo(set).getCopiesCount());
// }
// cntPictures = maxCntPictures;
// raise the art index limit to the maximum of the sets this card was printed in
int maxCntPictures = 1;
for (String set : card.getSets()) {
maxCntPictures = Math.max(maxCntPictures, card.getEditionInfo(set).getCopiesCount());
}
hasManyPictures = maxCntPictures > 1;
}
int artIdx = cp.getArtIndex();
if (cntPictures > 1 ) {
if ( cntPictures <= artIdx )
if (hasManyPictures) {
if ( cntPictures <= artIdx ) // prevent overflow
artIdx = cntPictures == 1 ? 0 : artIdx % cntPictures;
s.append(artIdx + 1);
}

View File

@@ -64,12 +64,12 @@ final class ImageLoader extends CacheLoader<String, BufferedImage> {
if (null == ret && filename.contains("/")) {
setlessFilename = filename.substring(filename.indexOf('/') + 1);
ret = _findFile(key, path, setlessFilename);
}
// try lowering the art index to the minimum for regular cards
if (null == ret && null != setlessFilename && setlessFilename.contains(".full")) {
if (null == ret && setlessFilename.contains(".full")) {
ret = _findFile(key, path, setlessFilename.replaceAll("[0-9]*[.]full", "1.full"));
}
}
if (null == ret) {
System.out.println("File not found, no image created: " + key);