From 121da9eefd7416c4c084e060271960e422d36e13 Mon Sep 17 00:00:00 2001 From: Gu1llaum-3 Date: Sat, 31 Dec 2022 20:12:05 +0100 Subject: [PATCH] =?UTF-8?q?Nombreuses=20modifications=20au=20niveau=20du?= =?UTF-8?q?=20CSS=20ainsi=20que=20sur=20app.py=20c=C3=B4t=C3=A9=20chemins?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.py | 16 ++++-- static/css/style.css | 85 ++++++++++++++++++++++++++++++++ templates/download_complete.html | 6 +-- templates/test.html | 53 ++++++++++++++++++++ templates/upload.html | 22 ++++++--- 5 files changed, 168 insertions(+), 14 deletions(-) create mode 100644 templates/test.html diff --git a/app.py b/app.py index f2a6d76..0c79fe0 100644 --- a/app.py +++ b/app.py @@ -12,10 +12,10 @@ def process_file(urls): # path = os.path.expanduser('~/musics/downloads') #path = '/home/gu1ll4um3/github/SpotDL_Web/downloads' #path = 'downloads/' - download_param_album = 'downloads/{artist}/{album}/{artist} - {title}' + download_param_album = '{artist}/{album}/{artist} - {title}' download_param_playlist = '{playlist}/{artists}/{album} - {title} {artist}' - #os.chdir(f"{path}") + os.chdir('downloads') #os.system(f'rm -rf *') for url in urls: @@ -27,7 +27,8 @@ def process_file(urls): os.system(f'python3 -m spotdl {url} --output "{download_param_playlist}"') - os.system(f'zip -r musics.zip ./') + # os.system(f'zip -r musics.zip ./downloads') + run(['zip', '-r', 'musics.zip', '.']) @app.route('/', methods=['GET', 'POST']) def index(): @@ -47,14 +48,15 @@ def index(): process_file(urls) #print(resultProcessFile) - with open('/home/gu1ll4um3/github/SpotDL_Web/erreurs.txt', 'r') as f: + with open('/home/gu1ll4um3/github/SpotDL_Web/logs/erreurs.log', 'r') as f: result2 = f.readlines() return render_template('download_complete.html', result2=result2) @app.route('/download', methods=['GET']) def download(): # PATH='/home/gu1ll4um3/musics/downloads/musics.zip' - PATH='./downloads/musics.zip' + #os.chdir('downloads') + PATH='downloads/musics.zip' return send_file(PATH,as_attachment=True) # @app.route('/errors') @@ -63,6 +65,10 @@ def download(): # 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/static/css/style.css b/static/css/style.css index 5e1e174..935bc98 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -53,3 +53,88 @@ button { margin: 10px auto; } +/* .urlbox{ + font-size: 13px; + padding-left: 7px; + padding-right: 7px; + border-radius: 9px; + width:100%; + height:30px; +} */ + +/* .urlbox:empty { + border: 2px solid #999999; + font-size: 13px; + padding-left: 7px; + padding-right: 7px; + border-radius: 9px; + width:100%; + height:30px; +} + +.urlbox:valid:not(:placeholder-shown){ + border:rgb(24,216,96) 2px; + font-size: 13px; + padding-left: 7px; + padding-right: 7px; + border-radius: 9px; + width:100%; + height:30px; +} +.urlbox:invalid{ + border: red solid 2px; + font-size: 13px; + padding-left: 7px; + padding-right: 7px; + border-radius: 9px; + width:100%; + height:30px; +} */ + +.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; +} \ No newline at end of file diff --git a/templates/download_complete.html b/templates/download_complete.html index e5beb0b..f03fc5d 100644 --- a/templates/download_complete.html +++ b/templates/download_complete.html @@ -13,11 +13,11 @@

Fichier de texte

- +
diff --git a/templates/test.html b/templates/test.html new file mode 100644 index 0000000..7693af7 --- /dev/null +++ b/templates/test.html @@ -0,0 +1,53 @@ + + + + + + \ No newline at end of file diff --git a/templates/upload.html b/templates/upload.html index e671f03..72f8be8 100644 --- a/templates/upload.html +++ b/templates/upload.html @@ -15,31 +15,41 @@
- +
- +
- +
- +
- +
- + +