From d57c78cc0bfe5ea790f6b9826ac1dfcd5d2909ab Mon Sep 17 00:00:00 2001 From: marsteralex Date: Thu, 13 Oct 2022 20:22:31 -0400 Subject: [PATCH] add artifacts --- web/public/mtg/app.js | 13 ++++++++----- web/public/mtg/importCards.py | 14 +++++++------- web/public/mtg/index.html | 22 ++++++++++++++++++++++ web/public/mtg/jsons/artifact.json | 1 + web/public/mtg/jsons/artist.json | 2 +- web/public/mtg/jsons/artistList.json | 2 +- web/public/mtg/jsons/basic.json | 2 +- web/public/mtg/jsons/beast.json | 2 +- web/public/mtg/jsons/commander.json | 2 +- web/public/mtg/jsons/counterspell.json | 2 +- web/public/mtg/jsons/set.json | 2 +- web/public/mtg/jsons/watermark.json | 2 +- 12 files changed, 46 insertions(+), 20 deletions(-) create mode 100644 web/public/mtg/jsons/artifact.json diff --git a/web/public/mtg/app.js b/web/public/mtg/app.js index 4904a80b..aa81a1aa 100644 --- a/web/public/mtg/app.js +++ b/web/public/mtg/app.js @@ -12,6 +12,7 @@ wordsLeft = k + extra imagesLeft = k maxRounds = 20 whichGuesser = 'counterspell' +wordCategory = 'Unused Card Names: ' un = false ub = false online = false @@ -70,12 +71,18 @@ function putIntoMapAndFetch(data) { document.getElementById('guess-type').innerText = 'Finding Fantastic Beasts' } else if (whichGuesser === 'basic') { document.getElementById('guess-type').innerText = 'How Basic' + wordCategory = 'Unused Set Names: ' } else if (whichGuesser === 'commander') { document.getElementById('guess-type').innerText = 'General Knowledge' } else if (whichGuesser === 'watermark') { document.getElementById('guess-type').innerText = 'Watermark It' + wordCategory = 'Unused Watermarks: ' } else if (whichGuesser === 'artist') { document.getElementById('guess-type').innerText = 'Aesthetic Consultation' + wordCategory = 'Unused Artist Names: ' + } else if (whichGuesser === 'artifact') { + document.getElementById('guess-type').innerText = 'Archaeological Dating' + wordCategory = 'Unused Dates: ' } window.console.log(whichGuesser) setUpNewGame() @@ -483,10 +490,6 @@ function dropOnCard(id, data) { } function setWordsLeft() { - cardName = 'Unused Card Names: ' - if (whichGuesser === 'basic') { - cardName = 'Unused Set Names: ' - } document.getElementById('words-left').innerText = - cardName + wordsLeft + '/Images: ' + imagesLeft + wordCategory + wordsLeft + '/Images: ' + imagesLeft } diff --git a/web/public/mtg/importCards.py b/web/public/mtg/importCards.py index 01784413..207bf32e 100644 --- a/web/public/mtg/importCards.py +++ b/web/public/mtg/importCards.py @@ -5,7 +5,7 @@ import math # queued categories: 'terror', 'wrath', 'zombie', 'artifact'] # add category name here -allCategories = ['counterspell', 'beast', 'burn', 'commander'] +allCategories = ['counterspell', 'beast', 'burn', 'commander', 'artifact'] specialCategories = ['set', 'basic', 'watermark'] artist_denylist = '-a%3A"jason+felix"+-a%3A“Harold+McNeill”+-a%3A"Terese+Nielsen"+-a%3A“Noah+Bradley”' artist_allowlist = {'David Martin', 'V\u00e9ronique Meignaud', 'Christopher Rush', 'Rebecca Guay', 'DiTerlizzi', @@ -33,8 +33,8 @@ def generate_initial_query(category): '+or+legal%3Acommander+or+legal%3Abrawl%29' # elif category == 'zombie': # string_query += '-type%3Alegendary+type%3Azombie+-type%3Atoken+not%3Adfc' - # elif category == 'artifact': - # string_query += 't%3Aartifact+not%3Adatestamped+not%3Adfc&order=released&dir=asc&unique=prints&page=' + elif category == 'artifact': + string_query += 't%3Aartifact+not%3Adatestamped+-type%3Atoken+-art%3Acreation-date+not%3Adfc' # add category string query here string_query += '+-%28set%3Asld+%28cn>%3D231+cn<%3D233+or+cn>%3D436+cn<%3D440+or+cn>%3D321+cn<%3D324+or' \ '+cn>%3D185+cn<%3D189+or+cn>%3D138+cn<%3D142+or+cn>%3D364+cn<%3D368+or+cn%3A669+or+cn%3A670%29%29+' \ @@ -194,9 +194,9 @@ def to_compact_write_form(smallJson, art_names, response, category): continue write_card = dict() for field in fieldsInCard: - # if field == 'name' and category == 'artifact': - # write_card['name'] = card['released_at'].split('-')[0] - if field == 'name' and 'card_faces' in card: + if field == 'name' and category == 'artifact': + write_card['name'] = card['released_at'].split('-')[0] + elif field == 'name' and 'card_faces' in card: write_card['name'] = card['card_faces'][0]['name'] elif field == 'image_uris': if 'card_faces' in card and 'image_uris' in card['card_faces'][0]: @@ -366,7 +366,7 @@ def write_image_uris(card_image_uris): if __name__ == "__main__": # uncomment this once in a while, but it's expensive to run - fetch_and_write_initial_artist_query() + # fetch_and_write_initial_artist_query() for category in allCategories: print(category) diff --git a/web/public/mtg/index.html b/web/public/mtg/index.html index 18452166..21f598e0 100644 --- a/web/public/mtg/index.html +++ b/web/public/mtg/index.html @@ -302,6 +302,28 @@
+
+ + + +
+
+