diff --git a/__pycache__/app.cpython-310.pyc b/__pycache__/app.cpython-310.pyc deleted file mode 100644 index 4ca34f0..0000000 Binary files a/__pycache__/app.cpython-310.pyc and /dev/null differ diff --git a/app.py b/app.py index 1139a4a..f2a6d76 100644 --- a/app.py +++ b/app.py @@ -1,4 +1,5 @@ from flask import Flask, request, redirect, url_for, send_file, render_template +from subprocess import run import os app = Flask(__name__) @@ -9,17 +10,19 @@ def upload_form(): def process_file(urls): # path = os.path.expanduser('~/musics/downloads') - path = './downloads' - download_param_album = '{artist}/{album}/{artist} - {title}' + #path = '/home/gu1ll4um3/github/SpotDL_Web/downloads' + #path = 'downloads/' + download_param_album = 'downloads/{artist}/{album}/{artist} - {title}' download_param_playlist = '{playlist}/{artists}/{album} - {title} {artist}' - os.chdir(f"{path}") - os.system(f'rm -rf *') + #os.chdir(f"{path}") + #os.system(f'rm -rf *') for url in urls: if url: if "album" in url: - os.system(f'python3 -m spotdl {url} --output "{download_param_album}"') + #os.system(f'python3 -m spotdl {url} --output "{download_param_album}"') + run(['python3', '-m', 'spotdl', url, '--output', download_param_album]) elif "playlist" in url: os.system(f'python3 -m spotdl {url} --output "{download_param_playlist}"') @@ -41,8 +44,12 @@ def index(): return render_template('erreur.html') urls = [url1, url2, url3, url4, url5] - result = process_file(urls) - return render_template('download_complete.html') + process_file(urls) + #print(resultProcessFile) + + with open('/home/gu1ll4um3/github/SpotDL_Web/erreurs.txt', 'r') as f: + result2 = f.readlines() + return render_template('download_complete.html', result2=result2) @app.route('/download', methods=['GET']) def download(): @@ -50,5 +57,12 @@ def download(): PATH='./downloads/musics.zip' return send_file(PATH,as_attachment=True) +# @app.route('/errors') +# def errors(): +# with open('erreurs.txt', 'r') as f: +# lines = f.readlines() +# return render_template('logs.html', lines=lines) + + if __name__ == '__main__': app.run(debug=True, port=3000) diff --git a/downloads/Flume/The Difference/Flume - The Difference.mp3 b/downloads/Flume/The Difference/Flume - The Difference.mp3 deleted file mode 100644 index 725487d..0000000 Binary files a/downloads/Flume/The Difference/Flume - The Difference.mp3 and /dev/null differ diff --git a/logs/erreurs.log b/logs/erreurs.log new file mode 100644 index 0000000..b635fbe --- /dev/null +++ b/logs/erreurs.log @@ -0,0 +1,3 @@ +Des erreurs se sont produites et la ou les piste(s) suivante(s) sont manquantes : + + Aldebert - La danse diff --git a/static/css/style.css b/static/css/style.css index 9671219..5e1e174 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -36,6 +36,12 @@ div { color: white } +.logs { + justify-content: center; + background-color: black; + color: white +} + input[type="submit"] { display: block; diff --git a/templates/download_complete.html b/templates/download_complete.html index 4ed471f..e5beb0b 100644 --- a/templates/download_complete.html +++ b/templates/download_complete.html @@ -9,4 +9,17 @@ + +
+

Fichier de texte

+
+ +
+ +
+ diff --git a/templates/logs.html b/templates/logs.html new file mode 100644 index 0000000..ce39a31 --- /dev/null +++ b/templates/logs.html @@ -0,0 +1,11 @@ + + Fichier de texte + + +

Fichier de texte

+ + diff --git a/templates/upload.html b/templates/upload.html index 532cf28..e671f03 100644 --- a/templates/upload.html +++ b/templates/upload.html @@ -15,7 +15,7 @@
- +