def _edit_encode_stream(server, method: str, stream: EncodeStream): form = EncodeStreamForm(obj=stream) if method == 'POST' and form.validate_on_submit(): stream = form.update_entry(stream) server.update_stream(stream) return jsonify(status='ok'), 200 return render_template('stream/encode/edit.html', form=form, feedback_dir=stream.generate_feedback_dir())
def update_entry(self, entry: EncodeStream): entry.deinterlace = self.deinterlace.data entry.frame_rate = self.frame_rate.data entry.volume = self.volume.data entry.video_codec = self.video_codec.data entry.audio_codec = self.audio_codec.data entry.audio_channels_count = self.audio_channels_count.data entry.size = self.size.get_data() entry.video_bit_rate = self.video_bit_rate.data entry.audio_bit_rate = self.audio_bit_rate.data entry.logo = self.logo.get_data() entry.aspect_ratio = self.aspect_ratio.get_data() return super(EncodeStreamForm, self).update_entry(entry)
def make_entry(self): return self.update_entry(EncodeStream())