Ejemplo n.º 1
0
def audio():
    form = WatermarkForm()
    global AUDIO_PATH
    if form.validate_on_submit():
        f = request.files['file']
        save_path = os.path.join(current_app.instance_path, 'upload',
                                 f.filename)
        f.save(save_path)
        AUDIO_PATH = save_path
        if len(AUDIO_PATH) == 0:
            return redirect(url_for('audio'))
        else:
            watermark_string = form.watermark.data
            temp_file_path = os.path.join(current_app.instance_path, 'temp',
                                          'temp.wav')
            lsb_watermark(AUDIO_PATH, watermark_string, temp_file_path)
            return redirect(url_for('audio_get', filename='temp.wav'))
    return render_template('audio.html', form=form)
Ejemplo n.º 2
0
def video():
    form = WatermarkForm()
    global VIDEO_PATH
    if form.validate_on_submit():
        f = request.files['file']
        save_path = os.path.join(current_app.instance_path, 'upload',
                                 f.filename)
        f.save(save_path)
        VIDEO_PATH = save_path
        if len(VIDEO_PATH) == 0:
            return redirect(url_for('video'))
        else:
            watermark_string = form.watermark.data
            temp_file_path = os.path.join(current_app.instance_path, 'temp',
                                          'temp.mp4')
            embed_video(VIDEO_PATH, watermark_string, temp_file_path)
            return redirect(url_for('video_get', filename='temp.mp4'))
    return render_template('video.html', form=form)
Ejemplo n.º 3
0
def image():
    global IMAGE_PATH
    form = WatermarkForm()
    if form.validate_on_submit():
        f = request.files['file']
        save_path = os.path.join(current_app.instance_path, 'upload',
                                 f.filename)
        f.save(save_path)
        IMAGE_PATH = save_path
        if len(IMAGE_PATH) == 0:
            return redirect(url_for('image'))
        else:
            watermark_string = form.watermark.data
            temp_file_path = os.path.join(current_app.instance_path, 'temp',
                                          'temp.jpg')
            print(temp_file_path)
            embed_watermark(IMAGE_PATH, watermark_string, temp_file_path)
            print('ok')
            return redirect(url_for('image_get', filename='temp.jpg'))
    #return redirect(url_for('image'))
    return render_template('image.html', form=form)