-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathtest_random_map.py
39 lines (28 loc) · 1001 Bytes
/
test_random_map.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
30
31
32
33
34
35
36
37
38
39
import datetime
import os
from random import shuffle
import beatmapparser
# Created by Awlex
if __name__ == "__main__":
# get Songs folder
osu_songs_directory = os.path.join(os.getenv('LOCALAPPDATA'), 'osu!', 'Songs')
# List Songs and shuffle the list
maps = os.listdir(osu_songs_directory)
shuffle(maps)
# Pick random map
map_path = os.path.join(osu_songs_directory, maps[0])
# Pick first .osu file
file = [x for x in os.listdir(map_path) if x.endswith(".osu")][0]
osu_path = os.path.join(map_path, file)
print(osu_path)
# init parser
parser = beatmapparser.BeatmapParser()
# Parse File
time = datetime.datetime.now()
parser.parseFile(osu_path)
print("Parsing done. Time: ", (datetime.datetime.now() - time).microseconds / 1000, 'ms')
#Build Beatmap
time = datetime.datetime.now()
parser.build_beatmap()
print("Building done. Time: ", (datetime.datetime.now() - time).microseconds / 1000, 'ms')
quit()