Image sub-folder Set code source
Posted: 06 Jan 2023, 23:26
I'm working on a small project to download Forge images using Scryfall's API. The goal is to also implement a standalone auditing tool similar to what is found ingame but be able to run it against Scryfall's info and grab only the missing sets/cards or do other kinds of data manipulation like deck building, etc. The tech stack is mainly just Blazor and C# as that's what I'm trying to learn with this.
I've run into a couple edge cases while debugging and I'm hoping that someone more knowledgeable about Forge's source code would help me out.
The local data sources i'm parsing are the /res/editions .txt files, I suppose that's where Forge reads the information for the available sets and respective cards. This gives me a nice overview of the entire Forge library.
After extracting the Code, Code2, Alias and ScryfallCode from the Metadata section, I compare those with all the Scryfall sets returned from the /sets endpoint, and also with all the sub-folders that exist in the /pics/cards folder.
In the end, I want to get the match between: Edition code - Scryfall Set - Card Pics Sub-Folder.
With that information I can easily count the number of image files inside the folder (if it exists), count the amount of cards in the [cards] section of the edition.txt file and make a get request to scryfall for the missing data, if any.
The problem I've run into, for now, is the mismatch of some folder names and the respective edition code, particularly on older sets. For instance, Unlimited Edition:
This however leads to the next problem I encountered but only spotted it one time for an exception thrown in my app. It's a code overlap between two distinct sets: Masters Edition and Mythic Edition - Ravnica Allegiance
And just for fun I'll share some data about the amount of sections and metadata fields present in all of the edition files, I used this information to help me define C# models for the editions. (there are 2 personal custom editions I used for testing that shouldn't count but they are simple and only contain a cards section apart from the default metadata).
I've run into a couple edge cases while debugging and I'm hoping that someone more knowledgeable about Forge's source code would help me out.
The local data sources i'm parsing are the /res/editions .txt files, I suppose that's where Forge reads the information for the available sets and respective cards. This gives me a nice overview of the entire Forge library.
After extracting the Code, Code2, Alias and ScryfallCode from the Metadata section, I compare those with all the Scryfall sets returned from the /sets endpoint, and also with all the sub-folders that exist in the /pics/cards folder.
In the end, I want to get the match between: Edition code - Scryfall Set - Card Pics Sub-Folder.
With that information I can easily count the number of image files inside the folder (if it exists), count the amount of cards in the [cards] section of the edition.txt file and make a get request to scryfall for the missing data, if any.
The problem I've run into, for now, is the mismatch of some folder names and the respective edition code, particularly on older sets. For instance, Unlimited Edition:
- Code: Select all
[metadata]
Code=2ED
Code2=U
ScryfallCode=2ED
- How do I make sure I'm targeting the proper folder name when downloading image files and distributing them to the game's path?
- I did some testing and found that if there is a Code2 field in the Metadata, that should be the folder name (and only that), is that correct for all cases?
- Shouldn't Code be the default value for the images subfolder name and all the other available codes possible fallbacks (including ScryfallCode)? This would mean that even if there is a mismatch between Scryfalls code and Forge edition Code we could use any of the paths
This however leads to the next problem I encountered but only spotted it one time for an exception thrown in my app. It's a code overlap between two distinct sets: Masters Edition and Mythic Edition - Ravnica Allegiance
- Code: Select all
[metadata]
Code=MED <=
Name=Masters Edition
ScryfallCode=ME1
[metadata]
Code=MPS_RNA
Name=Mythic Edition - Ravnica Allegiance
ScryfallCode=med <=
And just for fun I'll share some data about the amount of sections and metadata fields present in all of the edition files, I used this information to help me define C# models for the editions. (there are 2 personal custom editions I used for testing that shouldn't count but they are simple and only contain a cards section apart from the default metadata).
- Code: Select all
Section - Featured in n Editions
[metadata] - 549
[cards] - 548
[tokens] - 242
[promo] - 21
[showcase] - 20
[borderless] - 19
[buy a box] - 18
[extended art] - 17
[rebalanced] - 13
[precon product] - 11
[other] - 6
[Lands] - 5
[lands] - 4
[Foils] - 3
[dungeons] - 2
[jumpstart] - 2
[Basic Lands] - 2
[box topper] - 2
[alternate art] - 2
[retrocards] - 1
[retrolands] - 1
[Aether Revolt Inventions] - 1
[Legendaries] - 1
[Non-Legendary Uncommons] - 1
[Non-Legendary RareMythics] - 1
[oldframes] - 1
[spire] - 1
[foils] - 1
[mid] - 1
[vow] - 1
[midDFC] - 1
[vowDFC] - 1
[Kaladesh Inventions] - 1
[Snow Lands] - 1
[UrzaLands] - 1
[special slot] - 1
[alternate frame] - 1
[bundle] - 1
[NewToModern] - 1
[White CommonUncommon] - 1
[Blue CommonUncommon] - 1
[Black CommonUncommon] - 1
[Red CommonUncommon] - 1
[Green CommonUncommon] - 1
[Multi CommonUncommon] - 1
[Artifact Land CommonUncommon] - 1
[Pre M15] - 1
[Post M15 RareMythic] - 1
[etched] - 1
[lesson] - 1
[Commons] - 1
[Uncommons] - 1
[RareMythics] - 1
[ModalDoubleFaceCards] - 1
- Code: Select all
Metadata Field - Featured in n Editions
Code - 549
Date - 549
Name - 549
Type - 549
ScryfallCode - 543
Code2 - 168
Booster - 150
BoosterCovers - 148
FatPack - 76
FatPackExtraSlots - 67
ChaosDraftThemes - 61
Foil - 51
FoilAlwaysInCommonSlot - 31
Alias - 28
BoosterBox - 25
Border - 23
Prerelease - 17
CardLang - 16
FoilChanceInBooster - 9
AdditionalSetUnlockedInQuest - 8
AdditionalSheetForFoils - 7
BoosterMustContain - 4
DoublePick - 3
TreatAsSmallSet - 3
MciCode - 2
ChanceReplaceCommonWith - 2
DraftBooster - 2
#BoosterBox - 2
BoosterReplaceSlotFromPrintSheet - 2
SheetReplaceCardFromSheet - 1
SheetReplaceCardFromSheet2 - 1
CollectorBooster - 1