Skip to content

add ImageKey class - #7846

Draft
Hanmac wants to merge 5 commits into
masterfrom
betterImageKey
Draft

add ImageKey class#7846
Hanmac wants to merge 5 commits into
masterfrom
betterImageKey

Conversation

@Hanmac

@Hanmac Hanmac commented Jun 12, 2025

Copy link
Copy Markdown
Contributor

Closes #7771

still in work, but just commited this state

@Jetz72

Jetz72 commented Jun 12, 2025

Copy link
Copy Markdown
Contributor

What's the idea behind the List<String> of variations of the filepath?

The ImageType and ArtStyle enums might be simple enough and narrow enough in purpose to be nested within the ImageKey class, unless you plan to add more functionality to them later.

@Hanmac

Hanmac commented Jun 12, 2025

Copy link
Copy Markdown
Contributor Author

What's the idea behind the List<String> of variations of the filepath?

if (dir.equals(CACHE_TOKEN_PICS_DIR)) {
String setlessFilename = tempdata[0];
String setCode = tempdata.length > 1 ? tempdata[1] : "";
String collectorNumber = tempdata.length > 2 ? tempdata[2] : "";
if (!setCode.isEmpty()) {
if (!collectorNumber.isEmpty()) {
file = findFile(dir, setCode + "/" + collectorNumber + "_" + setlessFilename);
if (file != null) {
cachedCards.put(filename, file);
return file;
}
}
file = findFile(dir, setCode + "/" + setlessFilename);
if (file != null) {
cachedCards.put(filename, file);
return file;
}
}
file = findFile(dir, setlessFilename);
if (file != null) {
cachedCards.put(filename, file);
return file;
}
}

The plan is to use the variations for ImageKeys::getImageFile, and then call it in a loop:

for (String s : paths) {
    file = findFile(dir, s);
    if (file != null) {
        cachedCards.put(filename, file);
        return file;
    }
}

Also, the first path returned from the List should be used for the Downloader too

@Hanmac

Hanmac commented Jun 12, 2025

Copy link
Copy Markdown
Contributor Author

The ImageType and ArtStyle enums might be simple enough and narrow enough in purpose to be nested within the ImageKey class, unless you plan to add more functionality to them later.

i want to add these too:

public static final String ICON_PREFIX = "i:";
public static final String BOOSTER_PREFIX = "b:";
public static final String FATPACK_PREFIX = "f:";
public static final String BOOSTERBOX_PREFIX = "x:";
public static final String PRECON_PREFIX = "p:";
public static final String TOURNAMENTPACK_PREFIX = "o:";
public static final String ADVENTURECARD_PREFIX = "a:";

but i don't know the FileStructure for them yet, nor can these be downloaded from Scryfall (yet)
i want to mail Scryfall to add Booster Images

@Jetz72

Jetz72 commented Jun 12, 2025

Copy link
Copy Markdown
Contributor

The plan is to use the variations for ImageKeys::getImageFile, and then call it in a loop:
...
Also, the first path returned from the List should be used for the Downloader too

What's all that support for no-set and no-collector-number tokens used for? The Scryfall URL method won't work without those fields, so can anything new be downloaded to those paths?

@Hanmac

Hanmac commented Jun 12, 2025

Copy link
Copy Markdown
Contributor Author

The plan is to use the variations for ImageKeys::getImageFile, and then call it in a loop:
...
Also, the first path returned from the List should be used for the Downloader too

What's all that support for no-set and no-collector-number tokens used for? The Scryfall URL method won't work without those fields, so can anything new be downloaded to those paths?

It's not just for download, it's for finding images too, like Custom Sets

@github-actions

Copy link
Copy Markdown

This PR has not been updated in a while nad has been marked on stale. Stale PRs will be auto closed

@Hanmac Hanmac added keep no stale and removed no-pr-activity labels Aug 24, 2025
@Hanmac

Hanmac commented Sep 17, 2025

Copy link
Copy Markdown
Contributor Author

@Eradev I need to add your new ⚡ Logic to the Download abilities of this class

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New ImageKeys Design Hash/Record

2 participants