Skip to content

Conversation

@muz
Copy link
Contributor

@muz muz commented Jan 4, 2026

Handful of minor things;

  • Scryfall does make card backside images available via backs.scryfall.io. You can pass in the card_back_id to the URL which follows similar path conventions as cards.scryfall.io. This magic ID is the standard MTG card back, per their API.. Built a client locally and tested it renders correctly still.
  • 10 threads is awfully limited for doing a full download. I was toying with this locally and running it with 200 concurrent image download threads without issue and having downloads succeed much faster. Happy to drop this commit from the branch though if it's contentious.
  • There was a missing comma in the card name, which seemed to cause image finding issues. Fixed the imports to address SonarQube rule java:S2208 which advises against wildcard imports.
  • The estimates shown in the UI use outdated average file sizes of images from Scryfall. Given I had full data dumps, I went ahead and updated these because it was a little jarring seeing the estimates be a good 10-33% out depending on image quality selected.

@xenohedron
Copy link
Contributor

These are unrelated commits so if merged should not be squashed. Some notes:

  • Standard in this codebase is wildcard imports of mage project classes when more than 4. There's at least nothing wrong with import mage.constants.*. Also, standard is for the java.*** imports to remain at the bottom with a blank line separating from the mage imports. For context, due to the age and inconsistency of the codebase, there are certainly many files that don't align to the standard format of currently active devs. We try to avoid modifying files en masse for cosmetic adjustments when the changes could cause merge conflicts in other ongoing reworks. If you rewrite a substantial portion of a class, generally makes sense to fix formatting, but for one-line fixes, generally doesn't.
  • As I understand it, the primary reason for thread limits isn't the local machine, but the expectations from scryfall. See https://scryfall.com/docs/api (bottom section) and ensure that the way it's used won't exceed 10 requests per second to api.scryfall.com (no rate limit on direct usage of *.scryfall.io)


static {
directLinks.put(cardbackFilename, "https://upload.wikimedia.org/wikipedia/en/a/aa/Magic_the_gathering-card_back.jpg");
directLinks.put(cardbackFilename, "https://backs.scryfall.io/large/0/a/0aeebaf5-8c7d-4636-9e82-8c27447861f7.jpg");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong, do not use any guid or io links -- it's cdn related and can be changed any time by scryfall. Only api links must be used.


// DOWNLOAD THREADS
uiDialog.getDownloadThreadsCombo().setModel(new DefaultComboBoxModel<>(new String[]{"10", "9", "8", "7", "6", "5", "4", "3", "2", "1"}));
uiDialog.getDownloadThreadsCombo().setModel(new DefaultComboBoxModel<>(new String[]{"100", "75", "50", "40", "30", "20", "15", "10", "5", "1"}));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need such big values -- it can be unstable (zip storage mode easy to fail), also it can be banned by scryfall (it allow any rate limits on cdn/io links, but I don't trust it). So 1 - 20 are good.

// TODO: can't find backface's api url so use direct link from third party site instead (must be replaced to scryfall someday)
res.add(createXmageToken(XMAGE_IMAGE_NAME_FACE_DOWN_MANUAL, 1, "https://upload.wikimedia.org/wikipedia/en/a/aa/Magic_the_gathering-card_back.jpg"));
// Can't find backface via the API, so use direct image link
res.add(createXmageToken(XMAGE_IMAGE_NAME_FACE_DOWN_MANUAL, 1, "https://backs.scryfall.io/large/0/a/0aeebaf5-8c7d-4636-9e82-8c27447861f7.jpg"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no guid links allow

// Helper emblem (for global card hints)
// use backface for it
res.add(createXmageToken(XMAGE_IMAGE_NAME_HELPER_EMBLEM, 1, "https://upload.wikimedia.org/wikipedia/en/a/aa/Magic_the_gathering-card_back.jpg"));
res.add(createXmageToken(XMAGE_IMAGE_NAME_HELPER_EMBLEM, 1, "https://backs.scryfall.io/large/0/a/0aeebaf5-8c7d-4636-9e82-8c27447861f7.jpg"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no guid link allow

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants