17 Commits

Author SHA1 Message Date
arian a6a84d662b deploy with gunicorn 2026-04-04 16:13:00 -04:00
arian 05d40b4bd8 bump click==8.3.2 2026-04-04 15:58:13 -04:00
arian 0f7fd55c7f bump Werkzeug==3.1.8 2026-04-03 15:08:08 -04:00
arian beb96580d4 Merge branch 'pr-ext-conf' 2026-03-28 10:18:56 -04:00
arian 524fc6ef54 mv conf vars external 2026-03-28 10:07:37 -04:00
arian cdacbd9d8f bump Werkzeug==3.1.7 2026-03-25 04:47:57 -04:00
arian c4d18aa680 increase concurrent uploads 2026-03-15 17:36:19 -04:00
arian 7da1443d09 Merge branch 'pr-healthcheck' 2026-03-10 08:04:40 -04:00
arian 771f557bae /ping healthcheck endpoint 2026-03-10 08:03:28 -04:00
arian 4c87869392 Merge branch 'theming' 2026-03-07 04:15:38 -05:00
arian 2e5d1ce78a remove upload header 2026-03-07 04:14:19 -05:00
arian 005a70ca65 dashed border for drop zone 2026-03-07 04:12:00 -05:00
arian aea43550c4 dashed border for drop zone 2026-03-07 04:10:37 -05:00
arian d301da7f09 important flag 2026-03-07 04:05:58 -05:00
arian d5c38e322c better dark theme 2026-03-07 04:00:43 -05:00
arian 46ba681137 Merge branch 'dropzone' 2026-03-06 06:02:37 -05:00
arian a2d50eccb0 drag & drop handling 2026-03-06 05:55:59 -05:00
7 changed files with 43 additions and 23 deletions
+3
View File
@@ -0,0 +1,3 @@
NAVIDROME_MUSIC_FOLDER="/opt/navidrome/music"
BIND_ADDRESS="192.168.2.24"
BIND_PORT="5001"
+2 -1
View File
@@ -1,4 +1,5 @@
venv/ venv/
setup.sh setup.sh
navidrome-upload.service navidrome-upload.service
.idea/ .idea/
.env
+16
View File
@@ -0,0 +1,16 @@
# gunicorn.conf.py
# Arian Nasr
# April 4, 2026
import os
BIND_ADDRESS = os.environ.get('BIND_ADDRESS', '0.0.0.0')
BIND_PORT = int(os.environ.get('BIND_PORT', 5001))
bind = f"{BIND_ADDRESS}:{BIND_PORT}"
workers = 2
accesslog = "-" # Log to stdout
errorlog = "-" # Log to stderr
# gunicorn -c gunicorn.conf.py main:app
+10 -16
View File
@@ -2,12 +2,11 @@
# Arian Nasr # Arian Nasr
# March 6, 2026 # March 6, 2026
import os import os
from flask import Flask, request, render_template from flask import Flask, request, render_template
from werkzeug.utils import secure_filename from werkzeug.utils import secure_filename
UPLOAD_FOLDER = '/opt/navidrome/music' UPLOAD_FOLDER = os.environ.get('NAVIDROME_MUSIC_FOLDER', '/opt/navidrome/music')
ALLOWED_EXTENSIONS = {'flac', 'mp3', 'wav'} ALLOWED_EXTENSIONS = {'flac', 'mp3', 'wav'}
app = Flask(__name__) app = Flask(__name__)
@@ -17,25 +16,20 @@ def allowed_file(filename):
return '.' in filename and \ return '.' in filename and \
filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
@app.route('/ping')
def ping():
return 'pong', 200
@app.route('/', methods=['GET', 'POST']) @app.route('/', methods=['GET', 'POST'])
def upload_file(): def upload_file():
if request.method == 'POST': if request.method == 'POST':
if 'file' not in request.files: for key, file in request.files.items():
return render_template('error.html', error_message='No file part in the request'), 400 if key.startswith('file') and file and allowed_file(file.filename) and file.filename != '':
files = request.files.getlist('file')
for file in files:
if file.filename == '':
return render_template('error.html', error_message='No selected file'), 400
if file and allowed_file(file.filename):
filename = secure_filename(file.filename) filename = secure_filename(file.filename)
file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename)) file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
else: else:
return render_template('error.html', error_message=f'File "{file.filename}" is not allowed. Allowed types: {", ".join(ALLOWED_EXTENSIONS)}'), 400 return render_template('error.html', error_message=f'File is not allowed.'), 400
return render_template('success.html', success_message=f'{len(files)} file(s) uploaded successfully!') return render_template('success.html', success_message=f'{len(request.files)} file(s) uploaded successfully!'), 200
return render_template('index.html') return render_template('index.html'), 200
if __name__ == '__main__':
app.run(host='192.168.2.24', port=5001, debug=False)
+3 -2
View File
@@ -1,7 +1,8 @@
blinker==1.9.0 blinker==1.9.0
click==8.3.1 click==8.3.2
Flask==3.1.3 Flask==3.1.3
itsdangerous==2.2.0 itsdangerous==2.2.0
Jinja2==3.1.6 Jinja2==3.1.6
MarkupSafe==3.0.3 MarkupSafe==3.0.3
Werkzeug==3.1.6 Werkzeug==3.1.8
gunicorn==25.3.0
+7 -1
View File
@@ -1,4 +1,10 @@
body { body {
background-color: #2B2726; background-color: #252526;
color: #FFFFFF; color: #FFFFFF;
}
.dropzone {
background: #3e3e42 !important;
border-radius: 2rem !important;
border-style: dashed !important;
border-color: #FFFFFF !important;
} }
+2 -3
View File
@@ -9,10 +9,9 @@
<link rel="stylesheet" href="{{ url_for('static', filename='css/dropzone.min.css') }}" type="text/css" /> <link rel="stylesheet" href="{{ url_for('static', filename='css/dropzone.min.css') }}" type="text/css" />
</head> </head>
<body> <body>
<h1>Drag & drop files here or <b>browse</b></h1>
<script> <script>
Dropzone.options.myDropzone = { Dropzone.options.myDropzone = {
parallelUploads: 2, parallelUploads: 4,
uploadMultiple: true, uploadMultiple: true,
acceptedFiles: 'audio/*' acceptedFiles: 'audio/*'
}; };
@@ -21,4 +20,4 @@
class="dropzone" class="dropzone"
id="my-dropzone"></form> id="my-dropzone"></form>
</body> </body>
</html> </html>