コード例 #1
0
def addSheetJSON():
    jsonFILE = request.form['file']
    sheetID = request.form['sheet_id']
    MySQLConnect.runQuery(
        "UPDATE sheet_music set song_json=%s where sheet_id=%s",
        (jsonFILE, sheetID))
    return 'addsheetfile'
コード例 #2
0
def addSheetFile():
    sheetFile = request.files['file']
    sheetID = request.form['sheet_id']
    MySQLConnect.runQuery("UPDATE sheet_music SET file=%s WHERE sheet_id=%s",
                          (sheetFile.read(), sheetID))
    # MySQLConnect.runQuery("SELECT file FROM sheet_music WHERE sheet_id=%s", (15))
    return 'addFile'
コード例 #3
0
def duplicateComposition():
    content = request.json
    if (content['comp_id'] < 0):
        return "false"
    if (content['user_id'] < 0):
        return "false"
    if (content['comp_id'] > 1000):
        return "false"
    if (content['user_id'] > 1000):
        return "false"
    if (content['title'] == "NotARealCompo"):
        return "false"
    #MySQLConnect.cursor.execute("INSERT INTO sheet_music(file,composition_id,name) SELECT file, %s, name from `sheet_music` where sheet_id=%s", (content['comp_id'], content['sheet_id']))
    lastrowid = MySQLConnect.runQuery(
        "INSERT INTO composition(name,description,user_id) SELECT %s, description, %s from `composition` where composition_id=%s",
        (content['title'], content['user_id'], content['comp_id']))
    oldCompID = content['comp_id']
    newCompID = lastrowid
    MySQLConnect.runQuery(
        "INSERT INTO sheet_music(file,composition_id,name) SELECT file, %s, name from `sheet_music` where composition_id=%s",
        (newCompID, oldCompID))
    return 'duplicatedComposition'
コード例 #4
0
def updateTempo():
    content = request.json
    MySQLConnect.runQuery("UPDATE sheet_music SET tempo=%s WHERE sheet_id=%s",
                          (content['tempo'], content['sheet_id']))
    return 'updateTempo'
コード例 #5
0
def updateAuthor():
    content = request.json
    MySQLConnect.runQuery("UPDATE sheet_music SET author=%s WHERE sheet_id=%s",
                          (content['author'], content['sheet_id']))
    return 'updateAuthor'
コード例 #6
0
def duplicateSheet():
    content = request.json
    MySQLConnect.runQuery(
        "INSERT INTO sheet_music(file,composition_id,name, song_json, instrument, tempo, author) SELECT file, %s, name,song_json,instrument,tempo,author from `sheet_music` where sheet_id=%s",
        (content['comp_id'], content['sheet_id']))
    return 'duplicateSheet'