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)
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))
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))
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)
def home(): notes = [note for note in Note.all().order('-datetime').run(limit=16)] return render_template('index.html', notes=notes)