SongSelect: Add maker identification
requires maker_id(int) column in songs table, and a new "makers" table with maker_id(int), name(text), url(text)
This commit is contained in:
6
app.py
6
app.py
@@ -107,7 +107,7 @@ def route_api_preview():
|
||||
@app.route('/api/songs')
|
||||
@app.cache.cached(timeout=15)
|
||||
def route_api_songs():
|
||||
songs = query_db('select * from songs where enabled = 1')
|
||||
songs = query_db('select s.*, m.name, m.url from songs s left join makers m on s.maker_id = m.maker_id where enabled = 1')
|
||||
|
||||
raw_categories = query_db('select * from categories')
|
||||
categories = {}
|
||||
@@ -127,6 +127,7 @@ def route_api_songs():
|
||||
|
||||
category_out = categories[song[11]] if song[11] in categories else ""
|
||||
song_skin_out = song_skins[song[14]] if song[14] in song_skins else None
|
||||
maker = {'name': song[18], 'url': song[19]} if song[17] else None
|
||||
|
||||
songs_out.append({
|
||||
'id': song_id,
|
||||
@@ -142,7 +143,8 @@ def route_api_songs():
|
||||
'type': song_type,
|
||||
'offset': song[13],
|
||||
'song_skin': song_skin_out,
|
||||
'volume': song[16]
|
||||
'volume': song[16],
|
||||
'maker': maker
|
||||
})
|
||||
|
||||
return jsonify(songs_out)
|
||||
|
||||
Reference in New Issue
Block a user