This repository has been archived on 2022-02-23. You can view files and clone it, but cannot push or open issues or pull requests.
lets/pp/rxoppai/b3.py

31 lines
794 B
Python

import json
import os
import subprocess
def runOppaiProcess(command):
process = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output = json.loads(process.stdout.decode("utf-8", errors="ignore"))
if "code" not in output or "errstr" not in output:
print("oof")
if output["code"] != 200:
print("oof")
if "pp" not in output or "stars" not in output:
print("oof")
pp = output["pp"]
stars = output["stars"]
return pp, stars
command = "./oppai {}".format("../../.data/beatmaps/55.osu")
command += " {acc:.2f}%".format(acc=99.6)
command += " +{mods}".format(mods="HDHR")
command += " {combo}x".format(combo=500)
command += " {misses}xm".format(misses=1)
command += " -ojson"
pp = 0.00
stars = 0.00
pp, stars = runOppaiProcess(command)
print(pp)