Beispiel #1
0
 def getListOfSongs(cls, db):
     query = "SELECT * FROM songs JOIN artist ON artist.id = songs.artist_id WHERE artist.id = %(artistId)s;"
     results = connectToMySQL('songinfo').query_db(query, db)
     songList = cls(results[0])
     for row_from_db in results:
         data = {
             "id": row_from_db['artist_id'],
             "title": row_from_db['title'],
             "video": row_from_db['video'],
             "created_at": row_from_db['created_at'],
             "updated_at": row_from_db['updated_at'],
         }
         songList.songs.append(Songs(data))
     return songList
Beispiel #2
0
def songDashboard():
    return render_template("songs/songDashboard.html", songs=Songs.get_all())
Beispiel #3
0
def deleteSong(songId):
    data = {"songId": int(songId)}
    Songs.delete(data)
    return redirect("/artist/dashboard")
Beispiel #4
0
def processSongUpdate():
    Songs.update(request.form)
    updatedSong = Songs.getById(id)
    return redirect(f"/show/song/{updatedSong['id']}")
Beispiel #5
0
def editsong(id):
    return render_template('songs/editSong.html', song=Songs.getById(id))
Beispiel #6
0
def processSongForm():
    newSong = Songs.save(request.form)
    return redirect(f"/show/artist/{request.form['artistId']}")
Beispiel #7
0
def showSong(songId):
    data = {"songId": int(songId)}
    return render_template("songs/showSong.html", song=Songs.getById(data))