-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcheck_your_osu_songs.py
60 lines (48 loc) · 1.48 KB
/
check_your_osu_songs.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import os
import time
from peace_performance_python.prelude import *
from tests import async_run
osu_list = []
errs = {}
# Your osu songs
# Will traverse a directory and try to read and calculate all .osu files
OSU_SONGS_PATH = r'E:\osu\songs'
def walk(path):
dirs = os.listdir(path)
for pa in dirs:
p = os.path.join(path, pa)
if os.path.isdir(p):
walk(p)
elif p.endswith('.osu'):
osu_list.append(p)
print(f'\r[ {len(osu_list)} ] .osu files founded...', end='')
async def main():
# Find out .osu files
print(f'[ Walking ({OSU_SONGS_PATH}) Start... ]')
walk(OSU_SONGS_PATH)
print(f'\n[ Walking Done! ]')
# Ready
c, total = Calculator(), len(osu_list)
done = total_dutaion = err_count = ok_count = 0
# Start
print('[ Start task ]')
for f in osu_list:
try:
start = time.time_ns()
c.calculate(Beatmap(f))
instant_ms = (time.time_ns() - start) / 1000 / 1000
total_dutaion += instant_ms
ok_count += 1
except Exception as err:
err_count += 1
errs[f] = str(err)
done += 1
print(
'\r{}/{}; ok: {}, err: {}; total time: {:.2f}ms, avg: {:.2f}ms'.format(
done, total, ok_count, err_count, total_dutaion, total_dutaion / done
), end=''
)
print('\n[ All DONE ]\nRaw Errs:')
print(errs)
if __name__ == '__main__':
async_run(main())