Skip to main content

A simple object-oriented python3 wrapper around the python bindings of oppai-ng

Project description

oppaipy

oppaipy is a simple object-oriented python3 wrapper around the python bindings of oppai-ng.

Usage

$ pip install oppaipy

There are 5 steps to using oppaipy:

  1. Initialise
  2. Set parameters
  3. Calculate
  4. Check results
  5. Release resources

Example

>>> import oppaipy
>>> calc = oppaipy.Calculator()
>>> calc.set_beatmap("/path/to/beatmap")
>>> calc.set_misses(1)
>>> calc.set_combo(2354)
>>> calc.calculate()
>>> print(calc.pp)
727.3976135253906
>>> calc.close()

There is some extra syntactic sugar to make it shorter for simple usage however

Simple example

>>> import oppaipy
>>> with oppaipy.Calculator("/path/to/beatmap", misses=1) as calc:
...     print(calc.calculate())
(7.8976135253906, 727.3976135253906)

API

# Setting parameters
Calculator.set_beatmap(beatmap_path)
Calculator.set_mods(mods)
Calculator.set_combo(combo)
Calculator.set_accuracy_percent(accuracy)
Calculator.set_accuracy(count_100, count_50)
Calculator.set_misses(misses)
Calculator.set_score_version(score_version)
Calculator.set_base_ar(ar)
Calculator.set_base_od(od)
Calculator.set_base_cs(cs)
Calculator.set_base_hp(hp)
Calculator.reset()

# Calculating
Calculator.calculate()

# Getting values
Calculator.pp
Calculator.aim_pp
Calculator.speed_pp
Calculator.acc_pp
Calculator.stars
Calculator.aim_stars
Calculator.speed_stars

# Cleanup
Calculator.close()

Why should I use this?

You get the speed of the C bindings with a pythonic object interface.

Why the name "oppaipy"?

I already used "OOppai" for the wrapper of the original oppai's bindings, and I didn't like the look of "OOppai-ng".

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for oppaipy, version 1.0.3
Filename, size File type Python version Upload date Hashes
Filename, size oppaipy-1.0.3-py3-none-any.whl (4.1 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size oppaipy-1.0.3.tar.gz (3.0 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page