Fixed faction image fetching
This commit is contained in:
@@ -25,6 +25,9 @@ The pipeline is deliberately split into three inspectable stages.
|
||||
tweaked by hand and re-rasterised without re-running the earlier stages.
|
||||
- **Print-ready output** – cards are rendered at the classic 63x88 mm poker
|
||||
format at 300 DPI (configurable) and imposed 3x3 on A4 with optional crop marks.
|
||||
- **Wiki-derived factions** – `genshin-tcg factions` resolves each character's
|
||||
nation (and each enemy's faction) from the community wiki and caches the pages
|
||||
locally, so cards can show a region tag.
|
||||
- **Typed and tested** – strict `mypy`, `ruff`, and a `pytest` suite.
|
||||
|
||||
## Requirements
|
||||
@@ -55,6 +58,7 @@ Or run the stages individually:
|
||||
|
||||
```powershell
|
||||
genshin-tcg fetch # download data + assets, write build/catalog.json
|
||||
genshin-tcg factions # resolve factions from the wiki -> assets/overrides + emblems
|
||||
genshin-tcg render # build/html/<id>.html and build/png/<id>.png
|
||||
genshin-tcg impose # build/cards-fr.pdf
|
||||
```
|
||||
@@ -66,6 +70,8 @@ genshin-tcg --language en build # English dataset
|
||||
genshin-tcg --dpi 600 build # 600 DPI output
|
||||
genshin-tcg render --only ganyu --only diluc # a subset of cards
|
||||
genshin-tcg render --no-screenshot # only regenerate the HTML
|
||||
genshin-tcg factions --dry-run # preview the faction mapping
|
||||
genshin-tcg factions --no-icons # mapping only, no emblems
|
||||
genshin-tcg list # browse the local catalogue
|
||||
```
|
||||
|
||||
@@ -105,14 +111,35 @@ GTCG_RENDER__KEEP_HTML=true
|
||||
|
||||
### Factions / nations
|
||||
|
||||
The upstream dataset does not ship faction artwork, so nation tags are supplied
|
||||
locally. Drop icons into `assets/tcg/icons/factions/<faction>.png` and map cards
|
||||
to them in `assets/overrides/factions.json`:
|
||||
The upstream dataset does not ship faction artwork or metadata. Run
|
||||
|
||||
```powershell
|
||||
genshin-tcg factions
|
||||
```
|
||||
|
||||
to derive the mapping from the community wiki (via its MediaWiki API) and write
|
||||
`assets/overrides/factions.json`. Playable characters inherit the region of
|
||||
[`Character/List`](https://genshin-impact.fandom.com/wiki/Character/List) (the
|
||||
table generated by `Template:Characters by Category Table`); bosses and enemies
|
||||
inherit their *family* from
|
||||
[`Enemy/List`](https://genshin-impact.fandom.com/wiki/Enemy/List) (Fatui →
|
||||
`fatui`, Hilichurls → `hilichurl`, everything else → `monster`). Pages are cached
|
||||
under `assets/source/wiki/` for reproducibility; use `--force` to refresh them.
|
||||
|
||||
The file is plain JSON keyed by card id and is *safe to edit by hand*: re-running
|
||||
the command keeps your entries and only fills in the gaps. Use `--overwrite` to
|
||||
discard hand-made values and regenerate from scratch, or `--dry-run` to preview.
|
||||
|
||||
```json
|
||||
{ "ganyu": "liyue", "diluc": "mondstadt", "rhodeia_of_loch": "fatui" }
|
||||
{ "ganyu": "liyue", "diluc": "mondstadt", "rhodeia_of_loch": "monster" }
|
||||
```
|
||||
|
||||
The command also downloads the **nation emblems** into
|
||||
`assets/tcg/icons/factions/<faction>.png`, so the tag renders as an image next
|
||||
to the element and weapon icons. Enemy factions (`fatui`, `hilichurl`,
|
||||
`monster`) have no wiki emblem and keep the localised label. Use `--no-icons` to
|
||||
skip the download, or drop in your own `<faction>.png` to override an emblem.
|
||||
|
||||
## Development
|
||||
|
||||
```powershell
|
||||
@@ -131,7 +158,7 @@ src/genshin_tcg/
|
||||
├── models.py # typed domain models (Pydantic)
|
||||
├── markup.py # description normalisation + sanitisation
|
||||
├── pipeline.py # fetch / render / impose orchestration
|
||||
├── data/ # remote source, catalogue, asset download
|
||||
├── data/ # remote source, catalogue, asset download, wiki factions
|
||||
├── rendering/ # Jinja environment, view models, converter, renderer
|
||||
│ └── templates/ # base/character/action templates + stylesheet
|
||||
└── pdf/ # ReportLab imposition
|
||||
|
||||
Reference in New Issue
Block a user