#!/usr/bin/env python3 """Tira os efeitos sonoros do projeto GB Studio do Pocket Aquarium. O repositorio do jogo (GPL-3.0) diz em assets/sounds/README.md que os sons "NOT included in the OSS GPL V3 license. All rights belong to their respective owners" (pacote "Sweet Sounds!" de Coffee Bat e GBFX2.sav), entao nao os publicamos: apaga assets/sounds e project/sounds e remove todo evento "Play Sound Effect" (EVENT_SOUND_PLAY_EFFECT) dos scripts. A musica (do proprio autor) fica. uso: strip-sound-effects.py """ import json import os import shutil import sys root = sys.argv[1] for d in ("assets/sounds", "project/sounds"): shutil.rmtree(os.path.join(root, d), ignore_errors=True) removed = 0 def clean(o): global removed if isinstance(o, list): kept = [] for x in o: if isinstance(x, dict) and x.get("command") == "EVENT_SOUND_PLAY_EFFECT": removed += 1 continue kept.append(clean(x)) return kept if isinstance(o, dict): return {k: clean(v) for k, v in o.items()} return o for base, _, files in sorted(os.walk(os.path.join(root, "project"))): for f in sorted(files): if not f.endswith(".gbsres"): continue p = os.path.join(base, f) with open(p, encoding="utf-8") as fh: raw = fh.read() data = json.loads(raw) new = clean(data) if new != data: with open(p, "w", encoding="utf-8", newline="\n") as fh: json.dump(new, fh, indent=2, ensure_ascii=False) print("eventos de som removidos:", removed)