-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add script to update picture links for tokens from Scryfall API #209
Conversation
The Scryfall picURL must be in one of those forms: | ||
|
||
- https://c1.scryfall.com/file/scryfall-cards/<version>/<face>/*/*/<uuid>.jpg | ||
- https://cards.scryfall.io/<version>/<face>/*/*/<uuid>.jpg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to account for any of the other variants?
https://scryfall.com/blog/upcoming-api-changes-to-scryfall-image-uris-and-download-uris-224
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure. It looks like only cards.scryfall.io is used for cards currently.
Maybe it would make sense for the script to check that it can re-parse the resolved URL and print out an error otherwise? This would indicate a change in scryfall's URLs that needs to be reflected in the script.
I'd be okay with something like this, but it would need to be updated to address conflicts, and potentially apart of the CLI GHA |
6ce452f
to
ae14a96
Compare
Rebased the PR. I have also separate the commit introducing the script from the actual update to
Can you point me to the file where this should happen? |
Not exactly sure, but I guess Zach is suggesting to have a GitHub action workflow that runs the script on a schedule to keep the links updated.
|
ae14a96
to
12b893f
Compare
Ah, I thought from the previous message that there was a specific workflow that was meant to be added to. I can set up a workflow to run the script on a schedule, but I would need to know when and how the script must run — I don't think that this is my call to make. I also think that having the script w/o the automation is a valuable first step and that automation could happen separately (when someone has the time to do it), but that is not my call to make either.
I did this last time I commented, but then the |
Sure! We can look into it in a second step. |
Oh sorry, I misunderstood the "conflicts" part I guess. I was referring to #209 (review):
Do you still want to look into that and think it's helpful? Also, do you mind removing the changes of the scrip run from the PR to have it cleaner? |
f72bacd
to
7acc1c0
Compare
Fix Cockatrice#201. This changes the links from the old CND on c1.scryfall.com to links to the new CDN on cards.scryfall.io. The changes are automated: the refresh.py script can read a tokens.xml file containing CDN picURLs of either version, and makes requests to the Scryfall API to generate the most up-to-date URLs for each token. The script can be run with: $ python3 refresh.py -i tokens.xml $ python3 refresh.py -i challenge_tokens.xml This avoids using api.scryfall.com URLs for the tokens (which are rate-limited) while still being able to update the file with new URLs by running the script.
7acc1c0
to
e9a7dac
Compare
This is the result of running the script from Cockatrice#209, without the script itself.
This is easy to do, I only did not do it because there was no acknowledgement of the suggestion. I have added it to the script (see here).
I have removed the changes to |
Thank you!
It would be easier to spot and review this change/addition if you not force pushed and overwrote the commit history. ;) |
You can use the "Compare" button to see the changes: Although you are right, it probably should have been a separate commit; I was already rebasing to remove the changes to the |
I think we can move on here as there are no further comments or request. Edit: Opened #259 for the CI automation on a reasonable schedule which takes care of creating PRs to keep the image links up to date. |
Fixes #201
This script changes the links from the old CND on c1.scryfall.com to links to the new CDN on cards.scryfall.io.
The refresh.py script can read a tokens.xml file containing CDN picURLs of either version, and makes requests to the Scryfall API to generate the most up-to-date URLs for each token.
The script can be run with:
$ python3 refresh.py -i tokens.xml
$ python3 refresh.py -i challenge_tokens.xml
This avoids using api.scryfall.com URLs for the tokens (which are rate-limited) while still being able to update the file with new URLs by running the script.