Build household requests under Settings
This commit is contained in:
parent
7a878b2d81
commit
5b0703aec5
58 changed files with 1575 additions and 23 deletions
31
wolfskin-design/generate_request_marks.py
Executable file
31
wolfskin-design/generate_request_marks.py
Executable file
|
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Rasterize locked prototype rating marks at the Coming-in row's native pixel size."""
|
||||
from pathlib import Path
|
||||
import hashlib
|
||||
import json
|
||||
import cairosvg
|
||||
|
||||
ROOT = Path(__file__).resolve().parent
|
||||
SOURCE = ROOT / "request-marks"
|
||||
OUTPUT = ROOT / "src/main/res/drawable-nodpi"
|
||||
|
||||
|
||||
def main() -> None:
|
||||
"""Keep the original SVGs and record hashes alongside generated television-size PNGs."""
|
||||
OUTPUT.mkdir(parents=True, exist_ok=True)
|
||||
tokens = json.loads((ROOT / "tokens.json").read_text())
|
||||
supplement = json.loads((ROOT / "shell-tokens.json").read_text())
|
||||
height = int(tokens["type"]["label"]["px"])
|
||||
wordmark_ratio = supplement["requests"]["ratingsWordmarkRatio"]["$value"]
|
||||
manifest = []
|
||||
for source in sorted(SOURCE.glob("*.svg")):
|
||||
target = OUTPUT / f"coming_in_rating_{source.stem}.png"
|
||||
width = round(height * wordmark_ratio) if source.stem in ("imdb", "tmdb") else height
|
||||
cairosvg.svg2png(url=str(source), write_to=str(target), output_width=width, output_height=height)
|
||||
for path in (source, target):
|
||||
manifest.append(f"{hashlib.sha256(path.read_bytes()).hexdigest()} {path.relative_to(ROOT)}")
|
||||
(ROOT / "request-marks.sha256").write_text("\n".join(manifest) + "\n")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue