Skip to content
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

Feature/scryfall data #12

Merged
merged 22 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
6af6a0c
Adding Scryfall call to look up two, two, two spells in one!
ThePieBandit Feb 17, 2021
8f7bb6a
Some linting fixes - still a ways to go
ThePieBandit Feb 17, 2021
2f31404
Merge branch 'master' into feature/scryfallData
ThePieBandit Feb 17, 2021
33aa1d4
attempting to fix ssl cert issue
ThePieBandit Feb 22, 2021
3826f30
Merge branch 'feature/scryfallData' of github.com:ThePieBandit/TCG-to…
ThePieBandit Feb 22, 2021
7934621
Python doesn't do string contains like Java Does
ThePieBandit Feb 28, 2021
12ff162
switching to requests library
ThePieBandit Feb 28, 2021
18beeb4
adding stuff for newest entries
ThePieBandit Jul 6, 2021
caa6f09
Added new replacement rules, added ignore rules for dualfaced cards t…
rkonell Dec 30, 2021
71a7e75
checking in changes that don't work, before I forget
ThePieBandit Dec 31, 2021
1dba450
Merge branch 'feature/scryfallData' into feature/updated-replacements…
ThePieBandit Dec 31, 2021
adcd92f
Merge pull request #13 from rkonell/feature/updated-replacements-and-…
ThePieBandit Dec 31, 2021
61e56cd
more dual face cards to ignore from scryfall, added mapping for bab c…
rkonell Jan 3, 2022
83da1ad
needed to update how mystery booster test cards are handled -- deckbo…
rkonell Jan 5, 2022
bdb958b
linting commit + updates to README specifying the use of black as the…
rkonell Jan 5, 2022
9bbff9a
added more card rules, moved alternative art rules to replacements.co…
rkonell Jan 5, 2022
41904e0
Merge pull request #14 from rkonell/feature/adjustments_for_latest_se…
ThePieBandit Jan 10, 2022
790a7a8
Checking deckbox to see if a card name exists in the case of double f…
ThePieBandit Jan 10, 2022
b0b8306
some minor fixes and more replacements
ThePieBandit Jun 19, 2022
34e4ff2
Making promo packs, buy a box, and commander editions smoother
ThePieBandit Aug 13, 2023
2406472
Code cleanup
ThePieBandit Mar 6, 2024
a396abe
readme and disabling workflows
ThePieBandit Mar 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows-disabled/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: CI

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
# additionally allows a manual trigger via workflow_dispatch
on:
workflow_dispatch:
types: ManualUpdate
push:
branches: [ master ]
pull_request:
branches: [ master ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- name: Build Linux Executable
uses: JackMcKew/pyinstaller-action-linux@tkinter
with:
path: src
tkinter: true
- name: Upload Linux Executable
uses: actions/upload-artifact@v2
with:
name: tcg-to-deckbox
path: src/dist/linux
- name: Build Windows Executable
uses: JackMcKew/pyinstaller-action-windows@main
with:
path: src
- name: Upload Windows Executable
uses: actions/upload-artifact@v2
with:
name: tcg-to-deckbox
path: src/dist/windows
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# This is a basic workflow to help you get started with Actions

name: CI
name: CD

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
Expand All @@ -10,8 +8,6 @@ on:
types: ManualUpdate
push:
branches: [ master ]
pull_request:
branches: [ master ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
Expand All @@ -24,7 +20,7 @@ jobs:
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- name: Build Linux Executable
uses: JackMcKew/pyinstaller-action-linux@tkinter
with:
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
deckbox_import.csv
build
dist
multiple_names.json
__pycache__
.vscode/settings.json
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 38 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,53 @@
# TCG-to-Deckbox
Python script to convert TCGPlayer app's export file into the proper format for deckbox.org's import. Tested with python 3.6.9

Python script to convert TCGPlayer app's export file into the proper format for deckbox.org's import. Tested with python
3.10.12

## Why this is useful

https://deckbox.org/ is a popular tool for cataloging one's [Magic: the Gathering](https://magic.wizards.com/en) collection. Card entry can be tedious, which is why many users are turning to scanning apps, such as [TCGplayer's card scanning app](https://app.tcgplayer.com/). However, the export format of TCGplayer's app is incompatible with deckbox.org's import format. This tool is designed to reformat the TCGplayer csv export into a valid deckbox csv import.
https://deckbox.org/ is a popular tool for cataloging one's [Magic: the Gathering](https://magic.wizards.com/en)
collection. Card entry can be tedious, which is why many users are turning to scanning apps, such
as [TCGplayer's card scanning app](https://app.tcgplayer.com/). However, the export format of TCGplayer's app is
incompatible with deckbox.org's import format. This tool is designed to reformat the TCGplayer csv export into a valid
deckbox csv import.

Additionally, this tool now contains some basic replacement logic based on how TCGPlayer and deckbox differ in their
categorization of cards. The short version: TCG player likes to append things like (borderless), (showcase) etc to the
cards, whereas deckbox just uses the collector number. There are two replacement types: generic, and manual. The generic
ones are handled in code, doing things like stripping out parentheses. The specific ones are mostly handled via the
replacements.config file, which lists a mapping of translated values .

## How to use.

The script has two modes: CLI and GUI. To use the CLI, provide the path to your TCGplayer csv file:
To use the CLI, provide the path to your TCGplayer csv file:

python3 tcg-to-deckbox.py ~/bin/sample_input.csv

To start it in GUI mode, just launch the program without any arguments

python3 tcg-to-deckbox.py

In both cases, it will give you a new csv, named `deckbox_import.csv` in the directory from which the script was run.
It will give you a new csv, named `deckbox_import.csv` in the directory from which the script was run.

As part of its process, the script will query https://scryfall.com to get a list of double-faced cards, as these can be
tricky when it comes to matching with deckbox. Additionally, it grabs a list of buy-a-box cards, as those are
categorized completely differently on the TCGPlayer scanner app. The script is configured to only download this once a
week so as not to be excessive. If you have actually scanned any double faced cards, it does double check their name by
querying deckbox.org directly.

## Limitations

1. Card names - I found some card names that are just formatted differently between the two. I manually adjust these card names in my replacements file, however, this was limited to the cards I hit. Of particular note were the Throne of Eldraine Adventure cards, which only used the Creature's name. Another oddity was Tamiyo's journal, which could have different flavor text. If you hit any of these in your collection, you don't need to be a programmer to fix it, just add another entry in `src/replacements.config` and rerun the script. Be sure to let me know so I can add it here too!
1. Card names - I found some card names that are just formatted differently between the two. I manually adjust these
card names in my replacements file, however, this was limited to the cards I hit. Of particular note were the Throne
of Eldraine Adventure cards, which only used the Creature's name. Another oddity was Tamiyo's journal, which could
have different flavor text. If you hit any of these in your collection, you don't need to be a programmer to fix it,
just add another entry in `src/replacements.config` and rerun the script. Be sure to let me know so I can add it here
too!

2. Showcase and extended art cards - TCGplayer suffixes these with `(Extended Art)` or `(Showcase)`. If the script finds
these terms, it just deletes them. They're unnecessary as they have different collector's numbers.

3. Odd sets from Magic's history - I did my best here, but some of the older sets didn't quite line up. Some I just
didn't have enough information on, some looked like categories of multiple sets, and some actually look like they map
to multiple different sets in deckbox. If you hit some of these, manual correction is probably the best bet for now,
but if you have a solution, feel free to share!

2. Showcase and extended art cards - TCGplayer suffixes these with `(Extended Art)` or `(Showcase)`. If the script finds these terms, it just deletes them. They're unnecessary as they have different collector's numbers.
## Contributing

3. Odd sets from Magic's history - I did my best here, but some of the older sets didn't quite line up. Some I just didn't have enough information on, some looked like categories of multiple sets, and some actually look like they map to multple different sets in deckbox. If you hit some of these, manual correction is probably the best bet for now, but if you have a solution, feel free to share!
Feel free to fork the project and submit suggested fixes
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@

certifi==2021.10.8
requests~=2.31.0
71 changes: 34 additions & 37 deletions src/replacements.config
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ Damaged=Poor
Chinese (S)=Chinese
Chinese (T)=Chinese Traditional

[EDITONS]
[EDITIONS]
The List Reprints=The List
Masterpiece Series: Amonkhet Invocations=Amonkhet Invocations
Arena Promos=Arena League
APAC Lands=Asia Pacific Land Program
Expand Down Expand Up @@ -45,6 +46,7 @@ Magic 2012 (M12)=Magic 2012
Magic 2013 (M13)=Magic 2013
Magic 2014 (M14)=Magic 2014 Core Set
Magic 2015 (M15)=Magic 2015 Core Set
Game Day & Store Championship Promos=Magic Game Day Cards
Media Promos=Media Inserts
Magic Modern Event Deck=Modern Event Deck 2014
Modern Masters 2015=Modern Masters 2015 Edition
Expand All @@ -67,41 +69,36 @@ Mythic Edition: War of the Spark=War of the Spark Mythic Edition
WMCQ Promo Cards=World Magic Cup Qualifiers
World Championship Decks=Worlds
WPN & Gateway Promos=WPN/Gateway
Promo Pack: Strixhaven=Promo Pack: Strixhaven: School of Mages
Strixhaven: Mystical Archives=Strixhaven Mystical Archive
Time Spiral: Remastered=Time Spiral Remastered
Commander: Adventures in the Forgotten Realms=Adventures in the Forgotten Realms Commander
Commander: Innistrad: Midnight Hunt=Innistrad: Midnight Hunt Commander
Commander: Innistrad: Crimson Vow=Innistrad: Crimson Vow Commander
SLX Cards=Universes Within
Commander: Streets of New Capenna=Streets of New Capenna Commander
The Brothers' War: Retro Frame Artifacts=The Brothers' War Retro Artifacts
March of the Machine: Multiverse Legends=Multiverse Legends
Promo Pack: Kamigawa: Neon Dynasty=Promo Pack: Kamigawa: Neon Dynasty
XLN Treasure Chest=Black Friday Treasure Chest Promos

[NAMES]
Animating Faerie=Animating Faerie // Bring to Life
Ardenvale Tactician=Ardenvale Tactician // Dizzying Swoop
Beanstalk Giant=Beanstalk Giant // Fertile Footsteps
Bonecrusher Giant=Bonecrusher Giant // Stomp
Brazen Borrower=Brazen Borrower // Petty Theft
Curious Pair=Curious Pair // Treats to Share
Embereth Shieldbreaker=Embereth Shieldbreaker // Battle Display
Fae of Wishes=Fae of Wishes // Granted
Faerie Guidemother=Faerie Guidemother // Gift of the Fae
Flaxen Intruder=Flaxen Intruder // Welcome Home
Foulmire Knight=Foulmire Knight // Profane Insight
Garenbrig Carver=Garenbrig Carver // Shield's Might
Giant Killer=Giant Killer // Chop Down
Hypnotic Sprite=Hypnotic Sprite // Mesmeric Glare
Lonesome Unicorn=Lonesome Unicorn // Rider in Need
Lovestruck Beast=Lovestruck Beast // Heart's Desire
Merchant of the Vale=Merchant of the Vale // Haggle
Merfolk Secretkeeper=Merfolk Secretkeeper // Venture Deeper
Murderous Rider=Murderous Rider // Swift End
Oakhame Ranger=Oakhame Ranger // Bring Back
Order of Midnight=Order of Midnight // Alter Fate
Queen of Ice=Queen of Ice // Rage of Winter
Realm-Cloaked Giant=Realm-Cloaked Giant // Cast Off
Reaper of Night=Reaper of Night // Harvest Fear
Rimrock Knight=Rimrock Knight // Boulder Rush
Rosethorn Acolyte=Rosethorn Acolyte // Seasonal Ritual
Shepherd of the Flock=Shepherd of the Flock // Usher to Safety
Silverflame Squire=Silverflame Squire // On Alert
Smitten Swordmaster=Smitten Swordmaster // Curry Favor
Tuinvale Treefolk=Tuinvale Treefolk // Oaken Boon
Tamiyo's Journal (Entry 922)=Tamiyo's Journal
Tamiyo's Journal (Entry 711)=Tamiyo's Journal
Tamiyo's Journal (Entry 546)=Tamiyo's Journal
Tamiyo's Journal (Entry 855)=Tamiyo's Journal
Tamiyo's Journal (Entry 434)=Tamiyo's Journal
Tamiyo's Journal (Entry 653)=Tamiyo's Journal
;; Crimson Vow Alternative Art
Sisters of the Undead - Olivia, Crimson Bride=Olivia, Crimson Bride
Mina Harker - Thalia, Guardian of Thraben=Thalia, Guardian of Thraben
Abraham Van Helsing - Savior of Ollenbock=Savior of Ollenbock
Dracula, Lord of Blood - Voldaren Bloodcaster=Voldaren Bloodcaster
Dracula the Voyager - Edgar, Charmed Groom=Edgar, Charmed Groom
Dracula, Blood Immortal - Falkenrath Forebear=Falkenrath Forebear
;; Ikoria Alternative Art
Destoroyah, Perfect Lifeform - Everquill Phoenix=Everquill Phoenix

[SPECIAL_NAMES]
;; A rare few cards actually have Parentheses as part of the name. We don't want to strip these.
B.F.M. (Big Furry Monster) (Left)=B.F.M. (Big Furry Monster Left)
B.F.M. (Big Furry Monster) (Right)=B.F.M. (Big Furry Monster Right)
B.O.B. (Bevy of Beebles)=B.O.B. (Bevy of Beebles)
Erase (Not the Urza's Legacy One)=Erase (Not the Urza's Legacy One)
Hazmat Suit (Used)=Hazmat Suit (Used)

[ALTERNATE_ARTS]
Loading