示例#1
0
def rm_tag_from_song(user, song_hash, tag):
    song = get_tn_by_hash(song_hash)
    if len(song.tags) == 1:
        flash("must have at least one tag")
    else:
        new_tags=[]
        for t in song.tags:
            if t.name in tag:
                flash(t.name + " removed")
            else:
                new_tags.append(t)
        song.tags = new_tags
        db.session.merge(song)
        db.session.commit()
示例#2
0
def add_tag_to_song(user, song_hash, tag):
    song = get_tn_by_hash(song_hash)
    song.add_tag(tag)
    db.session.merge(song)
    db.session.commit()
示例#3
0
def retag(tn_hash):
    song = get_tn_by_hash(tn_hash)
    u = session['twitter_user']
    return render_template('retag.html', song=song, user=u)
示例#4
0
def player(tn_hash):
    song = get_tn_by_hash(tn_hash)
    return render_template('player.html', tn=tn_hash, song=song)