Photo-title fixture set + resolve baseline; language-only cues skip fetch
Data-driven stub XML for all 27 extracted titles (searches incl. empty results for the long Avalon Hill/SPI box titles, truncated-head retry queries for later, tie-break stats with publisher links, version lists aligned with the real collection objectids). Language-only cues no longer trigger a versions fetch — language can't reach the plausibility threshold alone, so the request would always be wasted; it still scores when stronger cues exist. Baseline resolve: 22 auto, 1 ambiguous (Wiz-War editions), 4 unmatched (the long box titles — next commit). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
title_raw,bgg_id,bgg_name,year,type,match_status,version_id,version_name,version_status,candidates_json,version_candidates_json,source_photos
|
||||
ROYALS,165986,Royals,2014,boardgame,auto,,,version_unknown,"[{""bgg_id"": 165986, ""name"": ""Royals"", ""year"": 2014, ""type"": ""boardgame"", ""exact"": true, ""fuzzy"": 100.0, ""owned"": null, ""rank"": null}]",[],IMG_4499.jpeg
|
||||
CAT CRIMES,235096,Cat Crimes,2017,boardgame,auto,360982,English edition,version_auto,"[{""bgg_id"": 235096, ""name"": ""Cat Crimes"", ""year"": 2017, ""type"": ""boardgame"", ""exact"": true, ""fuzzy"": 100.0, ""owned"": null, ""rank"": null}]","[{""version_id"": 360982, ""name"": ""English edition"", ""year"": 2017, ""publishers"": [""ThinkFun""], ""languages"": [""English""], ""score"": 3}]",IMG_4499.jpeg
|
||||
COSMIC ENCOUNTER,40529,Cosmic Encounter,2008,boardgame,auto,,,version_unknown,"[{""bgg_id"": 39, ""name"": ""Cosmic Encounter"", ""year"": 1977, ""type"": ""boardgame"", ""exact"": true, ""fuzzy"": 100.0, ""owned"": 7000, ""rank"": 800}, {""bgg_id"": 40529, ""name"": ""Cosmic Encounter"", ""year"": 2008, ""type"": ""boardgame"", ""exact"": true, ""fuzzy"": 100.0, ""owned"": 75000, ""rank"": 150}]",[],IMG_4499.jpeg
|
||||
SHERIFF OF NOTTINGHAM,157969,Sheriff of Nottingham,2014,boardgame,auto,,,version_unknown,"[{""bgg_id"": 157969, ""name"": ""Sheriff of Nottingham"", ""year"": 2014, ""type"": ""boardgame"", ""exact"": true, ""fuzzy"": 100.0, ""owned"": null, ""rank"": null}]",[],IMG_4499.jpeg
|
||||
5 MINUTE DUNGEON,207830,5-Minute Dungeon,2017,boardgame,auto,,,version_unknown,"[{""bgg_id"": 207830, ""name"": ""5-Minute Dungeon"", ""year"": 2017, ""type"": ""boardgame"", ""exact"": true, ""fuzzy"": 100.0, ""owned"": null, ""rank"": null}]",[],IMG_4499.jpeg
|
||||
Britannia,240,Britannia,1986,boardgame,auto,25668,Avalon Hill English edition,version_auto,"[{""bgg_id"": 240, ""name"": ""Britannia"", ""year"": 1986, ""type"": ""boardgame"", ""exact"": true, ""fuzzy"": 100.0, ""owned"": null, ""rank"": null}]","[{""version_id"": 25668, ""name"": ""Avalon Hill English edition"", ""year"": 1986, ""publishers"": [""The Avalon Hill Game Co""], ""languages"": [""English""], ""score"": 3}]",IMG_4500.jpeg
|
||||
CIVILIZATION Game of the Heroic Age - The Dawn of History 8000 BC to 250 BC,,,,,unmatched,,,,[],[],IMG_4500.jpeg
|
||||
"ADVANCED CIVILIZATION Game Expansion of the Heroic Age - Featuring New Civilization, Commodity, and Calamity Cards",,,,,unmatched,,,,[],[],IMG_4500.jpeg
|
||||
DOCTOR WHO The Game of Time & Space,3090,Doctor Who: The Game of Time & Space,1980,boardgame,auto,309001,Games Workshop English edition,version_auto,"[{""bgg_id"": 3090, ""name"": ""Doctor Who: The Game of Time & Space"", ""year"": 1980, ""type"": ""boardgame"", ""exact"": true, ""fuzzy"": 100.0, ""owned"": null, ""rank"": null}]","[{""version_id"": 309001, ""name"": ""Games Workshop English edition"", ""year"": 1980, ""publishers"": [""Games Workshop Ltd.""], ""languages"": [""English""], ""score"": 3}]",IMG_4500.jpeg
|
||||
SORCERER The Game of Magical Conflict,,,,,unmatched,,,,[],[],IMG_4500.jpeg
|
||||
STARFORCE ALPHA CENTAURI Interstellar Conflict in the 25th Century,,,,,unmatched,,,,[],[],IMG_4500.jpeg
|
||||
SKIP-BO,1078,Skip-Bo,1967,boardgame,auto,,,version_unknown,"[{""bgg_id"": 1078, ""name"": ""Skip-Bo"", ""year"": 1967, ""type"": ""boardgame"", ""exact"": true, ""fuzzy"": 100.0, ""owned"": null, ""rank"": null}]",[],IMG_4501.jpeg
|
||||
a Gentle Rain,268163,A Gentle Rain,2019,boardgame,auto,268164,Bloom Edition,version_auto,"[{""bgg_id"": 268163, ""name"": ""A Gentle Rain"", ""year"": 2019, ""type"": ""boardgame"", ""exact"": true, ""fuzzy"": 100.0, ""owned"": null, ""rank"": null}]","[{""version_id"": 268164, ""name"": ""Bloom Edition"", ""year"": 2021, ""publishers"": [""Mondo Games""], ""languages"": [""English""], ""score"": 3}]",IMG_4501.jpeg
|
||||
PATCH WORK,163412,Patchwork,2014,boardgame,auto,,,version_unknown,"[{""bgg_id"": 163412, ""name"": ""Patchwork"", ""year"": 2014, ""type"": ""boardgame"", ""exact"": false, ""fuzzy"": 94.7, ""owned"": null, ""rank"": null}]",[],IMG_4501.jpeg
|
||||
SANTORINI,194655,Santorini,2016,boardgame,auto,,,version_unknown,"[{""bgg_id"": 194655, ""name"": ""Santorini"", ""year"": 2016, ""type"": ""boardgame"", ""exact"": true, ""fuzzy"": 100.0, ""owned"": null, ""rank"": null}]",[],IMG_4501.jpeg;IMG_4502.jpeg
|
||||
Utter Nonsense!,181254,Utter Nonsense,2015,boardgame,auto,,,version_unknown,"[{""bgg_id"": 181254, ""name"": ""Utter Nonsense"", ""year"": 2015, ""type"": ""boardgame"", ""exact"": true, ""fuzzy"": 100.0, ""owned"": null, ""rank"": null}]",[],IMG_4501.jpeg
|
||||
Cards Against Humanity,50381,Cards Against Humanity,2009,boardgame,auto,,,version_unknown,"[{""bgg_id"": 50381, ""name"": ""Cards Against Humanity"", ""year"": 2009, ""type"": ""boardgame"", ""exact"": true, ""fuzzy"": 100.0, ""owned"": null, ""rank"": null}]",[],IMG_4501.jpeg
|
||||
Joking Hazard,193621,Joking Hazard,2016,boardgame,auto,19362101,First edition,version_auto,"[{""bgg_id"": 193621, ""name"": ""Joking Hazard"", ""year"": 2016, ""type"": ""boardgame"", ""exact"": true, ""fuzzy"": 100.0, ""owned"": null, ""rank"": null}]","[{""version_id"": 19362101, ""name"": ""First edition"", ""year"": 2016, ""publishers"": [""Cyanide & Happiness""], ""languages"": [""English""], ""score"": 3}]",IMG_4501.jpeg;IMG_4502.jpeg
|
||||
EXPLODING KITTENS,172225,Exploding Kittens,2015,boardgame,auto,,,version_unknown,"[{""bgg_id"": 172225, ""name"": ""Exploding Kittens"", ""year"": 2015, ""type"": ""boardgame"", ""exact"": true, ""fuzzy"": 100.0, ""owned"": null, ""rank"": null}]",[],IMG_4501.jpeg
|
||||
Herbaceous,195314,Herbaceous,2017,boardgame,auto,,,version_unknown,"[{""bgg_id"": 195314, ""name"": ""Herbaceous"", ""year"": 2017, ""type"": ""boardgame"", ""exact"": true, ""fuzzy"": 100.0, ""owned"": null, ""rank"": null}]",[],IMG_4502.jpeg
|
||||
Wiz-War,,,,,ambiguous,,,,"[{""bgg_id"": 1218, ""name"": ""Wiz-War"", ""year"": 1983, ""type"": ""boardgame"", ""exact"": true, ""fuzzy"": 100.0, ""owned"": 4000, ""rank"": 2500}, {""bgg_id"": 104710, ""name"": ""Wiz-War"", ""year"": 2012, ""type"": ""boardgame"", ""exact"": true, ""fuzzy"": 100.0, ""owned"": 8000, ""rank"": 1200}]",[],IMG_4502.jpeg
|
||||
SCRAWL,218866,Scrawl,2017,boardgame,auto,,,version_unknown,"[{""bgg_id"": 218866, ""name"": ""Scrawl"", ""year"": 2017, ""type"": ""boardgame"", ""exact"": true, ""fuzzy"": 100.0, ""owned"": null, ""rank"": null}]",[],IMG_4502.jpeg
|
||||
FLAT TOP,2529,Flat Top,1977,boardgame,auto,,,version_unknown,"[{""bgg_id"": 2529, ""name"": ""Flat Top"", ""year"": 1977, ""type"": ""boardgame"", ""exact"": true, ""fuzzy"": 100.0, ""owned"": null, ""rank"": null}]",[],IMG_4502.jpeg
|
||||
Diplomacy,483,Diplomacy,1959,boardgame,auto,,,version_ambiguous,"[{""bgg_id"": 483, ""name"": ""Diplomacy"", ""year"": 1959, ""type"": ""boardgame"", ""exact"": true, ""fuzzy"": 100.0, ""owned"": null, ""rank"": null}]","[{""version_id"": 48301, ""name"": ""Avalon Hill 1976 edition"", ""year"": 1976, ""publishers"": [""The Avalon Hill Game Co""], ""languages"": [""English""], ""score"": 3}, {""version_id"": 48302, ""name"": ""Avalon Hill 1999 edition"", ""year"": 1999, ""publishers"": [""The Avalon Hill Game Co""], ""languages"": [""English""], ""score"": 3}]",IMG_4502.jpeg
|
||||
Age of Renaissance,26,Age of Renaissance,1996,boardgame,auto,2601,Avalon Hill English edition,version_auto,"[{""bgg_id"": 26, ""name"": ""Age of Renaissance"", ""year"": 1996, ""type"": ""boardgame"", ""exact"": true, ""fuzzy"": 100.0, ""owned"": null, ""rank"": null}]","[{""version_id"": 2601, ""name"": ""Avalon Hill English edition"", ""year"": 1996, ""publishers"": [""The Avalon Hill Game Co""], ""languages"": [""English""], ""score"": 3}]",IMG_4502.jpeg
|
||||
History of the World,224,History of the World,1991,boardgame,auto,22401,Avalon Hill English edition,version_auto,"[{""bgg_id"": 224, ""name"": ""History of the World"", ""year"": 1991, ""type"": ""boardgame"", ""exact"": true, ""fuzzy"": 100.0, ""owned"": null, ""rank"": null}]","[{""version_id"": 22401, ""name"": ""Avalon Hill English edition"", ""year"": 1993, ""publishers"": [""The Avalon Hill Game Co""], ""languages"": [""English""], ""score"": 3}]",IMG_4502.jpeg
|
||||
Dungeon!,1339,Dungeon!,1975,boardgame,auto,,,version_ambiguous,"[{""bgg_id"": 1339, ""name"": ""Dungeon!"", ""year"": 1975, ""type"": ""boardgame"", ""exact"": true, ""fuzzy"": 100.0, ""owned"": null, ""rank"": null}]","[{""version_id"": 133901, ""name"": ""TSR first edition"", ""year"": 1975, ""publishers"": [""TSR""], ""languages"": [""English""], ""score"": 3}, {""version_id"": 133902, ""name"": ""TSR second edition"", ""year"": 1980, ""publishers"": [""TSR""], ""languages"": [""English""], ""score"": 3}, {""version_id"": 133903, ""name"": ""TSR New Dungeon edition"", ""year"": 1989, ""publishers"": [""TSR""], ""languages"": [""English""], ""score"": 3}]",IMG_4502.jpeg
|
||||
|
@@ -0,0 +1,351 @@
|
||||
"""Stub BGG XML fixtures for the 27 titles extracted from the real shelf
|
||||
photos, aligned with the objectids in the real collection snapshots.
|
||||
|
||||
Like write_stub_fixtures.py these are hand-written approximations (BGG's
|
||||
API is locked until the registration is approved). They cover: the plain
|
||||
search per title, empty results for the long Avalon Hill/SPI box titles
|
||||
(what real search does with them), the truncated-head retry searches,
|
||||
tie-break stats (Cosmic Encounter, Wiz-War, Sorcerer), and version lists
|
||||
for every title with publisher/edition/year cues. Once BGG_API_TOKEN
|
||||
exists: delete the cache dirs and re-run resolve/record_fixtures to
|
||||
replace all of this with real recordings.
|
||||
|
||||
Usage: uv run python scripts/write_photo_fixtures.py
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from bggpipe.bgg_client import cache_key
|
||||
|
||||
TARGETS = (Path("tests/fixtures/bgg_cache"), Path("data/bgg_cache"))
|
||||
SEARCH_TYPES = "boardgame,boardgameexpansion"
|
||||
|
||||
BG, EXP = "boardgame", "boardgameexpansion"
|
||||
|
||||
# (bgg_id, name, year, type, name_type)
|
||||
SEARCHES: dict[str, list[tuple]] = {
|
||||
"ROYALS": [(165986, "Royals", 2014, BG, "primary")],
|
||||
"CAT CRIMES": [(235096, "Cat Crimes", 2017, BG, "primary")],
|
||||
"COSMIC ENCOUNTER": [
|
||||
(39, "Cosmic Encounter", 1977, BG, "primary"),
|
||||
(40529, "Cosmic Encounter", 2008, BG, "primary"),
|
||||
],
|
||||
"SHERIFF OF NOTTINGHAM": [
|
||||
(157969, "Sheriff of Nottingham", 2014, BG, "primary"),
|
||||
(289411, "Sheriff of Nottingham (2nd Edition)", 2020, BG, "primary"),
|
||||
],
|
||||
"5 MINUTE DUNGEON": [(207830, "5-Minute Dungeon", 2017, BG, "primary")],
|
||||
"Britannia": [(240, "Britannia", 1986, BG, "primary")],
|
||||
# BGG search finds nothing for the full transcribed box titles
|
||||
"CIVILIZATION Game of the Heroic Age - The Dawn of History 8000 BC to 250 BC": [],
|
||||
"CIVILIZATION Game of the Heroic Age": [],
|
||||
"CIVILIZATION": [
|
||||
(71, "Civilization", 1980, BG, "primary"),
|
||||
(170416, "Sid Meier's Civilization: The Board Game", 2002, BG, "primary"),
|
||||
(233247, "Civilization: A New Dawn", 2017, BG, "primary"),
|
||||
],
|
||||
"ADVANCED CIVILIZATION Game Expansion of the Heroic Age - "
|
||||
"Featuring New Civilization, Commodity, and Calamity Cards": [],
|
||||
"ADVANCED CIVILIZATION Game Expansion of the Heroic Age": [],
|
||||
"ADVANCED CIVILIZATION": [(177, "Advanced Civilization", 1991, EXP, "primary")],
|
||||
"DOCTOR WHO The Game of Time & Space": [
|
||||
(3090, "Doctor Who: The Game of Time & Space", 1980, BG, "primary"),
|
||||
(125675, "Doctor Who: The Card Game", 2012, BG, "primary"),
|
||||
],
|
||||
"SORCERER The Game of Magical Conflict": [],
|
||||
"SORCERER": [
|
||||
(3585, "Sorcerer", 1975, BG, "primary"),
|
||||
(244115, "Sorcerer", 2019, BG, "primary"),
|
||||
],
|
||||
"STARFORCE ALPHA CENTAURI Interstellar Conflict in the 25th Century": [],
|
||||
"STARFORCE ALPHA": [
|
||||
(
|
||||
2524,
|
||||
"StarForce 'Alpha Centauri': Interstellar Conflict in the 25th Century",
|
||||
1974,
|
||||
BG,
|
||||
"primary",
|
||||
),
|
||||
],
|
||||
"SKIP-BO": [(1078, "Skip-Bo", 1967, BG, "primary")],
|
||||
"a Gentle Rain": [(268163, "A Gentle Rain", 2019, BG, "primary")],
|
||||
"PATCH WORK": [(163412, "Patchwork", 2014, BG, "primary")],
|
||||
"SANTORINI": [
|
||||
(194655, "Santorini", 2016, BG, "primary"),
|
||||
(255563, "Santorini: New York", 2020, BG, "primary"),
|
||||
],
|
||||
"Utter Nonsense!": [(181254, "Utter Nonsense", 2015, BG, "primary")],
|
||||
"Cards Against Humanity": [(50381, "Cards Against Humanity", 2009, BG, "primary")],
|
||||
"Joking Hazard": [(193621, "Joking Hazard", 2016, BG, "primary")],
|
||||
"EXPLODING KITTENS": [
|
||||
(172225, "Exploding Kittens", 2015, BG, "primary"),
|
||||
(172242, "Exploding Kittens: NSFW Edition", 2015, BG, "primary"),
|
||||
],
|
||||
"Herbaceous": [(195314, "Herbaceous", 2017, BG, "primary")],
|
||||
"Wiz-War": [
|
||||
(1218, "Wiz-War", 1983, BG, "primary"),
|
||||
(104710, "Wiz-War", 2012, BG, "alternate"), # primary: Wiz-War (Eighth Edition)
|
||||
],
|
||||
"SCRAWL": [(218866, "Scrawl", 2017, BG, "primary")],
|
||||
"FLAT TOP": [(2529, "Flat Top", 1977, BG, "primary")],
|
||||
"Diplomacy": [(483, "Diplomacy", 1959, BG, "primary")],
|
||||
"Age of Renaissance": [(26, "Age of Renaissance", 1996, BG, "primary")],
|
||||
"History of the World": [(224, "History of the World", 1991, BG, "primary")],
|
||||
"Dungeon!": [(1339, "Dungeon!", 1975, BG, "primary")],
|
||||
}
|
||||
|
||||
# ids-param -> [(bgg_id, name, year, type, owned, rank, [publishers])]
|
||||
THING_STATS: dict[str, list[tuple]] = {
|
||||
"39,40529": [
|
||||
(39, "Cosmic Encounter", 1977, BG, 7000, 800, ["Eon"]),
|
||||
(40529, "Cosmic Encounter", 2008, BG, 75000, 150, ["Fantasy Flight Games"]),
|
||||
],
|
||||
"1218,104710": [
|
||||
(1218, "Wiz-War", 1983, BG, 4000, 2500, ["Chessex"]),
|
||||
(
|
||||
104710,
|
||||
"Wiz-War (Eighth Edition)",
|
||||
2012,
|
||||
BG,
|
||||
8000,
|
||||
1200,
|
||||
["Fantasy Flight Games"],
|
||||
),
|
||||
],
|
||||
"3585,244115": [
|
||||
(
|
||||
3585,
|
||||
"Sorcerer",
|
||||
1975,
|
||||
BG,
|
||||
900,
|
||||
5000,
|
||||
["Simulations Publications, Inc. (SPI)"],
|
||||
),
|
||||
(244115, "Sorcerer", 2019, BG, 6000, 1500, ["White Wizard Games"]),
|
||||
],
|
||||
}
|
||||
|
||||
# bgg_id -> [(version_id, name, year, [publishers], [languages])]
|
||||
VERSIONS: dict[int, list[tuple]] = {
|
||||
235096: [(360982, "English edition", 2017, ["ThinkFun"], ["English"])],
|
||||
240: [
|
||||
(
|
||||
25668,
|
||||
"Avalon Hill English edition",
|
||||
1986,
|
||||
["The Avalon Hill Game Co"],
|
||||
["English"],
|
||||
),
|
||||
(90000, "Fantasy Flight edition", 2006, ["Fantasy Flight Games"], ["English"]),
|
||||
(
|
||||
90001,
|
||||
"Welt der Spiele German edition",
|
||||
1986,
|
||||
["Welt der Spiele"],
|
||||
["German"],
|
||||
),
|
||||
],
|
||||
71: [
|
||||
(
|
||||
71001,
|
||||
"Avalon Hill English edition",
|
||||
1981,
|
||||
["The Avalon Hill Game Co"],
|
||||
["English"],
|
||||
),
|
||||
(
|
||||
71002,
|
||||
"Hartland Trefoil first edition",
|
||||
1980,
|
||||
["Hartland Trefoil Ltd."],
|
||||
["English"],
|
||||
),
|
||||
(71003, "Gibsons Games edition", 1988, ["Gibsons Games"], ["English"]),
|
||||
],
|
||||
177: [
|
||||
(
|
||||
177001,
|
||||
"Avalon Hill English edition",
|
||||
1991,
|
||||
["The Avalon Hill Game Co"],
|
||||
["English"],
|
||||
)
|
||||
],
|
||||
3090: [
|
||||
(
|
||||
309001,
|
||||
"Games Workshop English edition",
|
||||
1980,
|
||||
["Games Workshop Ltd."],
|
||||
["English"],
|
||||
),
|
||||
],
|
||||
3585: [
|
||||
(
|
||||
358501,
|
||||
"SPI Designer's Edition",
|
||||
1975,
|
||||
["Simulations Publications, Inc. (SPI)"],
|
||||
["English"],
|
||||
),
|
||||
(
|
||||
358502,
|
||||
"SPI folio edition",
|
||||
1975,
|
||||
["Simulations Publications, Inc. (SPI)"],
|
||||
["English"],
|
||||
),
|
||||
],
|
||||
2524: [
|
||||
(
|
||||
252401,
|
||||
"SPI Designer's Edition",
|
||||
1974,
|
||||
["Simulations Publications, Inc. (SPI)"],
|
||||
["English"],
|
||||
),
|
||||
(
|
||||
252402,
|
||||
"SPI folio edition",
|
||||
1974,
|
||||
["Simulations Publications, Inc. (SPI)"],
|
||||
["English"],
|
||||
),
|
||||
],
|
||||
268163: [
|
||||
(268164, "Bloom Edition", 2021, ["Mondo Games"], ["English"]),
|
||||
(268165, "First edition", 2019, ["Mondo Games"], ["English"]),
|
||||
],
|
||||
193621: [(19362101, "First edition", 2016, ["Cyanide & Happiness"], ["English"])],
|
||||
2529: [
|
||||
(252901, "Avalon Hill edition", 1981, ["The Avalon Hill Game Co"], ["English"]),
|
||||
(252902, "Battleline first edition", 1977, ["Battleline"], ["English"]),
|
||||
],
|
||||
483: [
|
||||
(
|
||||
48301,
|
||||
"Avalon Hill 1976 edition",
|
||||
1976,
|
||||
["The Avalon Hill Game Co"],
|
||||
["English"],
|
||||
),
|
||||
(
|
||||
48302,
|
||||
"Avalon Hill 1999 edition",
|
||||
1999,
|
||||
["The Avalon Hill Game Co"],
|
||||
["English"],
|
||||
),
|
||||
(48303, "Gibsons Games edition", 1963, ["Gibsons Games"], ["English"]),
|
||||
],
|
||||
26: [
|
||||
(
|
||||
2601,
|
||||
"Avalon Hill English edition",
|
||||
1996,
|
||||
["The Avalon Hill Game Co"],
|
||||
["English"],
|
||||
)
|
||||
],
|
||||
224: [
|
||||
(
|
||||
22401,
|
||||
"Avalon Hill English edition",
|
||||
1993,
|
||||
["The Avalon Hill Game Co"],
|
||||
["English"],
|
||||
),
|
||||
(
|
||||
22402,
|
||||
"Ragnar Brothers first edition",
|
||||
1991,
|
||||
["Ragnar Brothers"],
|
||||
["English"],
|
||||
),
|
||||
],
|
||||
1339: [
|
||||
(133901, "TSR first edition", 1975, ["TSR"], ["English"]),
|
||||
(133902, "TSR second edition", 1980, ["TSR"], ["English"]),
|
||||
(133903, "TSR New Dungeon edition", 1989, ["TSR"], ["English"]),
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
def search_xml(results: list[tuple]) -> str:
|
||||
items = "".join(
|
||||
f'<item type="{type_}" id="{bgg_id}">'
|
||||
f'<name type="{name_type}" value="{_esc(name)}"/>'
|
||||
f'<yearpublished value="{year}"/></item>'
|
||||
for bgg_id, name, year, type_, name_type in results
|
||||
)
|
||||
return f'<items total="{len(results)}">{items}</items>'
|
||||
|
||||
|
||||
def stats_xml(things: list[tuple]) -> str:
|
||||
items = ""
|
||||
for bgg_id, name, year, type_, owned, rank, publishers in things:
|
||||
links = "".join(
|
||||
f'<link type="boardgamepublisher" id="1" value="{_esc(p)}"/>'
|
||||
for p in publishers
|
||||
)
|
||||
items += (
|
||||
f'<item type="{type_}" id="{bgg_id}">'
|
||||
f'<name type="primary" value="{_esc(name)}"/>'
|
||||
f'<yearpublished value="{year}"/>{links}'
|
||||
f"<statistics><ratings>"
|
||||
f'<owned value="{owned}"/>'
|
||||
f'<ranks><rank type="subtype" id="1" name="boardgame" '
|
||||
f'value="{rank}"/></ranks>'
|
||||
f"</ratings></statistics></item>"
|
||||
)
|
||||
return f"<items>{items}</items>"
|
||||
|
||||
|
||||
def versions_xml(bgg_id: int, versions: list[tuple]) -> str:
|
||||
version_items = ""
|
||||
for vid, name, year, publishers, languages in versions:
|
||||
links = "".join(
|
||||
f'<link type="boardgamepublisher" id="1" value="{_esc(p)}"/>'
|
||||
for p in publishers
|
||||
) + "".join(
|
||||
f'<link type="language" id="1" value="{_esc(lang)}"/>' for lang in languages
|
||||
)
|
||||
version_items += (
|
||||
f'<item type="boardgameversion" id="{vid}">'
|
||||
f'<name type="primary" value="{_esc(name)}"/>'
|
||||
f'<yearpublished value="{year}"/>{links}</item>'
|
||||
)
|
||||
return (
|
||||
f'<items><item type="boardgame" id="{bgg_id}">'
|
||||
f'<name type="primary" value="game"/>'
|
||||
f"<versions>{version_items}</versions></item></items>"
|
||||
)
|
||||
|
||||
|
||||
def _esc(text: str) -> str:
|
||||
return text.replace("&", "&").replace("<", "<").replace('"', """)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
files: dict[str, str] = {}
|
||||
for query, results in SEARCHES.items():
|
||||
key = cache_key("search", {"query": query, "type": SEARCH_TYPES})
|
||||
files[key] = search_xml(results)
|
||||
for ids, things in THING_STATS.items():
|
||||
files[cache_key("thing", {"id": ids, "stats": "1"})] = stats_xml(things)
|
||||
for bgg_id, versions in VERSIONS.items():
|
||||
key = cache_key("thing", {"id": str(bgg_id), "versions": "1"})
|
||||
files[key] = versions_xml(bgg_id, versions)
|
||||
|
||||
for target in TARGETS:
|
||||
target.mkdir(parents=True, exist_ok=True)
|
||||
for name, xml in files.items():
|
||||
(target / name).write_text(xml)
|
||||
print(f"Wrote {len(files)} fixture file(s) to {' and '.join(map(str, TARGETS))}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -59,12 +59,11 @@ class TitleEntry:
|
||||
|
||||
@property
|
||||
def has_version_cues(self) -> bool:
|
||||
return bool(
|
||||
self.publisher_hint
|
||||
or self.edition_hint
|
||||
or self.year_hint
|
||||
or self.language_hint
|
||||
)
|
||||
"""Cues strong enough to justify a versions fetch. Language alone
|
||||
can never reach the plausibility threshold (it scores 1 of the
|
||||
required 2), so fetching on it would waste a rate-limited request —
|
||||
it still participates in scoring when other cues exist."""
|
||||
return bool(self.publisher_hint or self.edition_hint or self.year_hint)
|
||||
|
||||
|
||||
@dataclass
|
||||
|
||||
+1
@@ -0,0 +1 @@
|
||||
<items total="1"><item type="boardgame" id="207830"><name type="primary" value="5-Minute Dungeon"/><yearpublished value="2017"/></item></items>
|
||||
+1
@@ -0,0 +1 @@
|
||||
<items total="0"></items>
|
||||
+1
@@ -0,0 +1 @@
|
||||
<items total="0"></items>
|
||||
+1
@@ -0,0 +1 @@
|
||||
<items total="1"><item type="boardgameexpansion" id="177"><name type="primary" value="Advanced Civilization"/><yearpublished value="1991"/></item></items>
|
||||
+1
@@ -0,0 +1 @@
|
||||
<items total="1"><item type="boardgame" id="26"><name type="primary" value="Age of Renaissance"/><yearpublished value="1996"/></item></items>
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
<items total="1"><item type="boardgame" id="240"><name type="primary" value="Britannia"/><yearpublished value="1986"/></item></items>
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
<items total="1"><item type="boardgame" id="235096"><name type="primary" value="Cat Crimes"/><yearpublished value="2017"/></item></items>
|
||||
+1
@@ -0,0 +1 @@
|
||||
<items total="0"></items>
|
||||
+1
@@ -0,0 +1 @@
|
||||
<items total="0"></items>
|
||||
+1
@@ -0,0 +1 @@
|
||||
<items total="3"><item type="boardgame" id="71"><name type="primary" value="Civilization"/><yearpublished value="1980"/></item><item type="boardgame" id="170416"><name type="primary" value="Sid Meier's Civilization: The Board Game"/><yearpublished value="2002"/></item><item type="boardgame" id="233247"><name type="primary" value="Civilization: A New Dawn"/><yearpublished value="2017"/></item></items>
|
||||
+1
@@ -0,0 +1 @@
|
||||
<items total="2"><item type="boardgame" id="39"><name type="primary" value="Cosmic Encounter"/><yearpublished value="1977"/></item><item type="boardgame" id="40529"><name type="primary" value="Cosmic Encounter"/><yearpublished value="2008"/></item></items>
|
||||
+1
@@ -0,0 +1 @@
|
||||
<items total="1"><item type="boardgame" id="50381"><name type="primary" value="Cards Against Humanity"/><yearpublished value="2009"/></item></items>
|
||||
+1
@@ -0,0 +1 @@
|
||||
<items total="2"><item type="boardgame" id="3090"><name type="primary" value="Doctor Who: The Game of Time & Space"/><yearpublished value="1980"/></item><item type="boardgame" id="125675"><name type="primary" value="Doctor Who: The Card Game"/><yearpublished value="2012"/></item></items>
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
<items total="1"><item type="boardgame" id="483"><name type="primary" value="Diplomacy"/><yearpublished value="1959"/></item></items>
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
<items total="1"><item type="boardgame" id="1339"><name type="primary" value="Dungeon!"/><yearpublished value="1975"/></item></items>
|
||||
+1
@@ -0,0 +1 @@
|
||||
<items total="2"><item type="boardgame" id="172225"><name type="primary" value="Exploding Kittens"/><yearpublished value="2015"/></item><item type="boardgame" id="172242"><name type="primary" value="Exploding Kittens: NSFW Edition"/><yearpublished value="2015"/></item></items>
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
<items total="1"><item type="boardgame" id="2529"><name type="primary" value="Flat Top"/><yearpublished value="1977"/></item></items>
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
<items total="1"><item type="boardgame" id="195314"><name type="primary" value="Herbaceous"/><yearpublished value="2017"/></item></items>
|
||||
+1
@@ -0,0 +1 @@
|
||||
<items total="1"><item type="boardgame" id="224"><name type="primary" value="History of the World"/><yearpublished value="1991"/></item></items>
|
||||
+1
@@ -0,0 +1 @@
|
||||
<items total="1"><item type="boardgame" id="193621"><name type="primary" value="Joking Hazard"/><yearpublished value="2016"/></item></items>
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
<items total="1"><item type="boardgame" id="163412"><name type="primary" value="Patchwork"/><yearpublished value="2014"/></item></items>
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
<items total="1"><item type="boardgame" id="165986"><name type="primary" value="Royals"/><yearpublished value="2014"/></item></items>
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
<items total="2"><item type="boardgame" id="194655"><name type="primary" value="Santorini"/><yearpublished value="2016"/></item><item type="boardgame" id="255563"><name type="primary" value="Santorini: New York"/><yearpublished value="2020"/></item></items>
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
<items total="1"><item type="boardgame" id="218866"><name type="primary" value="Scrawl"/><yearpublished value="2017"/></item></items>
|
||||
+1
@@ -0,0 +1 @@
|
||||
<items total="2"><item type="boardgame" id="157969"><name type="primary" value="Sheriff of Nottingham"/><yearpublished value="2014"/></item><item type="boardgame" id="289411"><name type="primary" value="Sheriff of Nottingham (2nd Edition)"/><yearpublished value="2020"/></item></items>
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
<items total="1"><item type="boardgame" id="1078"><name type="primary" value="Skip-Bo"/><yearpublished value="1967"/></item></items>
|
||||
+1
@@ -0,0 +1 @@
|
||||
<items total="0"></items>
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
<items total="2"><item type="boardgame" id="3585"><name type="primary" value="Sorcerer"/><yearpublished value="1975"/></item><item type="boardgame" id="244115"><name type="primary" value="Sorcerer"/><yearpublished value="2019"/></item></items>
|
||||
+1
@@ -0,0 +1 @@
|
||||
<items total="0"></items>
|
||||
+1
@@ -0,0 +1 @@
|
||||
<items total="1"><item type="boardgame" id="2524"><name type="primary" value="StarForce 'Alpha Centauri': Interstellar Conflict in the 25th Century"/><yearpublished value="1974"/></item></items>
|
||||
+1
@@ -0,0 +1 @@
|
||||
<items total="1"><item type="boardgame" id="181254"><name type="primary" value="Utter Nonsense"/><yearpublished value="2015"/></item></items>
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
<items total="2"><item type="boardgame" id="1218"><name type="primary" value="Wiz-War"/><yearpublished value="1983"/></item><item type="boardgame" id="104710"><name type="alternate" value="Wiz-War"/><yearpublished value="2012"/></item></items>
|
||||
+1
@@ -0,0 +1 @@
|
||||
<items total="1"><item type="boardgame" id="268163"><name type="primary" value="A Gentle Rain"/><yearpublished value="2019"/></item></items>
|
||||
@@ -0,0 +1 @@
|
||||
<items><item type="boardgame" id="1218"><name type="primary" value="Wiz-War"/><yearpublished value="1983"/><link type="boardgamepublisher" id="1" value="Chessex"/><statistics><ratings><owned value="4000"/><ranks><rank type="subtype" id="1" name="boardgame" value="2500"/></ranks></ratings></statistics></item><item type="boardgame" id="104710"><name type="primary" value="Wiz-War (Eighth Edition)"/><yearpublished value="2012"/><link type="boardgamepublisher" id="1" value="Fantasy Flight Games"/><statistics><ratings><owned value="8000"/><ranks><rank type="subtype" id="1" name="boardgame" value="1200"/></ranks></ratings></statistics></item></items>
|
||||
@@ -0,0 +1 @@
|
||||
<items><item type="boardgame" id="1339"><name type="primary" value="game"/><versions><item type="boardgameversion" id="133901"><name type="primary" value="TSR first edition"/><yearpublished value="1975"/><link type="boardgamepublisher" id="1" value="TSR"/><link type="language" id="1" value="English"/></item><item type="boardgameversion" id="133902"><name type="primary" value="TSR second edition"/><yearpublished value="1980"/><link type="boardgamepublisher" id="1" value="TSR"/><link type="language" id="1" value="English"/></item><item type="boardgameversion" id="133903"><name type="primary" value="TSR New Dungeon edition"/><yearpublished value="1989"/><link type="boardgamepublisher" id="1" value="TSR"/><link type="language" id="1" value="English"/></item></versions></item></items>
|
||||
@@ -0,0 +1 @@
|
||||
<items><item type="boardgame" id="177"><name type="primary" value="game"/><versions><item type="boardgameversion" id="177001"><name type="primary" value="Avalon Hill English edition"/><yearpublished value="1991"/><link type="boardgamepublisher" id="1" value="The Avalon Hill Game Co"/><link type="language" id="1" value="English"/></item></versions></item></items>
|
||||
@@ -0,0 +1 @@
|
||||
<items><item type="boardgame" id="193621"><name type="primary" value="game"/><versions><item type="boardgameversion" id="19362101"><name type="primary" value="First edition"/><yearpublished value="2016"/><link type="boardgamepublisher" id="1" value="Cyanide & Happiness"/><link type="language" id="1" value="English"/></item></versions></item></items>
|
||||
@@ -0,0 +1 @@
|
||||
<items><item type="boardgame" id="224"><name type="primary" value="game"/><versions><item type="boardgameversion" id="22401"><name type="primary" value="Avalon Hill English edition"/><yearpublished value="1993"/><link type="boardgamepublisher" id="1" value="The Avalon Hill Game Co"/><link type="language" id="1" value="English"/></item><item type="boardgameversion" id="22402"><name type="primary" value="Ragnar Brothers first edition"/><yearpublished value="1991"/><link type="boardgamepublisher" id="1" value="Ragnar Brothers"/><link type="language" id="1" value="English"/></item></versions></item></items>
|
||||
@@ -0,0 +1 @@
|
||||
<items><item type="boardgame" id="235096"><name type="primary" value="game"/><versions><item type="boardgameversion" id="360982"><name type="primary" value="English edition"/><yearpublished value="2017"/><link type="boardgamepublisher" id="1" value="ThinkFun"/><link type="language" id="1" value="English"/></item></versions></item></items>
|
||||
@@ -0,0 +1 @@
|
||||
<items><item type="boardgame" id="240"><name type="primary" value="game"/><versions><item type="boardgameversion" id="25668"><name type="primary" value="Avalon Hill English edition"/><yearpublished value="1986"/><link type="boardgamepublisher" id="1" value="The Avalon Hill Game Co"/><link type="language" id="1" value="English"/></item><item type="boardgameversion" id="90000"><name type="primary" value="Fantasy Flight edition"/><yearpublished value="2006"/><link type="boardgamepublisher" id="1" value="Fantasy Flight Games"/><link type="language" id="1" value="English"/></item><item type="boardgameversion" id="90001"><name type="primary" value="Welt der Spiele German edition"/><yearpublished value="1986"/><link type="boardgamepublisher" id="1" value="Welt der Spiele"/><link type="language" id="1" value="German"/></item></versions></item></items>
|
||||
@@ -0,0 +1 @@
|
||||
<items><item type="boardgame" id="2524"><name type="primary" value="game"/><versions><item type="boardgameversion" id="252401"><name type="primary" value="SPI Designer's Edition"/><yearpublished value="1974"/><link type="boardgamepublisher" id="1" value="Simulations Publications, Inc. (SPI)"/><link type="language" id="1" value="English"/></item><item type="boardgameversion" id="252402"><name type="primary" value="SPI folio edition"/><yearpublished value="1974"/><link type="boardgamepublisher" id="1" value="Simulations Publications, Inc. (SPI)"/><link type="language" id="1" value="English"/></item></versions></item></items>
|
||||
@@ -0,0 +1 @@
|
||||
<items><item type="boardgame" id="2529"><name type="primary" value="game"/><versions><item type="boardgameversion" id="252901"><name type="primary" value="Avalon Hill edition"/><yearpublished value="1981"/><link type="boardgamepublisher" id="1" value="The Avalon Hill Game Co"/><link type="language" id="1" value="English"/></item><item type="boardgameversion" id="252902"><name type="primary" value="Battleline first edition"/><yearpublished value="1977"/><link type="boardgamepublisher" id="1" value="Battleline"/><link type="language" id="1" value="English"/></item></versions></item></items>
|
||||
@@ -0,0 +1 @@
|
||||
<items><item type="boardgame" id="26"><name type="primary" value="game"/><versions><item type="boardgameversion" id="2601"><name type="primary" value="Avalon Hill English edition"/><yearpublished value="1996"/><link type="boardgamepublisher" id="1" value="The Avalon Hill Game Co"/><link type="language" id="1" value="English"/></item></versions></item></items>
|
||||
@@ -0,0 +1 @@
|
||||
<items><item type="boardgame" id="268163"><name type="primary" value="game"/><versions><item type="boardgameversion" id="268164"><name type="primary" value="Bloom Edition"/><yearpublished value="2021"/><link type="boardgamepublisher" id="1" value="Mondo Games"/><link type="language" id="1" value="English"/></item><item type="boardgameversion" id="268165"><name type="primary" value="First edition"/><yearpublished value="2019"/><link type="boardgamepublisher" id="1" value="Mondo Games"/><link type="language" id="1" value="English"/></item></versions></item></items>
|
||||
@@ -0,0 +1 @@
|
||||
<items><item type="boardgame" id="3090"><name type="primary" value="game"/><versions><item type="boardgameversion" id="309001"><name type="primary" value="Games Workshop English edition"/><yearpublished value="1980"/><link type="boardgamepublisher" id="1" value="Games Workshop Ltd."/><link type="language" id="1" value="English"/></item></versions></item></items>
|
||||
@@ -0,0 +1 @@
|
||||
<items><item type="boardgame" id="3585"><name type="primary" value="Sorcerer"/><yearpublished value="1975"/><link type="boardgamepublisher" id="1" value="Simulations Publications, Inc. (SPI)"/><statistics><ratings><owned value="900"/><ranks><rank type="subtype" id="1" name="boardgame" value="5000"/></ranks></ratings></statistics></item><item type="boardgame" id="244115"><name type="primary" value="Sorcerer"/><yearpublished value="2019"/><link type="boardgamepublisher" id="1" value="White Wizard Games"/><statistics><ratings><owned value="6000"/><ranks><rank type="subtype" id="1" name="boardgame" value="1500"/></ranks></ratings></statistics></item></items>
|
||||
@@ -0,0 +1 @@
|
||||
<items><item type="boardgame" id="3585"><name type="primary" value="game"/><versions><item type="boardgameversion" id="358501"><name type="primary" value="SPI Designer's Edition"/><yearpublished value="1975"/><link type="boardgamepublisher" id="1" value="Simulations Publications, Inc. (SPI)"/><link type="language" id="1" value="English"/></item><item type="boardgameversion" id="358502"><name type="primary" value="SPI folio edition"/><yearpublished value="1975"/><link type="boardgamepublisher" id="1" value="Simulations Publications, Inc. (SPI)"/><link type="language" id="1" value="English"/></item></versions></item></items>
|
||||
@@ -0,0 +1 @@
|
||||
<items><item type="boardgame" id="39"><name type="primary" value="Cosmic Encounter"/><yearpublished value="1977"/><link type="boardgamepublisher" id="1" value="Eon"/><statistics><ratings><owned value="7000"/><ranks><rank type="subtype" id="1" name="boardgame" value="800"/></ranks></ratings></statistics></item><item type="boardgame" id="40529"><name type="primary" value="Cosmic Encounter"/><yearpublished value="2008"/><link type="boardgamepublisher" id="1" value="Fantasy Flight Games"/><statistics><ratings><owned value="75000"/><ranks><rank type="subtype" id="1" name="boardgame" value="150"/></ranks></ratings></statistics></item></items>
|
||||
@@ -0,0 +1 @@
|
||||
<items><item type="boardgame" id="483"><name type="primary" value="game"/><versions><item type="boardgameversion" id="48301"><name type="primary" value="Avalon Hill 1976 edition"/><yearpublished value="1976"/><link type="boardgamepublisher" id="1" value="The Avalon Hill Game Co"/><link type="language" id="1" value="English"/></item><item type="boardgameversion" id="48302"><name type="primary" value="Avalon Hill 1999 edition"/><yearpublished value="1999"/><link type="boardgamepublisher" id="1" value="The Avalon Hill Game Co"/><link type="language" id="1" value="English"/></item><item type="boardgameversion" id="48303"><name type="primary" value="Gibsons Games edition"/><yearpublished value="1963"/><link type="boardgamepublisher" id="1" value="Gibsons Games"/><link type="language" id="1" value="English"/></item></versions></item></items>
|
||||
@@ -0,0 +1 @@
|
||||
<items><item type="boardgame" id="71"><name type="primary" value="game"/><versions><item type="boardgameversion" id="71001"><name type="primary" value="Avalon Hill English edition"/><yearpublished value="1981"/><link type="boardgamepublisher" id="1" value="The Avalon Hill Game Co"/><link type="language" id="1" value="English"/></item><item type="boardgameversion" id="71002"><name type="primary" value="Hartland Trefoil first edition"/><yearpublished value="1980"/><link type="boardgamepublisher" id="1" value="Hartland Trefoil Ltd."/><link type="language" id="1" value="English"/></item><item type="boardgameversion" id="71003"><name type="primary" value="Gibsons Games edition"/><yearpublished value="1988"/><link type="boardgamepublisher" id="1" value="Gibsons Games"/><link type="language" id="1" value="English"/></item></versions></item></items>
|
||||
Reference in New Issue
Block a user