feat: improve RenPy conversion and support MIST runtime
This commit is contained in:
1 parent
f7f7f5b1b3
commit
f9eb5c1212
44 files changed
+2822
-174
No files matched your search
@@ -1,6 +1,7 @@
|
||||
"""Check/import a local collection. Rejected games never get queued.
|
||||
|
||||
python -m app.import_library /games --check
|
||||
python -m app.import_library /games/Some-Game --check --single
|
||||
python -m app.import_library /games --import --owner admin
|
||||
"""
|
||||
import argparse
|
||||
@@ -73,22 +74,26 @@ async def import_one(source: Path, report: dict, username: str | None) -> dict:
|
||||
return {"gameId": game_id, "versionId": version_id, "status": "ready" if ok else "failed"}
|
||||
|
||||
|
||||
async def main():
|
||||
async def main(argv=None):
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("root", type=Path)
|
||||
parser.add_argument("--single", action="store_true",
|
||||
help="Проверить/импортировать одну игру: папку или архив вместо коллекции")
|
||||
mode = parser.add_mutually_exclusive_group(required=True)
|
||||
mode.add_argument("--check", action="store_true", help="Только проверка; без изменения библиотеки")
|
||||
mode.add_argument("--import", dest="import_games", action="store_true", help="Импортировать совместимые игры")
|
||||
parser.add_argument("--owner")
|
||||
parser.add_argument("--output", type=Path, help="Записать полный JSON-отчёт")
|
||||
args = parser.parse_args()
|
||||
if not args.root.is_dir():
|
||||
args = parser.parse_args(argv)
|
||||
if args.single and not args.root.exists():
|
||||
parser.error("Игра не найдена: " + str(args.root))
|
||||
if not args.single and not args.root.is_dir():
|
||||
parser.error("root должен быть каталогом коллекции")
|
||||
results = []
|
||||
for source in entries(args.root):
|
||||
for source in ([args.root] if args.single else entries(args.root)):
|
||||
print(json.dumps({"game": source.name, "status": "checking"}, ensure_ascii=False), flush=True)
|
||||
report = await asyncio.to_thread(check, source)
|
||||
result = {"game": source.name, **report}
|
||||
result = {**report, "game": source.name}
|
||||
if args.import_games and report.get("compatible"):
|
||||
result.update(await import_one(source, report, args.owner))
|
||||
results.append(result)
|
||||
|
||||
Reference in new issue
Block a user