Skip to content

Commit

Permalink
Clean up some stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
camprevail committed Sep 11, 2023
1 parent e036505 commit c8a42bd
Show file tree
Hide file tree
Showing 161 changed files with 65 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/scorecard_env
*.env
__pycache__
.idea
.idea
/museca1_5/assets/music-info-b.xml
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# bemani-scorecards
This repo is an example of a webhook service that can generate scorecard images from music-save network data from rhythm games.

Install the requirements.txt, don't upgrade pillow because newer versions messed with font rendering and deprecated some stuff.
<br>For museca, you'll need to drop your own music-info-b.xml into the assets folder, it won't be included in this repo.
#

![](/example.png)
4 changes: 2 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ def main():
try:
scorecard = importlib.import_module(f'{module}.scorecard').ScoreCard(data)
img, info = scorecard.generate()
log.info('Generating scorecard')
log.info(f'Generating {module} scorecard')
return send_file(img, as_attachment=True, attachment_filename=time.strftime(f"{module}-%Y%m%d-%H%M%S.png"))
except Exception as e:
log.info(e)
log.error(e)
return render_template_string(repr(e)), 500
return render_template_string('game or version not supported'), 406

Expand Down
Binary file removed museca1_5/assets/font/msgothic.ttc
Binary file not shown.
Binary file removed museca1_5/assets/jackets/jk_01_0227_1_b.png
Binary file not shown.
Binary file removed museca1_5/assets/jackets/jk_01_0228_1_b.png
Binary file not shown.
Binary file removed museca1_5/assets/jackets/jk_01_0229_1_b.png
Binary file not shown.
Binary file removed museca1_5/assets/jackets/jk_01_0229_2_b.png
Binary file not shown.
Binary file removed museca1_5/assets/jackets/jk_01_0229_3_b.png
Binary file not shown.
Binary file removed museca1_5/assets/jackets/jk_01_0230_1_b.png
Binary file not shown.
Binary file removed museca1_5/assets/jackets/jk_01_0231_1_b.png
Binary file not shown.
Binary file removed museca1_5/assets/jackets/jk_01_0231_2_b.png
Binary file not shown.
Binary file removed museca1_5/assets/jackets/jk_01_0231_3_b.png
Binary file not shown.
Binary file removed museca1_5/assets/jackets/jk_01_0232_1_b.png
Binary file not shown.
Binary file removed museca1_5/assets/jackets/jk_01_0233_1_b.png
Binary file not shown.
Binary file removed museca1_5/assets/jackets/jk_01_0234_1_b.png
Binary file not shown.
Binary file removed museca1_5/assets/jackets/jk_01_0235_1_b.png
Binary file not shown.
Binary file removed museca1_5/assets/jackets/jk_01_0236_1_b.png
Binary file not shown.
Binary file removed museca1_5/assets/jackets/jk_01_0237_1_b.png
Binary file not shown.
Binary file removed museca1_5/assets/jackets/jk_01_0238_1_b.png
Binary file not shown.
Binary file removed museca1_5/assets/jackets/jk_01_0239_1_b.png
Binary file not shown.
Binary file removed museca1_5/assets/jackets/jk_01_0240_1_b.png
Binary file not shown.
Binary file removed museca1_5/assets/jackets/jk_01_0241_1_b.png
Binary file not shown.
Binary file removed museca1_5/assets/jackets/jk_01_0242_1_b.png
Binary file not shown.
Binary file removed museca1_5/assets/jackets/jk_01_0242_2_b.png
Binary file not shown.
Binary file removed museca1_5/assets/jackets/jk_01_0242_3_b.png
Binary file not shown.
Binary file removed museca1_5/assets/jackets/jk_01_0243_1_b.png
Binary file not shown.
Binary file removed museca1_5/assets/jackets/jk_01_0244_1_b.png
Binary file not shown.
Binary file removed museca1_5/assets/jackets/jk_01_0245_1_b.png
Binary file not shown.
Binary file removed museca1_5/assets/jackets/jk_01_0246_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0247_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0248_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0249_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0250_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0251_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0252_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0253_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0254_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0254_2_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0254_3_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0255_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0256_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0257_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0258_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0259_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0260_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0261_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0262_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0263_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0263_2_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0263_3_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0264_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0265_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0266_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0267_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0267_2_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0267_3_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0268_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0269_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0270_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0271_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0272_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0273_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0274_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0275_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0276_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0277_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0278_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0279_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0280_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0281_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0282_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0283_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0283_2_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0283_3_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0284_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0285_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0287_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0288_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0289_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0291_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0292_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0293_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0294_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0295_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0296_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0297_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0298_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0300_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0301_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0304_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0324_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0325_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0333_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0341_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0361_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0363_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0363_2_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0363_3_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0364_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0364_2_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0364_3_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0365_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0384_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0386_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0387_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0388_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0389_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0389_2_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0389_3_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0390_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0393_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0410_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0459_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0461_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0462_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0463_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0464_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0465_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0470_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0472_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0473_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0476_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0477_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0477_2_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0477_3_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0478_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0479_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0479_2_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0480_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0481_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0482_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0509_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0510_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0511_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0515_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0515_2_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0515_3_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0525_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0539_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0543_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0554_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0556_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0557_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0560_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0561_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0563_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0571_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0579_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0582_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0584_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0585_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0585_2_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0585_3_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0900_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0901_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0906_1_b.png
Diff not rendered.
Binary file removed museca1_5/assets/jackets/jk_01_0907_1_b.png
Diff not rendered.
48 changes: 48 additions & 0 deletions museca1_5/assets/req-game_3-save_m.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version='1.0' encoding='UTF-8'?>
<call model="PIX:J:B:A:2018073002" srcid="01201000000000000000" tag="/50/AOD1">
<game_3 method="save_m" ver="0">
<refid __type="str">0000000000000000</refid>
<dataid __type="str">0000000000000000</dataid>
<music_id __type="u32">226</music_id>
<music_type __type="u32">2</music_type>
<score __type="u32">1000000</score>
<old_score __type="u32">915267</old_score>
<clear_type __type="u32">4</clear_type>
<score_grade __type="u32">8</score_grade>
<max_chain __type="u32">1007</max_chain>
<critical __type="u32">1007</critical>
<near __type="u32">0</near>
<error __type="u32">0</error>
<effective_rate __type="u32">4910</effective_rate>
<btn_rate __type="u32">8556</btn_rate>
<long_rate __type="u32">0</long_rate>
<vol_rate __type="u32">0</vol_rate>
<mode __type="u8">0</mode>
<gauge_type __type="u8">0</gauge_type>
<online_num __type="u16">0</online_num>
<local_num __type="u16">0</local_num>
<locid __type="str">0</locid>
<just_checker>
<before_3 __type="u16">3</before_3>
<before_2 __type="u16">5</before_2>
<before_1 __type="u16">27</before_1>
<just __type="u16">28</just>
<after_1 __type="u16">20</after_1>
<after_2 __type="u16">7</after_2>
<after_3 __type="u16">2</after_3>
</just_checker>
<drop_frame __type="u16">0</drop_frame>
<drop_frame_max __type="u16">25</drop_frame_max>
<drop_count __type="u16">0</drop_count>
<etc __type="str">card:182,21,41,medel:10-&gt;10,0-&gt;1,0-&gt;2,coloris:1484,muese:0,cur:20,lane:0,curve:2,seq:2,mission:G20-3(100.00%),DTime:0,0</etc>
<eaappli>
<is_image_store __type="bool">0</is_image_store>
<track_no __type="u16">0</track_no>
<player_name __type="str">TEST</player_name>
<appeal_id __type="u16">0</appeal_id>
<skill_level __type="s16">0</skill_level>
<skill_frame_type __type="s16">0</skill_frame_type>
<skill_name_id __type="s16">0</skill_name_id>
</eaappli>
</game_3>
</call>
9 changes: 7 additions & 2 deletions museca1_5/scorecard.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Run this script to test the scorecard rendering. It will pull data from assets/req-game_3-save_m.xml.


