新增输出xls,会显示候补未鸟加歌曲
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import xlwt
|
||||||
|
|
||||||
|
|
||||||
def calculate_multiplier(max_score):
|
def calculate_multiplier(max_score):
|
||||||
@@ -79,10 +80,68 @@ def output_json_template(b50, alt15, total):
|
|||||||
return template
|
return template
|
||||||
|
|
||||||
|
|
||||||
|
def output_xls(b50, alt15, t):
|
||||||
|
xls = xlwt.Workbook(encoding='utf-8')
|
||||||
|
work_sheet = xls.add_sheet('Sheet1')
|
||||||
|
work_sheet.col(1).width = 256*30
|
||||||
|
|
||||||
|
work_sheet.write(0, 0, "Best50")
|
||||||
|
work_sheet.write(0, 1, "注意:该表格仅计算单曲rate最高50首,并采用了新14定数表作为统计资料")
|
||||||
|
work_sheet.write(2, 0, "ID")
|
||||||
|
work_sheet.write(2, 1, '歌曲')
|
||||||
|
work_sheet.write(2, 2, '难度')
|
||||||
|
work_sheet.write(2, 3, '单曲rate')
|
||||||
|
work_sheet.write(2, 4, '最高分数')
|
||||||
|
work_sheet.write(2, 5, '定数')
|
||||||
|
work_sheet.write(1, 4, 'Rate:')
|
||||||
|
count = 3
|
||||||
|
|
||||||
|
style_ex = xlwt.XFStyle()
|
||||||
|
pattern = xlwt.Pattern()
|
||||||
|
pattern.pattern = xlwt.Pattern.SOLID_PATTERN
|
||||||
|
pattern.pattern_fore_colour = 10
|
||||||
|
style_ex.pattern = pattern
|
||||||
|
|
||||||
|
style_inf = xlwt.XFStyle()
|
||||||
|
pattern1 = xlwt.Pattern()
|
||||||
|
pattern1.pattern = xlwt.Pattern.SOLID_PATTERN
|
||||||
|
pattern1.pattern_fore_colour = 20
|
||||||
|
style_inf.pattern = pattern1
|
||||||
|
|
||||||
|
for i in b50:
|
||||||
|
work_sheet.write(count, 0, i['id'])
|
||||||
|
work_sheet.write(count, 1, i['music'])
|
||||||
|
if i['difficulty'] == 'EXPERT':
|
||||||
|
work_sheet.write(count, 2, i['difficulty'], style=style_ex)
|
||||||
|
elif i['difficulty'] == 'INFERNO':
|
||||||
|
work_sheet.write(count, 2, i['difficulty'], style=style_inf)
|
||||||
|
work_sheet.write(count, 3, i['rate'])
|
||||||
|
work_sheet.write(count, 4, i['max_score'])
|
||||||
|
work_sheet.write(count, 5, i['level'])
|
||||||
|
count = count + 1
|
||||||
|
|
||||||
|
work_sheet.write(count, 0, '候补未鸟加歌曲')
|
||||||
|
for i in alt15:
|
||||||
|
if i['max_score'] < 990000:
|
||||||
|
count = count + 1
|
||||||
|
work_sheet.write(count, 0, i['id'])
|
||||||
|
work_sheet.write(count, 1, i['music'])
|
||||||
|
if i['difficulty'] == 'EXPERT':
|
||||||
|
work_sheet.write(count, 2, i['difficulty'], style=style_ex)
|
||||||
|
elif i['difficulty'] == 'INFERNO':
|
||||||
|
work_sheet.write(count, 2, i['difficulty'], style=style_inf)
|
||||||
|
work_sheet.write(count, 3, i['rate'])
|
||||||
|
work_sheet.write(count, 4, i['max_score'])
|
||||||
|
work_sheet.write(count, 5, i['level'])
|
||||||
|
work_sheet.write(1, 5, xlwt.Formula('SUM(D4:D53)'),
|
||||||
|
style=xlwt.easyxf('font: bold on; pattern: pattern solid, fore_colour ice_blue'))
|
||||||
|
xls.save('output.xls')
|
||||||
|
|
||||||
|
|
||||||
# print("//////////////////////////////////////////////////////////////////////")
|
# print("//////////////////////////////////////////////////////////////////////")
|
||||||
# print("华卡音舞 Ver.3 3.50.00")
|
# print("华卡音舞 Ver.3 3.50.00")
|
||||||
# print("全曲 Rate + Best 50 计算器")
|
# print("全曲 Rate + Best 50 计算器")
|
||||||
# print("版本号 V0.05(1)")
|
# print("版本号 V0.05(2)")
|
||||||
# print("由WOAOL项目组制作")
|
# print("由WOAOL项目组制作")
|
||||||
# print("WACCA NEVER END")
|
# print("WACCA NEVER END")
|
||||||
# print("请注意,该版本计算器不区分B15和B35,仅计算全曲的Best50成绩,并使用V4的14定数表")
|
# print("请注意,该版本计算器不区分B15和B35,仅计算全曲的Best50成绩,并使用V4的14定数表")
|
||||||
@@ -158,7 +217,7 @@ for log in play_logs:
|
|||||||
# print(f" 难度: {grade_name} 定数: {level:.1f} 分数: {max_score} Rate: {rate:.3f}")
|
# print(f" 难度: {grade_name} 定数: {level:.1f} 分数: {max_score} Rate: {rate:.3f}")
|
||||||
|
|
||||||
best_50_sorted = sorted(best_50, key=lambda x: x[2], reverse=True)[0:50]
|
best_50_sorted = sorted(best_50, key=lambda x: x[2], reverse=True)[0:50]
|
||||||
best_50_alternate = sorted(best_50, key=lambda x: x[2], reverse=True)[50:65]
|
best_50_alternate = sorted(best_50, key=lambda x: x[2], reverse=True)[50:150]
|
||||||
|
|
||||||
best_50_total = sum(rate for _, _, rate, _, _, _ in best_50_sorted)
|
best_50_total = sum(rate for _, _, rate, _, _, _ in best_50_sorted)
|
||||||
|
|
||||||
@@ -187,6 +246,9 @@ for music_name, grade_name, rate, max_score, level, music_id in best_50_alternat
|
|||||||
total = f'{best_50_total:.3f}'
|
total = f'{best_50_total:.3f}'
|
||||||
total = float(total)
|
total = float(total)
|
||||||
data = output_json_template(b50_json, alt15_json, total)
|
data = output_json_template(b50_json, alt15_json, total)
|
||||||
|
|
||||||
|
output_xls(b50_json, alt15_json, total)
|
||||||
|
|
||||||
with open('b50_result.json', 'w+', encoding='utf-8') as json_file:
|
with open('b50_result.json', 'w+', encoding='utf-8') as json_file:
|
||||||
json.dump(data, json_file, ensure_ascii=False, indent=2)
|
json.dump(data, json_file, ensure_ascii=False, indent=2)
|
||||||
print('Done')
|
print('Done')
|
||||||
|
|||||||
Reference in New Issue
Block a user