Ajout update nextcloud file index
This commit is contained in:
@@ -56,4 +56,25 @@ quality = mp3
|
|||||||
; command = /home/kmille/projects/deezer-downloader/app/venv/bin/yt-dlp
|
; command = /home/kmille/projects/deezer-downloader/app/venv/bin/yt-dlp
|
||||||
command = /usr/bin/yt-dlp
|
command = /usr/bin/yt-dlp
|
||||||
|
|
||||||
|
|
||||||
|
[nextcloud]
|
||||||
|
; Your nextcloud public key for decrypt jwt token
|
||||||
|
public_key = -----BEGIN PUBLIC KEY-----
|
||||||
|
...
|
||||||
|
-----END PUBLIC KEY-----
|
||||||
|
; Your key to added from nextcloud ExternalApp exp: /?jwt={jwt}
|
||||||
|
jwt_name_parameter = jwt
|
||||||
|
|
||||||
|
[nextcloud_ssh_scan_files]
|
||||||
|
; ip from nextcloud server
|
||||||
|
host = 192.168.10.9
|
||||||
|
; port ssh from nextcloud server
|
||||||
|
port = 22
|
||||||
|
; username ssh nextcloud server
|
||||||
|
username = nextclouddeezer
|
||||||
|
; password ssh nextcloud server
|
||||||
|
password = Q8QbqQru3hRc16vK
|
||||||
|
; occ path nextcloud server
|
||||||
|
occ_path = /var/www/nextcloud/occ
|
||||||
|
|
||||||
; vim: syntax=dosini
|
; vim: syntax=dosini
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ from mutagen.flac import FLAC, Picture
|
|||||||
from mutagen.mp3 import MP3
|
from mutagen.mp3 import MP3
|
||||||
from mutagen.id3 import PictureType, TIT2, TALB, TPE1, TRCK, TDRC, TPOS, APIC, TPE2
|
from mutagen.id3 import PictureType, TIT2, TALB, TPE1, TRCK, TDRC, TPOS, APIC, TPE2
|
||||||
from mutagen import MutagenError
|
from mutagen import MutagenError
|
||||||
from deezer_downloader.update_nextcloud_files import call_scan
|
|
||||||
|
|
||||||
|
|
||||||
# BEGIN TYPES
|
# BEGIN TYPES
|
||||||
@@ -246,7 +245,6 @@ def download_song(song: dict, output_file: str) -> None:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise DeezerApiException(f"Could not write song to disk: {e}") from e
|
raise DeezerApiException(f"Could not write song to disk: {e}") from e
|
||||||
|
|
||||||
call_scan(output_file)
|
|
||||||
print("Download finished: {}".format(output_file))
|
print("Download finished: {}".format(output_file))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -45,25 +45,13 @@ def addJwtInUserSession(request):
|
|||||||
print("UID:", uid)
|
print("UID:", uid)
|
||||||
print("Display Name:", display_name)
|
print("Display Name:", display_name)
|
||||||
|
|
||||||
#base_dir_user = base_dir.format(user=uid)
|
|
||||||
#config["download_dirs"]["base"] = base_dir_user
|
|
||||||
|
|
||||||
session['user_uid'] = uid
|
session['user_uid'] = uid
|
||||||
session['user_email'] = email
|
session['user_email'] = email
|
||||||
session['user_displayName'] = display_name
|
session['user_displayName'] = display_name
|
||||||
session['user_base_dir'] = config["download_dirs"]["base"] + "\\" + uid
|
session['user_base_dir'] = config["download_dirs"]["base"]
|
||||||
#createDownloadDirectoriesIfNotExist()
|
|
||||||
|
|
||||||
print(f"✅ Download base dir set to: {session['user_base_dir']}")
|
print(f"✅ Download base dir set to: {session['user_base_dir']}")
|
||||||
except ExpiredSignatureError:
|
except ExpiredSignatureError:
|
||||||
return jsonify({"error": "Token expired"}), 401
|
abort(403)
|
||||||
except InvalidTokenError as e:
|
except InvalidTokenError as e:
|
||||||
print("❌ Erreur de validation du token :", e)
|
print("❌ Erreur de validation du token :", e)
|
||||||
|
|
||||||
def createDownloadDirectoriesIfNotExist():
|
|
||||||
os.makedirs(config["download_dirs"]["base"], exist_ok=True)
|
|
||||||
os.makedirs(config["download_dirs"]["songs"], exist_ok=True)
|
|
||||||
os.makedirs(config["download_dirs"]["albums"], exist_ok=True)
|
|
||||||
os.makedirs(config["download_dirs"]["zips"], exist_ok=True)
|
|
||||||
os.makedirs(config["download_dirs"]["playlists"], exist_ok=True)
|
|
||||||
os.makedirs(config["download_dirs"]["youtubedl"], exist_ok=True)
|
|
||||||
@@ -11,8 +11,10 @@ def call_scan(directory_path):
|
|||||||
password = config['nextcloud_ssh_scan_files']['password']
|
password = config['nextcloud_ssh_scan_files']['password']
|
||||||
occCmd= config['nextcloud_ssh_scan_files']['occ_path']
|
occCmd= config['nextcloud_ssh_scan_files']['occ_path']
|
||||||
|
|
||||||
|
if isinstance(directory_path, (list, tuple)) and all(isinstance(x, str) for x in directory_path):
|
||||||
|
directory_path = directory_path[0]
|
||||||
directory_path = os.path.dirname(directory_path)
|
directory_path = os.path.dirname(directory_path)
|
||||||
directory_path = directory_path.replace(config['download_dirs']['base'] + "\\", "")
|
directory_path = directory_path.replace(config['download_dirs']['base'], "").lstrip("/\\")
|
||||||
print("Path Nexcloud Scan " + directory_path)
|
print("Path Nexcloud Scan " + directory_path)
|
||||||
|
|
||||||
# Commande à exécuter
|
# Commande à exécuter
|
||||||
|
|||||||
@@ -4,14 +4,14 @@ from subprocess import Popen, PIPE
|
|||||||
from functools import wraps
|
from functools import wraps
|
||||||
import requests
|
import requests
|
||||||
import atexit
|
import atexit
|
||||||
from flask import Flask, render_template, request, jsonify, session, make_response
|
from flask import Flask, render_template, request, jsonify, session
|
||||||
from markupsafe import escape
|
from markupsafe import escape
|
||||||
from flask_autoindex import AutoIndex
|
from flask_autoindex import AutoIndex
|
||||||
import warnings
|
import warnings
|
||||||
import giphypop
|
import giphypop
|
||||||
|
|
||||||
from deezer_downloader.configuration import config
|
from deezer_downloader.configuration import config
|
||||||
from deezer_downloader.web.music_backend import sched, check_and_set_download_dirs_exist
|
from deezer_downloader.web.music_backend import sched
|
||||||
from deezer_downloader.deezer import deezer_search, init_deezer_session
|
from deezer_downloader.deezer import deezer_search, init_deezer_session
|
||||||
from deezer_downloader.nextcloud import addJwtInUserSession
|
from deezer_downloader.nextcloud import addJwtInUserSession
|
||||||
|
|
||||||
@@ -173,18 +173,19 @@ def deezer_download_song_or_album():
|
|||||||
add_to_playlist: True|False (add to mpd playlist)
|
add_to_playlist: True|False (add to mpd playlist)
|
||||||
create_zip: True|False (create a zip for the album)
|
create_zip: True|False (create a zip for the album)
|
||||||
"""
|
"""
|
||||||
check_and_set_download_dirs_exist()
|
|
||||||
user_input = request.get_json(force=True)
|
user_input = request.get_json(force=True)
|
||||||
desc = "Downloading {}".format(user_input['type'])
|
desc = "Downloading {}".format(user_input['type'])
|
||||||
if user_input['type'] == "track":
|
if user_input['type'] == "track":
|
||||||
task = sched.enqueue_task(desc, "download_deezer_song_and_queue",
|
task = sched.enqueue_task(desc, "download_deezer_song_and_queue",
|
||||||
track_id=user_input['music_id'],
|
track_id=user_input['music_id'],
|
||||||
add_to_playlist=user_input['add_to_playlist'])
|
add_to_playlist=user_input['add_to_playlist'],
|
||||||
|
uid_user=session['user_uid'])
|
||||||
else:
|
else:
|
||||||
task = sched.enqueue_task(desc, "download_deezer_album_and_queue_and_zip",
|
task = sched.enqueue_task(desc, "download_deezer_album_and_queue_and_zip",
|
||||||
album_id=user_input['music_id'],
|
album_id=user_input['music_id'],
|
||||||
add_to_playlist=user_input['add_to_playlist'],
|
add_to_playlist=user_input['add_to_playlist'],
|
||||||
create_zip=user_input['create_zip'])
|
create_zip=user_input['create_zip'],
|
||||||
|
uid_user=session['user_uid'])
|
||||||
return jsonify({"task_id": id(task), })
|
return jsonify({"task_id": id(task), })
|
||||||
|
|
||||||
|
|
||||||
@@ -201,7 +202,8 @@ def youtubedl_download():
|
|||||||
desc = "Downloading via youtube-dl"
|
desc = "Downloading via youtube-dl"
|
||||||
task = sched.enqueue_task(desc, "download_youtubedl_and_queue",
|
task = sched.enqueue_task(desc, "download_youtubedl_and_queue",
|
||||||
video_url=user_input['url'],
|
video_url=user_input['url'],
|
||||||
add_to_playlist=user_input['add_to_playlist'])
|
add_to_playlist=user_input['add_to_playlist'],
|
||||||
|
uid_user=session['user_uid'])
|
||||||
return jsonify({"task_id": id(task), })
|
return jsonify({"task_id": id(task), })
|
||||||
|
|
||||||
|
|
||||||
@@ -221,7 +223,8 @@ def deezer_playlist_download():
|
|||||||
task = sched.enqueue_task(desc, "download_deezer_playlist_and_queue_and_zip",
|
task = sched.enqueue_task(desc, "download_deezer_playlist_and_queue_and_zip",
|
||||||
playlist_id=user_input['playlist_url'],
|
playlist_id=user_input['playlist_url'],
|
||||||
add_to_playlist=user_input['add_to_playlist'],
|
add_to_playlist=user_input['add_to_playlist'],
|
||||||
create_zip=user_input['create_zip'])
|
create_zip=user_input['create_zip'],
|
||||||
|
uid_user=session['user_uid'])
|
||||||
return jsonify({"task_id": id(task), })
|
return jsonify({"task_id": id(task), })
|
||||||
|
|
||||||
|
|
||||||
@@ -244,7 +247,8 @@ def spotify_playlist_download():
|
|||||||
playlist_name=user_input['playlist_name'],
|
playlist_name=user_input['playlist_name'],
|
||||||
playlist_id=user_input['playlist_url'],
|
playlist_id=user_input['playlist_url'],
|
||||||
add_to_playlist=user_input['add_to_playlist'],
|
add_to_playlist=user_input['add_to_playlist'],
|
||||||
create_zip=user_input['create_zip'])
|
create_zip=user_input['create_zip'],
|
||||||
|
uid_user=session['user_uid'])
|
||||||
return jsonify({"task_id": id(task), })
|
return jsonify({"task_id": id(task), })
|
||||||
|
|
||||||
|
|
||||||
@@ -265,5 +269,6 @@ def deezer_favorites_download():
|
|||||||
task = sched.enqueue_task(desc, "download_deezer_favorites",
|
task = sched.enqueue_task(desc, "download_deezer_favorites",
|
||||||
user_id=user_input['user_id'],
|
user_id=user_input['user_id'],
|
||||||
add_to_playlist=user_input['add_to_playlist'],
|
add_to_playlist=user_input['add_to_playlist'],
|
||||||
create_zip=user_input['create_zip'])
|
create_zip=user_input['create_zip'],
|
||||||
|
uid_user=session['user_uid'])
|
||||||
return jsonify({"task_id": id(task), })
|
return jsonify({"task_id": id(task), })
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ from os.path import basename
|
|||||||
import mpd
|
import mpd
|
||||||
import platform
|
import platform
|
||||||
from zipfile import ZipFile, ZIP_DEFLATED
|
from zipfile import ZipFile, ZIP_DEFLATED
|
||||||
from flask import session
|
|
||||||
|
|
||||||
|
from deezer_downloader.update_nextcloud_files import call_scan
|
||||||
from deezer_downloader.configuration import config
|
from deezer_downloader.configuration import config
|
||||||
from deezer_downloader.youtubedl import youtubedl_download
|
from deezer_downloader.youtubedl import youtubedl_download
|
||||||
from deezer_downloader.spotify import get_songs_from_spotify_website
|
from deezer_downloader.spotify import get_songs_from_spotify_website
|
||||||
@@ -17,16 +17,17 @@ from deezer_downloader.threadpool_queue import ThreadpoolScheduler, report_progr
|
|||||||
sched = ThreadpoolScheduler()
|
sched = ThreadpoolScheduler()
|
||||||
|
|
||||||
|
|
||||||
def check_and_set_download_dirs_exist():
|
def check_and_set_download_dirs_exist(uid_user):
|
||||||
config["download_dirs"]["songs"] = os.path.join(session['user_base_dir'], "DeezerDownload", "songs")
|
config["download_dirs"]["songs"] = config["download_dirs"]["songs"].format(uid=uid_user)
|
||||||
config["download_dirs"]["zips"] = os.path.join(session['user_base_dir'], "DeezerDownload","zips")
|
config["download_dirs"]["zips"] = config["download_dirs"]["zips"].format(uid=uid_user)
|
||||||
config["download_dirs"]["albums"] = os.path.join(session['user_base_dir'], "DeezerDownload","albums")
|
config["download_dirs"]["albums"] = config["download_dirs"]["albums"].format(uid=uid_user)
|
||||||
config["download_dirs"]["playlists"] = os.path.join(session['user_base_dir'], "DeezerDownload","playlists")
|
config["download_dirs"]["playlists"] = config["download_dirs"]["playlists"].format(uid=uid_user)
|
||||||
config["download_dirs"]["youtubedl"] = os.path.join(session['user_base_dir'], "DeezerDownload","youtubedl")
|
config["download_dirs"]["youtubedl"] = config["download_dirs"]["youtubedl"].format(uid=uid_user)
|
||||||
for directory in [config["download_dirs"]["songs"], config["download_dirs"]["zips"], config["download_dirs"]["albums"],
|
for directory in [config["download_dirs"]["songs"], config["download_dirs"]["zips"], config["download_dirs"]["albums"],
|
||||||
config["download_dirs"]["playlists"], config["download_dirs"]["youtubedl"]]:
|
config["download_dirs"]["playlists"], config["download_dirs"]["youtubedl"]]:
|
||||||
os.makedirs(directory, exist_ok=True)
|
os.makedirs(directory, exist_ok=True)
|
||||||
|
|
||||||
|
|
||||||
def make_song_paths_relative_to_mpd_root(songs, prefix=""):
|
def make_song_paths_relative_to_mpd_root(songs, prefix=""):
|
||||||
# ensure last slash
|
# ensure last slash
|
||||||
config["mpd"]["music_dir_root"] = os.path.join(config["mpd"]["music_dir_root"], '')
|
config["mpd"]["music_dir_root"] = os.path.join(config["mpd"]["music_dir_root"], '')
|
||||||
@@ -118,7 +119,8 @@ def download_song_and_get_absolute_filename(search_type, song, playlist_name=Non
|
|||||||
return absolute_filename
|
return absolute_filename
|
||||||
|
|
||||||
|
|
||||||
def create_zip_file(songs_absolute_location):
|
def create_zip_file(songs_absolute_location, uid_user):
|
||||||
|
check_and_set_download_dirs_exist(uid_user)
|
||||||
# take first song in list and take the parent dir (name of album/playlist")
|
# take first song in list and take the parent dir (name of album/playlist")
|
||||||
parent_dir = basename(os.path.dirname(songs_absolute_location[0]))
|
parent_dir = basename(os.path.dirname(songs_absolute_location[0]))
|
||||||
location_zip_file = os.path.join(config["download_dirs"]["zips"], "{}.zip".format(parent_dir))
|
location_zip_file = os.path.join(config["download_dirs"]["zips"], "{}.zip".format(parent_dir))
|
||||||
@@ -130,6 +132,7 @@ def create_zip_file(songs_absolute_location):
|
|||||||
zip.write(song_location, arcname=os.path.join(parent_dir, basename(song_location)))
|
zip.write(song_location, arcname=os.path.join(parent_dir, basename(song_location)))
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
print("Could not find file '{}'".format(song_location))
|
print("Could not find file '{}'".format(song_location))
|
||||||
|
call_scan(location_zip_file)
|
||||||
print("Done with the zip")
|
print("Done with the zip")
|
||||||
return location_zip_file
|
return location_zip_file
|
||||||
|
|
||||||
@@ -150,10 +153,12 @@ def create_m3u8_file(songs_absolute_location):
|
|||||||
|
|
||||||
|
|
||||||
@sched.register_command()
|
@sched.register_command()
|
||||||
def download_deezer_song_and_queue(track_id, add_to_playlist):
|
def download_deezer_song_and_queue(track_id, add_to_playlist, uid_user):
|
||||||
|
check_and_set_download_dirs_exist(uid_user)
|
||||||
song = get_song_infos_from_deezer_website(TYPE_TRACK, track_id)
|
song = get_song_infos_from_deezer_website(TYPE_TRACK, track_id)
|
||||||
try:
|
try:
|
||||||
absolute_filename = download_song_and_get_absolute_filename(TYPE_TRACK, song)
|
absolute_filename = download_song_and_get_absolute_filename(TYPE_TRACK, song)
|
||||||
|
call_scan(absolute_filename)
|
||||||
update_mpd_db(absolute_filename, add_to_playlist)
|
update_mpd_db(absolute_filename, add_to_playlist)
|
||||||
return make_song_paths_relative_to_mpd_root([absolute_filename])
|
return make_song_paths_relative_to_mpd_root([absolute_filename])
|
||||||
except DeezerApiException:
|
except DeezerApiException:
|
||||||
@@ -162,7 +167,8 @@ def download_deezer_song_and_queue(track_id, add_to_playlist):
|
|||||||
|
|
||||||
|
|
||||||
@sched.register_command()
|
@sched.register_command()
|
||||||
def download_deezer_album_and_queue_and_zip(album_id, add_to_playlist, create_zip):
|
def download_deezer_album_and_queue_and_zip(album_id, add_to_playlist, create_zip, uid_user):
|
||||||
|
check_and_set_download_dirs_exist(uid_user)
|
||||||
songs = get_song_infos_from_deezer_website(TYPE_ALBUM, album_id)
|
songs = get_song_infos_from_deezer_website(TYPE_ALBUM, album_id)
|
||||||
songs_absolute_location = []
|
songs_absolute_location = []
|
||||||
for i, song in enumerate(songs):
|
for i, song in enumerate(songs):
|
||||||
@@ -173,14 +179,16 @@ def download_deezer_album_and_queue_and_zip(album_id, add_to_playlist, create_zi
|
|||||||
songs_absolute_location.append(absolute_filename)
|
songs_absolute_location.append(absolute_filename)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Warning: {e}. Continuing with album...")
|
print(f"Warning: {e}. Continuing with album...")
|
||||||
|
call_scan(songs_absolute_location)
|
||||||
update_mpd_db(songs_absolute_location, add_to_playlist)
|
update_mpd_db(songs_absolute_location, add_to_playlist)
|
||||||
if create_zip:
|
if create_zip:
|
||||||
return [create_zip_file(songs_absolute_location)]
|
return [create_zip_file(songs_absolute_location, uid_user)]
|
||||||
return make_song_paths_relative_to_mpd_root(songs_absolute_location)
|
return make_song_paths_relative_to_mpd_root(songs_absolute_location)
|
||||||
|
|
||||||
|
|
||||||
@sched.register_command()
|
@sched.register_command()
|
||||||
def download_deezer_playlist_and_queue_and_zip(playlist_id, add_to_playlist, create_zip):
|
def download_deezer_playlist_and_queue_and_zip(playlist_id, add_to_playlist, create_zip, uid_user):
|
||||||
|
check_and_set_download_dirs_exist(uid_user)
|
||||||
playlist_name, songs = parse_deezer_playlist(playlist_id)
|
playlist_name, songs = parse_deezer_playlist(playlist_id)
|
||||||
songs_absolute_location = []
|
songs_absolute_location = []
|
||||||
for i, song in enumerate(songs):
|
for i, song in enumerate(songs):
|
||||||
@@ -192,13 +200,15 @@ def download_deezer_playlist_and_queue_and_zip(playlist_id, add_to_playlist, cre
|
|||||||
print(f"Warning: {e}. Continuing with playlist...")
|
print(f"Warning: {e}. Continuing with playlist...")
|
||||||
update_mpd_db(songs_absolute_location, add_to_playlist)
|
update_mpd_db(songs_absolute_location, add_to_playlist)
|
||||||
songs_with_m3u8_file = create_m3u8_file(songs_absolute_location)
|
songs_with_m3u8_file = create_m3u8_file(songs_absolute_location)
|
||||||
|
call_scan(songs_absolute_location)
|
||||||
if create_zip:
|
if create_zip:
|
||||||
return [create_zip_file(songs_with_m3u8_file)]
|
return [create_zip_file(songs_with_m3u8_file, uid_user)]
|
||||||
return make_song_paths_relative_to_mpd_root(songs_absolute_location)
|
return make_song_paths_relative_to_mpd_root(songs_absolute_location)
|
||||||
|
|
||||||
|
|
||||||
@sched.register_command()
|
@sched.register_command()
|
||||||
def download_spotify_playlist_and_queue_and_zip(playlist_name, playlist_id, add_to_playlist, create_zip):
|
def download_spotify_playlist_and_queue_and_zip(playlist_name, playlist_id, add_to_playlist, create_zip, uid_user):
|
||||||
|
check_and_set_download_dirs_exist(uid_user)
|
||||||
songs = get_songs_from_spotify_website(playlist_id,
|
songs = get_songs_from_spotify_website(playlist_id,
|
||||||
config["proxy"]["server"])
|
config["proxy"]["server"])
|
||||||
songs_absolute_location = []
|
songs_absolute_location = []
|
||||||
@@ -215,22 +225,26 @@ def download_spotify_playlist_and_queue_and_zip(playlist_name, playlist_id, add_
|
|||||||
print(f"Warning: Could not download Spotify song ({song_of_playlist}) on Deezer: {e}")
|
print(f"Warning: Could not download Spotify song ({song_of_playlist}) on Deezer: {e}")
|
||||||
update_mpd_db(songs_absolute_location, add_to_playlist)
|
update_mpd_db(songs_absolute_location, add_to_playlist)
|
||||||
songs_with_m3u8_file = create_m3u8_file(songs_absolute_location)
|
songs_with_m3u8_file = create_m3u8_file(songs_absolute_location)
|
||||||
|
call_scan(songs_absolute_location)
|
||||||
if create_zip:
|
if create_zip:
|
||||||
return [create_zip_file(songs_with_m3u8_file)]
|
return [create_zip_file(songs_with_m3u8_file, uid_user)]
|
||||||
return make_song_paths_relative_to_mpd_root(songs_absolute_location)
|
return make_song_paths_relative_to_mpd_root(songs_absolute_location)
|
||||||
|
|
||||||
|
|
||||||
@sched.register_command()
|
@sched.register_command()
|
||||||
def download_youtubedl_and_queue(video_url, add_to_playlist):
|
def download_youtubedl_and_queue(video_url, add_to_playlist, uid_user):
|
||||||
|
check_and_set_download_dirs_exist(uid_user)
|
||||||
filename_absolute = youtubedl_download(video_url,
|
filename_absolute = youtubedl_download(video_url,
|
||||||
config["download_dirs"]["youtubedl"],
|
config["download_dirs"]["youtubedl"],
|
||||||
config["proxy"]["server"])
|
config["proxy"]["server"])
|
||||||
|
call_scan(filename_absolute)
|
||||||
update_mpd_db(filename_absolute, add_to_playlist)
|
update_mpd_db(filename_absolute, add_to_playlist)
|
||||||
return make_song_paths_relative_to_mpd_root([filename_absolute])
|
return make_song_paths_relative_to_mpd_root([filename_absolute])
|
||||||
|
|
||||||
|
|
||||||
@sched.register_command()
|
@sched.register_command()
|
||||||
def download_deezer_favorites(user_id: str, add_to_playlist: bool, create_zip: bool):
|
def download_deezer_favorites(user_id: str, add_to_playlist: bool, create_zip: bool, uid_user):
|
||||||
|
check_and_set_download_dirs_exist(uid_user)
|
||||||
songs_absolute_location = []
|
songs_absolute_location = []
|
||||||
output_directory = f"favorites_{user_id}"
|
output_directory = f"favorites_{user_id}"
|
||||||
favorite_songs = get_deezer_favorites(user_id)
|
favorite_songs = get_deezer_favorites(user_id)
|
||||||
@@ -248,8 +262,9 @@ def download_deezer_favorites(user_id: str, add_to_playlist: bool, create_zip: b
|
|||||||
print(f"Could not find song ({fav_song}) on Deezer?")
|
print(f"Could not find song ({fav_song}) on Deezer?")
|
||||||
update_mpd_db(songs_absolute_location, add_to_playlist)
|
update_mpd_db(songs_absolute_location, add_to_playlist)
|
||||||
songs_with_m3u8_file = create_m3u8_file(songs_absolute_location)
|
songs_with_m3u8_file = create_m3u8_file(songs_absolute_location)
|
||||||
|
call_scan(songs_absolute_location)
|
||||||
if create_zip:
|
if create_zip:
|
||||||
return [create_zip_file(songs_with_m3u8_file)]
|
return [create_zip_file(songs_with_m3u8_file, uid_user)]
|
||||||
return make_song_paths_relative_to_mpd_root(songs_absolute_location)
|
return make_song_paths_relative_to_mpd_root(songs_absolute_location)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user