Ejemplo n.º 1
0
def add_a_sugg(conn, name, mood, song_name, artist, url, comment):
    if name == None or mood == None or song_name == None or artist == None or url == None or comment == None or name == "" or mood == "" or song_name == "" or artist == "" or url == "" or comment == "":
        raise Exception
    return execute(
        conn,
        "INSERT INTO Suggestions(username,songname,artist,url,moodname,comment) VALUES (:username,:songname,:artist,:url,:moodname,:comment) ",
        {
            'username': name,
            'songname': song_name,
            'artist': artist,
            'url': url,
            'moodname': mood,
            'comment': comment
        })
Ejemplo n.º 2
0
def get_playlist(conn, mood):
    return execute(
        conn,
        "SELECT s.name, s.artist, s.url FROM Songs AS s, SongMood AS sm, Moods AS m WHERE s.sid = sm.sid and sm.mid = m.mid and m.mood = :mood",
        {'mood': mood})
Ejemplo n.º 3
0
def get_all_moods(conn):
    return execute(conn, "SELECT m.mid, m.mood FROM Moods AS m")
Ejemplo n.º 4
0
def suggestions(conn):
    return execute(conn, "SELECT * FROM Suggestions")
Ejemplo n.º 5
0
def songs(conn):
    return execute(
        conn,
        "SELECT s.sid, s.name, s.artist, s.url, s.explicit FROM Songs AS s")
Ejemplo n.º 6
0
def songmood(conn):
    return execute(
        conn,
        "SELECT songmood.sid, moods.mood, songs.name, songs.url FROM Songs, Moods, SongMood WHERE songs.sid = songmood.sid and moods.mid = songmood.mid"
    )