-
Notifications
You must be signed in to change notification settings - Fork 16
/
lldatamodify.py
104 lines (96 loc) · 4.46 KB
/
lldatamodify.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# -*- coding: utf-8 -*-
from app import *
@app.route("/llsongmodify", methods=['GET', 'POST'])
def llsongmodify():
openfile = open('songsjson.txt', 'rb')
songsjson = openfile.read()
openfile.close()
songs = json.loads(songsjson)
if request.form.has_key('submit'):
print request.form
if request.form.get('passwd') == 'prpr' or True:
pre = request.form.get('previoussong')
if pre == "":
pre = -1
else:
pre = string.atoi(pre)
now = request.form.get('songchoice')
if now == "":
now = -1
else:
now = string.atoi(now)
element = ['name', 'jpname', 'difficulty', 'attribute', 'stardifficulty','oldstardifficulty', 'randomdifficulty','oldrandomdifficulty', 'lp', 'exp',\
'combo','weight','slider', 'time','totaltime','bpm','cscore'\
,'bscore','ascore','sscore','star','type','cnhave', 'sm', 'mf'\
,'smsscore','smascore','smbscore','smcscore']
list_element=['positionnote', 'positionslider','positionweight']
newsong = {}
for key in element:
newsong[key] = request.form.get(key)
for key in list_element:
newsong[key] = ['']*9
for i in range(0, 9):
newsong[key][i] = request.form.get(key+str(i))
songs.insert(pre+1, newsong)
if now != -1:
if pre < now:
del songs[now+1]
else:
del songs[now]
newsongsjson = open('songsjson.txt','wb')
newsongsjson.write(json.dumps(songs))
newsongsjson.close()
newsongsjs = open('.\\static\\llsongapi.js','wb')
newsongsjs.write('function getsongjson(){return '+songsjson+'}')
newsongsjs.close()
return render_template('llsongmodify.html', songsjson = json.dumps(songs))
return render_template('llsongmodify.html', songsjson = songsjson)
@app.route("/llcardmodify", methods=['GET', 'POST'])
def llcardmodify():
inputfile = open('newcardsjson.txt', 'rb')
cardsjson = inputfile.read()
inputfile.close()
cards = json.loads(cardsjson)
if request.form.has_key('submit'):
print request.form
if request.form.get('passwd') == 'prpr' or True:
now = request.form.get('cardchoice')
element = ['type' , 'series', 'jpseries']
for key in element:
cards[now][key] = request.form.get(key)
newcardsjson = open('newcardsjson.txt','wb')
newcardsjson.write(json.dumps(cards))
newcardsjson.close()
newcardsjs = open('.\\static\\llcardapi.js','wb')
newcardsjs.write('function getcardjson(){return '+cardsjson+'}')
newcardsjs.close()
return render_template('llcardmodify.html', cardsjson = json.dumps(cards))
return render_template('llcardmodify.html', cardsjson = cardsjson)
@app.route("/llnewsongmodify", methods=['GET', 'POST'])
def llnewsongmodify():
openfile = open('newsongsjson.txt', 'rb')
songsjson = openfile.read()
openfile.close()
songs = json.loads(songsjson)
if request.form.has_key('submit'):
print request.form
if request.form.get('passwd') == 'prpr' or True:
now = request.form.get('songchoice')
diff = request.form.get('diffchoice')
songelement = ['bpm', 'totaltime', 'muse','aqours']
diffelement = ['time', 'star']
for key in songelement:
songs[now][key] = request.form.get(key)
for key in diffelement:
songs[now][diff][key] = request.form.get(key)
songs[now][diff]['positionweight'] = [0]*9
for i in range(0, 9):
songs[now][diff]['positionweight'][i] = request.form.get('positionweight'+str(i))
newsongsjson = open('newsongsjson.txt','wb')
newsongsjson.write(json.dumps(songs))
newsongsjson.close()
newsongsjs = open('.\\static\\llsongapi.js','wb')
newsongsjs.write('function getsongjson(){return '+songsjson+'}')
newsongsjs.close()
return render_template('llnewsongmodify.html', songsjson = json.dumps(songs))
return render_template('llnewsongmodify.html', songsjson = songsjson)