|
|
@ -22,7 +22,7 @@ def index():
|
|
|
|
@app.route("/submitted")
|
|
|
|
@app.route("/submitted")
|
|
|
|
def submitted():
|
|
|
|
def submitted():
|
|
|
|
print("doingsubmit")
|
|
|
|
print("doingsubmit")
|
|
|
|
return render_template('index.html', error=request.args.get('error'), submitted=True)
|
|
|
|
return render_template('index.html', error=request.args.get('error'), submitted=True, saved_path=request.args.get('path'))
|
|
|
|
|
|
|
|
|
|
|
|
def get_random_subfolder():
|
|
|
|
def get_random_subfolder():
|
|
|
|
# folder = os.listdir(app.config['UPLOAD_FOLDER'])
|
|
|
|
# folder = os.listdir(app.config['UPLOAD_FOLDER'])
|
|
|
@ -63,7 +63,7 @@ def upload_file():
|
|
|
|
img.thumbnail((100, 100), Image.LANCZOS)
|
|
|
|
img.thumbnail((100, 100), Image.LANCZOS)
|
|
|
|
|
|
|
|
|
|
|
|
img.save(os.path.join(sub_folder, filename))
|
|
|
|
img.save(os.path.join(sub_folder, filename))
|
|
|
|
return redirect(url_for('submitted'))
|
|
|
|
return redirect(url_for('submitted', path=os.path.join(sub_folder, filename)))
|
|
|
|
elif ext in ['mp4', 'avi', 'mov', 'flv']:
|
|
|
|
elif ext in ['mp4', 'avi', 'mov', 'flv']:
|
|
|
|
file.save(temp_path)
|
|
|
|
file.save(temp_path)
|
|
|
|
|
|
|
|
|
|
|
@ -81,7 +81,7 @@ def upload_file():
|
|
|
|
|
|
|
|
|
|
|
|
ffmpeg.execute()
|
|
|
|
ffmpeg.execute()
|
|
|
|
os.remove(temp_path)
|
|
|
|
os.remove(temp_path)
|
|
|
|
return redirect(url_for('submitted'))
|
|
|
|
return redirect(url_for('submitted', path=out_path))
|
|
|
|
elif ext in ['mp3', 'wav', 'flac']:
|
|
|
|
elif ext in ['mp3', 'wav', 'flac']:
|
|
|
|
out_path = os.path.join(sub_folder, filename.rsplit('.', 1)[0].lower() + '.mp3')
|
|
|
|
out_path = os.path.join(sub_folder, filename.rsplit('.', 1)[0].lower() + '.mp3')
|
|
|
|
file.save(temp_path)
|
|
|
|
file.save(temp_path)
|
|
|
@ -98,7 +98,8 @@ def upload_file():
|
|
|
|
ffmpeg.execute()
|
|
|
|
ffmpeg.execute()
|
|
|
|
|
|
|
|
|
|
|
|
os.remove(temp_path)
|
|
|
|
os.remove(temp_path)
|
|
|
|
return redirect(url_for('submitted'))
|
|
|
|
return redirect(url_for('submitted', path=out_path))
|
|
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
print("not an image!")
|
|
|
|
print("not an image!")
|
|
|
|
return redirect(url_for('submitted', Error="The file you are trying to upload is not supported by our infra-ordinary"))
|
|
|
|
return redirect(url_for('submitted', Error="The file you are trying to upload is not supported by our infra-ordinary"))
|
|
|
|