refs: pull the Commons categories for the Masonic Temple and El Capitan
A text search had stopped surfacing new material, so commons_fetch.py gained --category. Category:Hollywood Masonic Temple and Category:El Capitan Theater yielded 32 more frames locally, including 4-5k px frontal façades, a 2019 street-level shot of both buildings together, the 1922 postcard, and the first oblique evidence for the 6806-6822 retail run. 68 local images total, none committed. A clean sidewalk-level frame of the hero entry is still absent.
This commit is contained in:
1 parent
72de657202
commit
b8f5a062ac
2 files changed
+23
-3
No files matched your search
+1
-1
@@ -17,7 +17,7 @@ Repeatable import/export and processing helpers. Anything that was done twice by
|
|||||||
- `street_mesh.py` — road, kerbs, and sidewalks on the DEM, in the project frame; kerbs flush at the three crossings.
|
- `street_mesh.py` — road, kerbs, and sidewalks on the DEM, in the project frame; kerbs flush at the three crossings.
|
||||||
- `terrain_from_dem.py` — terrain grid from the committed DEM, with building footprints cut out.
|
- `terrain_from_dem.py` — terrain grid from the committed DEM, with building footprints cut out.
|
||||||
- `blosm_blockout.py` — headless Blosm import of the committed `.osm` extract into a `.blend`, with a per-building scale report. Exact invocation in `Art/blender/README.md`.
|
- `blosm_blockout.py` — headless Blosm import of the committed `.osm` extract into a `.blend`, with a per-building scale report. Exact invocation in `Art/blender/README.md`.
|
||||||
- `commons_fetch.py` — Wikimedia Commons reference fetcher. Search or exact `File:` titles, thumbnails, provenance `sidecar.json` per folder. Wikimedia throttles `upload.wikimedia.org` (HTTP 429), so keep batches to six or fewer files and pass `--delay 3`; a throttled file is skipped and recorded rather than aborting the run. Writes only into the gitignored `Art/reference/`; reference images are never committed.
|
- `commons_fetch.py` — Wikimedia Commons reference fetcher. Search, exact `File:` titles, or a whole Commons category (`--category`), thumbnails, provenance `sidecar.json` per folder. Wikimedia throttles `upload.wikimedia.org` (HTTP 429), so keep batches to six or fewer files and pass `--delay 3`; a throttled file is skipped and recorded rather than aborting the run. Writes only into the gitignored `Art/reference/`; reference images are never committed.
|
||||||
|
|
||||||
## Planned helpers
|
## Planned helpers
|
||||||
- Blender export preset runner (named presets, metric scale assertion)
|
- Blender export preset runner (named presets, metric scale assertion)
|
||||||
|
|||||||
+22
-2
@@ -86,6 +86,20 @@ def search_titles(query: str, limit: int) -> list[str]:
|
|||||||
return titles, order
|
return titles, order
|
||||||
|
|
||||||
|
|
||||||
|
def category_titles(category: str, limit: int) -> list[str]:
|
||||||
|
data = api_get(
|
||||||
|
{
|
||||||
|
"action": "query",
|
||||||
|
"list": "categorymembers",
|
||||||
|
"cmtitle": category,
|
||||||
|
"cmtype": "file",
|
||||||
|
"cmlimit": str(max(limit, 50)),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
members = data.get("query", {}).get("categorymembers", [])
|
||||||
|
return [m["title"] for m in members][:limit]
|
||||||
|
|
||||||
|
|
||||||
def image_info(titles: list[str], thumb_width: int) -> list[dict]:
|
def image_info(titles: list[str], thumb_width: int) -> list[dict]:
|
||||||
data = api_get(
|
data = api_get(
|
||||||
{
|
{
|
||||||
@@ -160,6 +174,7 @@ def download(url: str, path: str, retries: int = 3) -> str:
|
|||||||
def main() -> int:
|
def main() -> int:
|
||||||
ap = argparse.ArgumentParser()
|
ap = argparse.ArgumentParser()
|
||||||
ap.add_argument("--query", help="Commons search string")
|
ap.add_argument("--query", help="Commons search string")
|
||||||
|
ap.add_argument("--category", help='Commons category, e.g. "Category:Hollywood Masonic Temple"')
|
||||||
ap.add_argument("--file", action="append", default=[], help="exact File: title, repeatable")
|
ap.add_argument("--file", action="append", default=[], help="exact File: title, repeatable")
|
||||||
ap.add_argument("--slug", required=True, help="output folder name under the out dir")
|
ap.add_argument("--slug", required=True, help="output folder name under the out dir")
|
||||||
ap.add_argument("--out", default="Art/reference", help="base output directory")
|
ap.add_argument("--out", default="Art/reference", help="base output directory")
|
||||||
@@ -169,10 +184,14 @@ def main() -> int:
|
|||||||
ap.add_argument("--delay", type=float, default=2.0, help="seconds between downloads")
|
ap.add_argument("--delay", type=float, default=2.0, help="seconds between downloads")
|
||||||
args = ap.parse_args()
|
args = ap.parse_args()
|
||||||
|
|
||||||
if not args.query and not args.file:
|
if not args.query and not args.file and not args.category:
|
||||||
ap.error("need --query or --file")
|
ap.error("need --query, --category, or --file")
|
||||||
|
|
||||||
titles = list(args.file)
|
titles = list(args.file)
|
||||||
|
if args.category:
|
||||||
|
found = category_titles(args.category, args.limit * 4)
|
||||||
|
print(f"{len(found)} file(s) in {args.category}")
|
||||||
|
titles += [t for t in found if t not in titles]
|
||||||
if args.query:
|
if args.query:
|
||||||
found, _ = search_titles(args.query, args.limit * 3)
|
found, _ = search_titles(args.query, args.limit * 3)
|
||||||
titles += [t for t in found if t not in titles]
|
titles += [t for t in found if t not in titles]
|
||||||
@@ -222,6 +241,7 @@ def main() -> int:
|
|||||||
"source": "Wikimedia Commons API",
|
"source": "Wikimedia Commons API",
|
||||||
"api": API,
|
"api": API,
|
||||||
"query": args.query,
|
"query": args.query,
|
||||||
|
"category": args.category,
|
||||||
"requested_files": args.file,
|
"requested_files": args.file,
|
||||||
"slug": args.slug,
|
"slug": args.slug,
|
||||||
"thumb_width": args.width,
|
"thumb_width": args.width,
|
||||||
|
|||||||
Reference in new issue
Block a user