diff --git a/.gitignore b/.gitignore index d29e7a9..607ae2a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ # Ignore dossier docker -Docker +Docker/* # Ignorer ce qu'il y a dans downloads downloads/* diff --git a/.old/app.py b/.old/app.py deleted file mode 100644 index b28c70c..0000000 --- a/.old/app.py +++ /dev/null @@ -1,82 +0,0 @@ -from flask import Flask, request, redirect, url_for, send_file, render_template -from subprocess import run -import os -import logging - -app = Flask(__name__) - -@app.route('/') -def upload_form(): - return render_template('upload.html') - -def process_file(urls): - # path = os.path.expanduser('~/musics/downloads') - #path = '/home/gu1ll4um3/github/SpotDL_Web/downloads' - #path = 'downloads/' - download_param_album = '{artist}/{album}/{artist} - {title}' - download_param_playlist = '{playlist}/{artists}/{album} - {title} {artist}' - - os.chdir('downloads') - #os.system(f'rm -rf *') - - logs = [] # Créer une liste vide pour stocker les logs - for url in urls: - if url: - if "album" in url: - #os.system(f'python3 -m spotdl {url} --output "{download_param_album}"') - run(['python3', '-m', 'spotdl', url, '--output', download_param_album]) - logs.append(f'Téléchargement de l album à l\'adresse {url}') - elif "playlist" in url: - os.system(f'python3 -m spotdl {url} --output "{download_param_playlist}"') - logs.append(f'Téléchargement de la playlist à l\'adresse {url}') - - # os.system(f'zip -r musics.zip ./downloads') - run(['zip', '-r', 'musics.zip', '.']) - logs.append(f'Création du fichier ZIP musics.zip') - - return logs # Retourner la liste des logs - -@app.route('/', methods=['GET', 'POST']) -def index(): - message = None - if request.method == 'POST': - url1 = request.form['url1'] - url2 = request.form['url2'] - url3 = request.form['url3'] - url4 = request.form['url4'] - url5 = request.form['url5'] - - # Vérifier si au moins un champ est vide - if not url1 and not url2 and not url3 and not url4 and not url5: - return render_template('erreur.html') - - urls = [url1, url2, url3, url4, url5] - logs = process_file(urls) - #process_file(urls) - #print(resultProcessFile) - - with open('/home/gu1ll4um3/github/SpotDL_Web/logs/erreurs.log', 'r') as f: - result2 = f.readlines() - return render_template('download_complete.html', logs=logs) - #return render_template('download_complete.html', result2=result2) - -@app.route('/download', methods=['GET']) -def download(): - # PATH='/home/gu1ll4um3/musics/downloads/musics.zip' - #os.chdir('downloads') - 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) - -@app.route('/test') -def test(): - return render_template('test.html') - - -if __name__ == '__main__': - app.run(debug=True, port=3000) diff --git a/.old/logs/erreurs.log b/.old/logs/erreurs.log deleted file mode 100644 index b635fbe..0000000 --- a/.old/logs/erreurs.log +++ /dev/null @@ -1,3 +0,0 @@ -Des erreurs se sont produites et la ou les piste(s) suivante(s) sont manquantes : - - Aldebert - La danse[0m diff --git a/.old/static/css/style.css b/.old/static/css/style.css deleted file mode 100644 index 0defc8c..0000000 --- a/.old/static/css/style.css +++ /dev/null @@ -1,72 +0,0 @@ -body{ - display: flex; - justify-content: center; - align-items: center; - - background-color: black; -} - -.erreur { - display: flex; - justify-content: center; - align-items: center; - flex-direction: column; -} - -.download_complete { - display: flex; - justify-content: center; - align-items: center; - flex-direction: column; -} - -.all { - align-items: center; - flex-direction: column; -} - -.titre{ - display: flex; - justify-content: center; - color: rgb(24,216,96); - /* align-items: center; */ -} - -.procedure { - display: flex; - justify-content: center; - flex-direction: column; - text-align: center; -} - -h2, a { - color: white; -} - -.url { - display: block; - justify-content:center; - width: auto; - flex: 1 1 0; - /* align-items: center; */ -} - -.urlbox { - display: block; - /* align-items: flex-start; */ - flex: 1 1 0; - width: 225; -} - -form { - display: flex ; - justify-content: center; - align-items: center; - flex-direction: column; - width : auto ; -} - -button { - display: block; - margin: 10px auto; - } \ No newline at end of file diff --git a/.old/static/css/style.css.old b/.old/static/css/style.css.old deleted file mode 100644 index d3aaca4..0000000 --- a/.old/static/css/style.css.old +++ /dev/null @@ -1,208 +0,0 @@ -@media (max-width: 600px) { - .urlbox { - /* les styles pour les appareils mobiles vont ici */ - width: 100%; /* étend l'élément sur toute la largeur de l'écran */ - } -} - -@media (min-width: 601px) and (max-width: 900px) { - .urlbox { - /* les styles pour les tablettes vont ici */ - width: 50%; /* étend l'élément sur la moitié de la largeur de l'écran */ - } -} - -@media (min-width: 901px) { - .urlbox { - /* les styles pour les écrans de bureau vont ici */ - width: 25%; /* étend l'élément sur un quart de la largeur de l'écran */ - } -} - -body { - background-color: black; -} - -h1 { - /* border: 2px #eee solid; */ - color: rgb(24,216,96); - background-color: black; - text-align: center; - padding: 10px; -} - -h2 { - text-align: center; - margin: auto; - padding: 10px; - color: white; -} - -.url { - display: flex; - justify-content: center; - align-items: center; - /* min-height:100%; */ - background-color: black; - color: white -} - -div { - display: flex; - justify-content: center; - /* align-items: center; */ - /* min-height:100%; */ - background-color: black; - color: white -} - -.logs { - justify-content: center; - background-color: black; - color: white -} - - -input[type="submit"] { - display: block; - margin: auto; -} - -button { - display: block; - margin: 10px auto; - } - -.urlbox:empty { - border: 2px solid grey; - font-size: 13px; - padding-left: 7px; - padding-right: 7px; - border-radius: 9px; - width:100%; - height:30px; - - -} -.urlbox:valid:not(:placeholder-shown) { - border: 2px solid rgb(24,216,96); - font-size: 13px; - padding-left: 7px; - padding-right: 7px; - border-radius: 9px; - width:100%; - height:30px; - } -.urlbox:invalid { - border: 2px solid red; - font-size: 13px; - padding-left: 7px; - padding-right: 7px; - border-radius: 9px; - width:100%; - height:30px; -} - - - -button{ - /* margin-right: 0px; */ - height: 30px; - width:130px; - border-radius: 5px ; - border: none; - /* float: right; */ - background-color: #ddd; - font-weight: bold; -} - -button:hover{ - background-color: rgb(24,216,96); - color: white; -} - -@media (max-width: 600px) { - body { - background-color: black; - } - - h1 { - color: rgb(24,216,96); - background-color: black; - text-align: center; - padding: 10px; - } - - h2 { - text-align: center; - margin: auto; - padding: 10px; - color: white; - } - - .url { - display: flex; - justify-content: center; - align-items: center; - background-color: black; - color: white; - } - - div { - display: flex; - justify-content: center; - background-color: black; - color: white; - } - - .logs { - justify-content: center; - background-color: black; - color: white; - } - - input[type="submit"] { - display: block; - margin: auto; - } - - button { - display: block; - margin: 10px auto; - } - - .urlbox { - border: 2px solid grey; - font-size: 13px; - padding: 7px; - border-radius: 9px; - width: 100%; - height: 30px; - box-sizing: border-box; - } - - .urlbox:valid:not(:placeholder-shown) { - border: 2px solid rgb(24,216,96); - } - - .urlbox:invalid { - border: 2px solid red; - } - - button { - height: 30px; - width: 130px; - border-radius: 5px; - border: none; - background-color: #ddd; - font-weight: bold; - box-sizing: border-box; - } - - button:hover { - background-color: rgb(24,216,96); - color: white; - } -} - - diff --git a/.old/static/css/style.css.old2 b/.old/static/css/style.css.old2 deleted file mode 100644 index 73305ad..0000000 --- a/.old/static/css/style.css.old2 +++ /dev/null @@ -1,191 +0,0 @@ -/* Mise en forme générale */ -body { - background-color: black; - } - - /* Titre principal */ - h1 { - color: rgb(24,216,96); - background-color: black; - text-align: center; - padding: 10px; - margin-top: 10px; - } - - /* Titre secondaire */ - h2 { - text-align: center; - margin: auto; - padding: 10px; - color: white; - } - - /* Conteneur principal */ - .url { - display: flex; - flex-direction: column; - align-items: center; - background-color: black; - color: white; - } - - /* Conteneurs secondaires */ - div { - display: flex; - flex-direction: column; - align-items: center; - background-color: black; - color: white; - } - - /* Conteneur des logs */ - .logs { - display: flex; - flex-direction: column; - align-items: center; - background-color: black; - color: white; - } - - /* Bouton de soumission du formulaire */ - input[type="submit"] { - display: block; - margin: auto; - } - - /* Bouton générique */ - button { - display: block; - margin: 10px auto; - } - - /* Champ de saisie de l'URL */ - .urlbox:empty { - border: 2px solid grey; - font-size: 13px; - padding-left: 7px; - padding-right: 7px; - border-radius: 9px; - height: 30px; - /* width: 150; */ - } - .urlbox:valid:not(:placeholder-shown) { - border: 2px solid rgb(24,216,96); - font-size: 13px; - padding-left: 7px; - padding-right: 7px; - border-radius: 9px; - /* width: 150%; */ - height: 30px; - } - .urlbox:invalid { - border: 2px solid red; - font-size: 13px; - padding-left: 7px; - padding-right: 7px; - border-radius: 9px; - /* width: 150%; */ - height: 30px; - } - - /* Bouton de téléchargement */ - button { - height: 30px; - width: 130px; - border-radius: 5px; - border: none; - background-color: #ddd; - font-weight: bold; - } - - button:hover { - background-color: rgb(24,216,96); - color: white; - } - - /* Mise en forme pour écrans de smartphone */ -@media only screen and (max-width: 480px) { - /* Titre principal */ - h1 { - font-size: 18px; - } - - /* Titre secondaire */ - h2 { - font-size: 14px; - } - - /* Conteneur principal */ - .url { - padding: 0 5px; - } - - /* Champ de saisie de l'URL */ - .urlbox { - width: 150%; - padding: 0 10%; - } - - /* Bouton de téléchargement */ - button { - width: 80%; - } - } - - /* Mise en forme pour écrans de tablette */ - @media only screen and (min-width: 481px) and (max-width: 768px) { - /* Titre principal */ - h1 { - font-size: 22px; - } - - /* Titre secondaire */ - h2 { - font-size: 16px; - } - - /* Conteneur principal */ - .url { - padding: 0 10px; - } - - /* Champ de saisie de l'URL */ - .urlbox { - width: 150%; - } - - /* Bouton de téléchargement */ - button { - width: 80%; - } - } - - /* Mise en forme pour écrans d'ordinateur */ - @media only screen and (min-width: 769px) { - /* Titre principal */ - h1 { - font-size: 28px; - } - - /* Titre secondaire */ - h2 { - font-size: 20px; - } - - /* Conteneur principal */ - .url { - padding: 0 20px; - } - - /* Champ de saisie de l'URL */ - .urlbox { - width: 200%; - } - - /* Bouton de téléchargement */ - button { - width: 80%; - } - } - - \ No newline at end of file diff --git a/.old/templates/download_complete.html b/.old/templates/download_complete.html deleted file mode 100644 index 68ceaba..0000000 --- a/.old/templates/download_complete.html +++ /dev/null @@ -1,34 +0,0 @@ -
- - -{{ message }}
- {% endif %} -{{ log }}
- {% endfor %} -{{ message }}
- {% endif %} -{{ message }}
+ {% endif %} +