예제 #1
0
def video_note(video_id, note_id):
    note = Note.get_by_id(note_id)

    if note.video_id != video_id:
        return abort(400)

    return render_template('note_info.html',
                           note=note,
                           random=False,
                           args=request.args)
예제 #2
0
def video_create_note(video_id):
    title = request.form.get('title', 'Noname')
    nickname = request.form.get('nickname', 'Anonymous')
    notes = request.form.get('notes', '')
    video_title = request.form.get('video_title', 'UNTITLED')

    if notes == '' or notes == '[]':
        flash('Note is empty!')
        return redirect(url_for('main.video_create_note_form',
                                video_id=video_id))

    note = Note(video_id=video_id,
                video_title=video_title,
                title=title,
                writer_name=nickname,
                ip=request.remote_addr,
                notes=notes)
    note.put()

    flash('Created successfully!')
    return redirect(url_for('main.video_info', video_id=video_id))
예제 #3
0
def video_play(video_id, note_id):
    note = Note.get_by_id(note_id)

    if note.video_id != video_id:
        return abort(400)

    clap_range = request.form.get('range-result', 50000)
    if clap_range == '' or int(clap_range) == 0:
        clap_range = 50000
    elif clap_range < 20000:
        clap_range = 20000
    else:
        clap_range = int(clap_range)

    notes_o = []
    for t in json.loads(note.notes):
        notes_o.append({'t': t})

    return render_template('play.html',
                           note=note,
                           clap_range=clap_range,
                           random=False,
                           notes_str=json.dumps(notes_o))
예제 #4
0
def video_info(video_id):
    notes = [note for note in Note.all().filter('video_id =', video_id)]
    return render_template('video_info.html', video_id=video_id, notes=notes)
예제 #5
0
def home():
    notes = [note for note in Note.all().order('-datetime').run(limit=16)]
    return render_template('index.html', notes=notes)