Compare commits
No commits in common. "bc4780190b97a7bbfb387ed3fd9cf7658cd64f8d" and "007416f1a9579aa7b3b3e754910839227bab6d49" have entirely different histories.
bc4780190b
...
007416f1a9
41
.drone.yml
41
.drone.yml
@ -29,7 +29,7 @@ steps:
|
|||||||
# auto_tag: true
|
# auto_tag: true
|
||||||
tags:
|
tags:
|
||||||
- latest
|
- latest
|
||||||
- v2.0.0
|
- v1.0.1
|
||||||
when:
|
when:
|
||||||
branch: main
|
branch: main
|
||||||
|
|
||||||
@ -41,7 +41,6 @@ steps:
|
|||||||
commands:
|
commands:
|
||||||
- curl -d "La pipeline a réussi" $NOTIFY_URL
|
- curl -d "La pipeline a réussi" $NOTIFY_URL
|
||||||
when:
|
when:
|
||||||
branch: main
|
|
||||||
status: [ success ]
|
status: [ success ]
|
||||||
|
|
||||||
- name: notify_failure
|
- name: notify_failure
|
||||||
@ -52,42 +51,4 @@ steps:
|
|||||||
commands:
|
commands:
|
||||||
- curl -d "La pipeline a échoué" $NOTIFY_URL
|
- curl -d "La pipeline a échoué" $NOTIFY_URL
|
||||||
when:
|
when:
|
||||||
branch: main
|
|
||||||
status: [failure]
|
|
||||||
|
|
||||||
- name: docker_dev_gitea
|
|
||||||
image: plugins/docker
|
|
||||||
settings:
|
|
||||||
username:
|
|
||||||
from_secret: docker_username
|
|
||||||
password:
|
|
||||||
from_secret: docker_password
|
|
||||||
repo: git.netpowa.fr/guillaume/spotdlweb
|
|
||||||
# auto_tag: true
|
|
||||||
registry: git.netpowa.fr
|
|
||||||
tags:
|
|
||||||
- beta
|
|
||||||
when:
|
|
||||||
branch: dev
|
|
||||||
|
|
||||||
- name: notify_dev_success
|
|
||||||
image: curlimages/curl
|
|
||||||
environment:
|
|
||||||
NOTIFY_URL:
|
|
||||||
from_secret: ntfy_url
|
|
||||||
commands:
|
|
||||||
- curl -d "La pipeline dev a réussi" $NOTIFY_URL
|
|
||||||
when:
|
|
||||||
branch: dev
|
|
||||||
status: [ success ]
|
|
||||||
|
|
||||||
- name: notify_dev_failure
|
|
||||||
image: curlimages/curl
|
|
||||||
environment:
|
|
||||||
NOTIFY_URL:
|
|
||||||
from_secret: ntfy_url
|
|
||||||
commands:
|
|
||||||
- curl -d "La pipeline dev a échoué" $NOTIFY_URL
|
|
||||||
when:
|
|
||||||
branch: dev
|
|
||||||
status: [failure]
|
status: [failure]
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,3 +1,2 @@
|
|||||||
__pycache__
|
__pycache__
|
||||||
downloads/
|
downloads/
|
||||||
temp/
|
|
54
app.py
54
app.py
@ -28,27 +28,6 @@ def process_file(urls):
|
|||||||
os.chdir('../')
|
os.chdir('../')
|
||||||
|
|
||||||
|
|
||||||
def process_file_local(urls):
|
|
||||||
download_param_album = '{artist}/{album}/{artist} - {title}'
|
|
||||||
download_param_playlist = '{playlist}/{artists}/{album} - {title} {artist}'
|
|
||||||
download_param_track = '{artist}/{album}/{artist} - {title}'
|
|
||||||
|
|
||||||
os.chdir('temp')
|
|
||||||
os.system(f'rm -rf *')
|
|
||||||
|
|
||||||
for url in urls:
|
|
||||||
if url:
|
|
||||||
if "album" in url:
|
|
||||||
run(['python3', '-m', 'spotdl', url, '--output', download_param_album])
|
|
||||||
elif "playlist" in url:
|
|
||||||
run(['python3', '-m', 'spotdl', url, '--output', download_param_playlist])
|
|
||||||
elif "track" in url:
|
|
||||||
run(['python3', '-m', 'spotdl', url, '--output', download_param_track])
|
|
||||||
|
|
||||||
run(['zip', '-r', 'musics.zip', '.'])
|
|
||||||
os.chdir('../')
|
|
||||||
|
|
||||||
|
|
||||||
@app.route('/', methods=['GET', 'POST'])
|
@app.route('/', methods=['GET', 'POST'])
|
||||||
def upload_form():
|
def upload_form():
|
||||||
return render_template('index.html')
|
return render_template('index.html')
|
||||||
@ -62,8 +41,12 @@ def upload_form():
|
|||||||
|
|
||||||
@app.route('/download', methods=['POST'])
|
@app.route('/download', methods=['POST'])
|
||||||
def download_file():
|
def download_file():
|
||||||
|
# votre code de téléchargement ici
|
||||||
|
# now = datetime.now()
|
||||||
|
# date_time = now.strftime("%Y-%m-%d %H-%M-%S")
|
||||||
|
# with open(f"file.txt", "w") as file:
|
||||||
|
# file.write(date_time)
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
action = request.form.get('action')
|
|
||||||
url1 = request.form['url1']
|
url1 = request.form['url1']
|
||||||
url2 = request.form['url2']
|
url2 = request.form['url2']
|
||||||
url3 = request.form['url3']
|
url3 = request.form['url3']
|
||||||
@ -74,31 +57,16 @@ def download_file():
|
|||||||
if not url1 and not url2 and not url3 :
|
if not url1 and not url2 and not url3 :
|
||||||
return render_template('erreur.html')
|
return render_template('erreur.html')
|
||||||
|
|
||||||
if action == 'download':
|
|
||||||
# Créer le dossier 'downloads' s'il n'existe pas
|
# Créer le dossier 'downloads' s'il n'existe pas
|
||||||
if not os.path.exists('downloads'):
|
if not os.path.exists('downloads'):
|
||||||
os.makedirs('downloads')
|
os.makedirs('downloads')
|
||||||
|
|
||||||
process_file(urls)
|
process_file(urls)
|
||||||
|
|
||||||
# path = "downloads/musics.zip"
|
# path = "downloads/musics.zip"
|
||||||
# return send_file(path, as_attachment=True)
|
# return send_file(path, as_attachment=True)
|
||||||
return render_template('finish_server.html')
|
return render_template('finish.html')
|
||||||
|
|
||||||
if action == 'downloadlocal':
|
|
||||||
|
|
||||||
# Créer le dossier 'downloads' s'il n'existe pas
|
|
||||||
if not os.path.exists('temp'):
|
|
||||||
os.makedirs('temp')
|
|
||||||
|
|
||||||
process_file_local(urls)
|
|
||||||
|
|
||||||
return render_template('finish_local.html')
|
|
||||||
|
|
||||||
@app.route('/zip', methods=['GET', 'POST'])
|
|
||||||
def zip():
|
|
||||||
path = "temp/musics.zip"
|
|
||||||
return send_file(path, as_attachment=True)
|
|
||||||
|
|
||||||
@app.errorhandler(404)
|
@app.errorhandler(404)
|
||||||
def page_not_found(error): # error est necessaire
|
def page_not_found(error): # error est necessaire
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
version: '3.3'
|
|
||||||
services:
|
|
||||||
spotdlweb:
|
|
||||||
image: gu1llaum3/spotdlweb:latest
|
|
||||||
container_name: spotdlweb
|
|
||||||
hostname: spotdlweb
|
|
||||||
ports:
|
|
||||||
- 3000:3000
|
|
||||||
volumes:
|
|
||||||
- ./musics:/app/downloads
|
|
||||||
restart: unless-stopped
|
|
@ -1,9 +1,6 @@
|
|||||||
function startDownload() {
|
function startDownload() {
|
||||||
document.getElementById('download-button').innerHTML = 'Téléchargement en cours...';
|
document.getElementById('download-button').innerHTML = 'Téléchargement en cours...';
|
||||||
}
|
}
|
||||||
function startLocalDownload() {
|
|
||||||
document.getElementById('downloadlocal-button').innerHTML = 'Téléchargement en cours...';
|
|
||||||
}
|
|
||||||
function refreshPage() {
|
function refreshPage() {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}
|
}
|
@ -1,19 +0,0 @@
|
|||||||
{% extends 'layout.html' %}
|
|
||||||
|
|
||||||
{% block body %}
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<div class="container">
|
|
||||||
<h1 class="title"> SpotDL Web </h1>
|
|
||||||
<h2>Votre musique est prête à être téléchargée</h2>
|
|
||||||
<button class="btn" onclick="window.location.href = '/zip';">Télécharger</button>
|
|
||||||
<button class="btn" onclick="window.location.href = '/';">Accueil</button>
|
|
||||||
|
|
||||||
{% if message %}
|
|
||||||
<p>{{ message }}</p>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
|
|
||||||
{% endblock body %}
|
|
@ -38,9 +38,8 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<input type="text" class="form-control" name="url5" id="url5" pattern="^https://open\.spotify\.com/(?:album|playlist|track)/[\w-]+(?:\?si=[\w-]+)?$" placeholder="Entrez l'URL d'une Piste, d'un Album ou d'une Playlist">
|
<input type="text" class="form-control" name="url5" id="url5" pattern="^https://open\.spotify\.com/(?:album|playlist|track)/[\w-]+(?:\?si=[\w-]+)?$" placeholder="Entrez l'URL d'une Piste, d'un Album ou d'une Playlist">
|
||||||
</div> -->
|
</div> -->
|
||||||
<button type="submit" class="btn" id="download-button" onclick="startDownload()" name="action" value="download">Télécharger sur le serveur</button>
|
<button type="submit" class="btn" id="download-button" onclick="startDownload()">Télécharger</button>
|
||||||
<button type="submit" class="btn" id="downloadlocal-button" onclick="startLocalDownload()" name="action" value="downloadlocal">Télécharger en local</button>
|
<button type="reset" class="btn" id="refresh-button" onclick="refreshPage()">Rafraîchir</button>
|
||||||
<!-- <button type="reset" class="btn" id="refresh-button" onclick="refreshPage()">Rafraîchir</button> -->
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user