mirror of
https://github.com/Abdess/retrobios.git
synced 2026-06-28 21:32:49 +00:00
v2: automated BIOS platform with full pipeline
Reorganized 6 branches into bios/Manufacturer/Console/. Scrapers for RetroArch, Batocera, Recalbox, and libretro core-info. Platform-aware verification replicating native logic per platform. Pack generation with dedup, alias resolution, variant support. CI/CD: weekly auto-scrape, auto-release, PR validation. Large files (>50MB) stored as GitHub Release assets, auto-fetched at build time.
This commit is contained in:
parent
5f96368f6d
commit
13c561888d
7038 changed files with 3243612 additions and 29617 deletions
46
scripts/scraper/__init__.py
Normal file
46
scripts/scraper/__init__.py
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
"""Scraper plugin discovery module.
|
||||
|
||||
Auto-detects *_scraper.py files and exposes their scrapers.
|
||||
Each scraper module must define:
|
||||
PLATFORM_NAME: str
|
||||
Scraper: class inheriting BaseScraper
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import importlib
|
||||
import pkgutil
|
||||
from pathlib import Path
|
||||
|
||||
from .base_scraper import BaseScraper
|
||||
|
||||
_scrapers: dict[str, type] = {}
|
||||
|
||||
|
||||
def discover_scrapers() -> dict[str, type]:
|
||||
"""Auto-discover all *_scraper.py modules and return {platform_name: ScraperClass}."""
|
||||
if _scrapers:
|
||||
return _scrapers
|
||||
|
||||
package_dir = Path(__file__).parent
|
||||
|
||||
for finder, name, ispkg in pkgutil.iter_modules([str(package_dir)]):
|
||||
if not name.endswith("_scraper"):
|
||||
continue
|
||||
|
||||
module = importlib.import_module(f".{name}", package=__package__)
|
||||
|
||||
platform_name = getattr(module, "PLATFORM_NAME", None)
|
||||
scraper_class = getattr(module, "Scraper", None)
|
||||
|
||||
if platform_name and scraper_class and issubclass(scraper_class, BaseScraper):
|
||||
_scrapers[platform_name] = scraper_class
|
||||
|
||||
return _scrapers
|
||||
|
||||
|
||||
def get_scraper(platform_name: str) -> BaseScraper | None:
|
||||
"""Get an instantiated scraper for a platform."""
|
||||
scrapers = discover_scrapers()
|
||||
cls = scrapers.get(platform_name)
|
||||
return cls() if cls else None
|
||||
Loading…
Add table
Add a link
Reference in a new issue