-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.py
29 lines (23 loc) · 918 Bytes
/
example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from beatmap_reader import Beatmap, HitObjectType, SliderEventType
import sys
beatmap = Beatmap.from_path(sys.argv[1])
beatmap.load() # load data from file
beatmap.load_objects() # calculate slider paths, stacking, and max combo
print(
f"{beatmap.metadata.artist_unicode} - "
f"{beatmap.metadata.title_unicode} "
f"[{beatmap.metadata.version}] "
f"mapped by {beatmap.metadata.creator}"
)
print(f"Has {len(beatmap.hit_objects)} objects")
print(f" - {beatmap.hit_circle_count} hit circles")
print(f" - {beatmap.slider_count} sliders")
print(f" - {beatmap.spinner_count} spinners")
slider_ticks = 0
for hit_object in beatmap.hit_objects:
if hit_object.type == HitObjectType.SLIDER:
for obj in hit_object.nested_objects:
if obj.type == SliderEventType.TICK:
slider_ticks += 1
print(f"Has {slider_ticks} slider ticks")
print(f"Max combo {beatmap.max_combo}")