refactor: removed outdated or un-used code (part of #11873)

This commit is contained in:
Oleg Agafonov 2024-02-29 07:50:13 +04:00
parent 2aea44da2c
commit 734e2fae0f
5 changed files with 8 additions and 127 deletions

View file

@ -11,8 +11,7 @@ import static org.mage.plugins.card.dl.DownloadJob.toFile;
import static org.mage.plugins.card.utils.CardImageUtils.getImagesDir;
/**
* TODO: outdated, delete and use xmage tokens instead ?!
* Used when we need to point to direct links to download resources from.
* Additional images from a third party sources
*
* @author noxx
*/
@ -20,6 +19,9 @@ public class DirectLinksForDownload implements Iterable<DownloadJob> {
private static final Map<String, String> directLinks = new LinkedHashMap<>();
// face down cards uses tokens source for a cardback image
// that's cardback used for miss images
// TODO: replace miss image cardback to some generic card (must be diff from face down image)
public static final String cardbackFilename = "cardback.jpg";
static {

View file

@ -64,7 +64,6 @@ public final class ImageCache {
CardDownloadData info = new CardDownloadData(name, setCode, collectorId, usesVariousArt, imageNumber);
boolean cardback = false;
String path;
if (collectorId.isEmpty() || "0".equals(collectorId)) {
// TOKEN
@ -89,7 +88,6 @@ public final class ImageCache {
// try unknown token image
if (tokenFile == null || !tokenFile.exists()) {
// TODO: replace empty token by other default card, not cardback
cardback = true;
path = CardImageUtils.buildImagePathToDefault(DirectLinksForDownload.cardbackFilename);
}
} else {
@ -102,19 +100,9 @@ public final class ImageCache {
return new ImageCacheData(path, null);
}
if (cardback) {
// TODO: is there any different in images styles? Cardback must be from scryfall, not wizards
// need cardback image
BufferedImage image = loadImage(file);
image = getRoundCorner(image);
return new ImageCacheData(path, image);
} else {
// need normal card image
BufferedImage image = loadImage(file);
image = getWizardsCard(image);
image = getRoundCorner(image);
return new ImageCacheData(path, image);
}
BufferedImage image = loadImage(file);
image = getRoundCorner(image);
return new ImageCacheData(path, image);
} else {
throw new IllegalArgumentException("Unknown card image's key format: " + key);
}