import re, os, glob, logging
from lxml import etree
from PIL import Image, ImageDraw, ImageFont
Expand Down Expand Up @@ -28,7 +31,7 @@ def seekXml(path):
class ScoreCard:
"""
Requires an xml request of game_3/save_m.
Optional hiscore (add an 'old_score' element in the request) will display score difference on card.
Optional hiscore (add an 'old_score' element in the response) will display score difference on card.
Usage:
from scorecard import ScoreCard
Expand Down Expand Up @@ -341,14 +344,16 @@ def fixBrokenChars(self, name): # thanks mon
[u'\u9B06', u'Ý'],
[u'\u968D', u'Ü'],
[u'\u9B2E', u'¡'],
[u'\u99B9', u'©'],
[u'\u99BF', u'♠'],
]
for rep in replacements:
name = name.replace(rep[0], rep[1])
return name


if __name__ == '__main__':
tree = etree.parse('assets/req-game_3-save_m.xml') # File not included
tree = etree.parse('assets/req-game_3-save_m.xml')
data = etree.tostring(tree)
scorecard = ScoreCard(data)
scorecard.generate()
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
lxml
Pillow
Pillow==7.2.0
requests
Flask
uwsgi
uwsgi
path

0 comments on commit c8a42bd

Please sign in to comment.