Cockatrice: Investigate using the Scryfall API for HQ card images

Created on 27 Oct 2016  Â·  11Comments  Â·  Source: Cockatrice/Cockatrice

Scryfall is an auth-free api for card searching, and its api endpoints can provide images

https://scryfall.com/docs/api-methods

Most helpful comment

I'd like to redo pic URLs to just be a list we try in order

On Fri, Oct 28, 2016, 4:06 AM tooomm [email protected] wrote:

https://img.scryfall.com/cards/en/!setcode_lower!/!collectornumber!.jpg
works like a charm:

Trying to load picture (set: "KLD" card: "Accomplished Automaton" )
Picture NOT found, trying to download (set: "KLD" card: "Accomplished
Automaton" )
starting picture download: "Accomplished Automaton" Url: QUrl("
https://img.scryfall.com/cards/en/kld/191.jpg")

The same as
https://s3-us-west-2.amazonaws.com/echomage/cards/!setcode!/!cardid!.hq.jpg
is working perfectly: (found it on reddit
https://www.reddit.com/r/Cockatrice/comments/59lp7g/for_all_the_highresolution_junkies_out_there/
)

Trying to load picture (set: "GTC" card: "Act of Treason" )
Picture NOT found, trying to download (set: "GTC" card: "Act of Treason" )
starting picture download: "Act of Treason" Url: QUrl("
https://s3-us-west-2.amazonaws.com/echomage/cards/GTC/366305.hq.jpg")

There might be variances in availability or quality. The last one is
supposed to not be as up to date.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/Cockatrice/Cockatrice/issues/2240#issuecomment-256861081,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAA5NBoVsLadexrpBlSFls02UVGeBc9zks5q4azogaJpZM4Kie6n
.

All 11 comments

What's about using this pic link? Did not test it yet

https://img.scryfall.com/cards/en/!setcode_lower!/!collectornumber!.jpg

I tested that link earlier I think, but it didn't work

You need to set it as Primary download URL in Settings -> General Settings.

https://img.scryfall.com/cards/en/!setcode_lower!/!collectornumber!.jpg works like a charm:

Trying to load picture (set: "KLD" card: "Accomplished Automaton" )
Picture NOT found, trying to download (set: "KLD" card: "Accomplished Automaton" )
starting picture download: "Accomplished Automaton" Url: QUrl("https://img.scryfall.com/cards/en/kld/191.jpg")

The same as https://s3-us-west-2.amazonaws.com/echomage/cards/!setcode!/!cardid!.hq.jpg is working perfectly (found it on reddit´)

Trying to load picture (set: "GTC" card: "Act of Treason" )
Picture NOT found, trying to download (set: "GTC" card: "Act of Treason" )
starting picture download: "Act of Treason" Url: QUrl("https://s3-us-west-2.amazonaws.com/echomage/cards/GTC/366305.hq.jpg")



There might be variances in availability or quality. The last one is supposed to not be as up to date, and maybe not complete. And the first page is pretty new, so no idea if it'll stick around.

I'd like to redo pic URLs to just be a list we try in order

On Fri, Oct 28, 2016, 4:06 AM tooomm [email protected] wrote:

https://img.scryfall.com/cards/en/!setcode_lower!/!collectornumber!.jpg
works like a charm:

Trying to load picture (set: "KLD" card: "Accomplished Automaton" )
Picture NOT found, trying to download (set: "KLD" card: "Accomplished
Automaton" )
starting picture download: "Accomplished Automaton" Url: QUrl("
https://img.scryfall.com/cards/en/kld/191.jpg")

The same as
https://s3-us-west-2.amazonaws.com/echomage/cards/!setcode!/!cardid!.hq.jpg
is working perfectly: (found it on reddit
https://www.reddit.com/r/Cockatrice/comments/59lp7g/for_all_the_highresolution_junkies_out_there/
)

Trying to load picture (set: "GTC" card: "Act of Treason" )
Picture NOT found, trying to download (set: "GTC" card: "Act of Treason" )
starting picture download: "Act of Treason" Url: QUrl("
https://s3-us-west-2.amazonaws.com/echomage/cards/GTC/366305.hq.jpg")

There might be variances in availability or quality. The last one is
supposed to not be as up to date.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/Cockatrice/Cockatrice/issues/2240#issuecomment-256861081,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAA5NBoVsLadexrpBlSFls02UVGeBc9zks5q4azogaJpZM4Kie6n
.

For some reason it's not working for me. I've also set the fallback URL to the default primary but it's not fetching anything. I'm using version 277d7e (2016-06-30).

Got a debug log?

It appears !collectornumber! is not being expanded or replaced.

Trying to load picture (set:  "ORI"  card:  "Abbot of Keral Keep" )
Picture NOT found, trying to download (set:  "ORI"  card:  "Abbot of Keral Keep" )
starting picture download: "Abbot of Keral Keep" Url: QUrl("https://img.scryfall.com/cards/en/ori/!collectornumber!.jpg")
Download failed: "Error transferring https://img.scryfall.com/cards/en/ori/!collectornumber!.jpg - server replied: Forbidden"
Picture NOT found, download failed, moving to next set (newset:  "pPRE"  card:  "Abbot of Keral Keep" )
Trying to load picture (set:  "pPRE"  card:  "Abbot of Keral Keep" )
Picture NOT found, trying to download (set:  "pPRE"  card:  "Abbot of Keral Keep" )
starting picture download: "Abbot of Keral Keep" Url: QUrl("http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=0&type=card")
Picture downloaded, but blacklisted, will consider it as not found
Picture NOT found, download failed, no more sets to try: BAILING OUT (oldset:  "pPRE"  card:  "Abbot of Keral Keep" )
QPixmap::scaled: Pixmap is a null pixmap

Primary download URL: https://img.scryfall.com/cards/en/!setcode_lower!/!collectornumber!.jpg
Fallback download URL: http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=!cardid!&type=card

So I updated Cockatrice to 3498b16 (2016-10-30) and it is now working. However, sometimes there are issues. For example:

Trying to load picture (set:  "ALL"  card:  "Force of Will" )
Picture NOT found, trying to download (set:  "ALL"  card:  "Force of Will" )
starting picture download: "Force of Will" Url: QUrl("https://img.scryfall.com/cards/en/all/.jpg")
Download failed: "Error transferring https://img.scryfall.com/cards/en/all/.jpg - server replied: Forbidden"
Picture NOT found, download failed, moving to next set (newset:  "MED"  card:  "Force of Will" )
Trying to load picture (set:  "MED"  card:  "Force of Will" )
Picture NOT found, trying to download (set:  "MED"  card:  "Force of Will" )
starting picture download: "Force of Will" Url: QUrl("https://img.scryfall.com/cards/en/med/33.jpg")

It's not finding the Alliances version and it is downloading the Masters Edition version instead, however I have MED disabled in my Sets.

Another example involving the fallback URL:

Trying to load picture (set:  "TMP"  card:  "Wasteland" )
Picture NOT found, trying to download (set:  "TMP"  card:  "Wasteland" )
starting picture download: "Wasteland" Url: QUrl("https://img.scryfall.com/cards/en/tmp/.jpg")
Download failed: "Error transferring https://img.scryfall.com/cards/en/tmp/.jpg - server replied: Forbidden"
Picture NOT found, download failed, moving to next set (newset:  "pJGP"  card:  "Wasteland" )
Trying to load picture (set:  "pJGP"  card:  "Wasteland" )
Picture NOT found, trying to download (set:  "pJGP"  card:  "Wasteland" )
starting picture download: "Wasteland" Url: QUrl("http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=0&type=card")
Picture downloaded, but blacklisted, will consider it as not found
Picture NOT found, download failed, moving to next set (newset:  "pMPR"  card:  "Wasteland" )
Trying to load picture (set:  "pMPR"  card:  "Wasteland" )
Picture NOT found, trying to download (set:  "pMPR"  card:  "Wasteland" )
starting picture download: "Wasteland" Url: QUrl("http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=0&type=card")
Picture downloaded, but blacklisted, will consider it as not found
Picture NOT found, download failed, moving to next set (newset:  "EXP"  card:  "Wasteland" )
Trying to load picture (set:  "EXP"  card:  "Wasteland" )
Picture NOT found, trying to download (set:  "EXP"  card:  "Wasteland" )
starting picture download: "Wasteland" Url: QUrl("https://img.scryfall.com/cards/en/exp/45.jpg")

It's not finding the Alliances version and it is downloading the Masters Edition version instead, however I have MED disabled in my Sets.

Did you check the hints in the Edit sets... dialog?
Disabling sets doesn't always prevent pics from downloading.

Thanks, I had forgotten about it. It makes sense now. But shouldn't the fallback URL be tried before going to other sets? In the second example I posted it seems to jump between URLs and sets.

Wouldn't
Set 1 URL 1
Set 1 URL 2
Set 2 URL 1
Set 2 URL 2
make more sense?

2479

Was this page helpful?
0 / 5 - 0 ratings

Related issues

FinksJuice picture FinksJuice  Â·  4Comments

tooomm picture tooomm  Â·  6Comments

ShrewMaster picture ShrewMaster  Â·  6Comments

Assassinsquid picture Assassinsquid  Â·  4Comments

A4G picture A4G  Â·  5Comments