def view_live(live, lang='EN'):
df_head = pd.DataFrame({'Cover': ['<img src="{0}" width=100 />'.format(live.cover)]})
df_head['Song Name'] = '<p style="color:{0};">{1}</p>'.format(attr_color[live.attr], live.name)
df_head['Group'] = live.group
df_head['Difficulty'] = live.difficulty
df_head['Total Note'] = live.note_number
df_head['Duration'] = live.duration
df_head.columns = ['<p>{0}</p>'.format(x) for x in list(df_head.columns)]
df = live.summary.copy()
pos_name = ['<p>{0}</p>'.format(x) for x in ['L1', 'L2', 'L3', 'L4', 'C', 'R4', 'R3', 'R2', 'R1']]
df.index = [pos_name[9-x] if type(x)==int else x for x in list(df.index)]
df = df.loc[pos_name+['total']]
df = df.applymap(lambda x: '<p>{0}</p>'.format(str(int(x)) if np.isclose(2*x,round(2*x)) else '{0:.3f}'.format(x))).transpose()
if lang=='CN':
df_head.columns = ['<p>{0}</p>'.format(x) for x in ['????', '????', '??', '??', 'Note??', '??']]
df.columns = list(df.columns)[:-1] + ['<p>??</p>']
df.index = ['<p>{0}</p>'.format(x) for x in ['??', '??', '??', '??', '??', '????', '????', '??????']]
elif lang=='EN':
df.index = ['<p>{0}</p>'.format(x) for x in ['tap', 'hold', 'swing', 'star', 'token', 'type weight', 'combo weight', 'weight fraction']]
return HTML(html_template.format(df_head.to_html(escape=False, index=False) + df.to_html(escape=False)))
评论列表
文章目录