Added support for spotify playlists
This commit is contained in:
@ -377,6 +377,21 @@ def downloadTrackObj(dz, trackAPI, settings, bitrate, queueItem, extraTrack=None
|
||||
if 'cancel' in queueItem:
|
||||
result['cancel'] = True
|
||||
return result
|
||||
|
||||
if trackAPI['SNG_ID'] == 0:
|
||||
result['error'] = {
|
||||
'message': "Track not available on Deezer!",
|
||||
}
|
||||
if 'SNG_TITLE' in trackAPI:
|
||||
result['error']['data'] = {
|
||||
'id': trackAPI['SNG_ID'],
|
||||
'title': trackAPI['SNG_TITLE'],
|
||||
'mainArtist': {'name': trackAPI['ART_NAME']}
|
||||
}
|
||||
if socket:
|
||||
queueItem['failed'] += 1
|
||||
socket.emit("updateQueue", {'uuid': queueItem['uuid'], 'failed': True, 'data': result['error']['data'], 'error': "Track not available on Deezer!"})
|
||||
return result
|
||||
# Get the metadata
|
||||
if extraTrack:
|
||||
track = extraTrack
|
||||
@ -662,6 +677,8 @@ def after_download(tracks, settings, queueItem):
|
||||
if 'cancel' in result:
|
||||
return None
|
||||
if 'error' in result:
|
||||
if not 'data' in result['error']:
|
||||
result['error']['data'] = {'id': 0, 'title': 'Unknown', 'mainArtist': {'name': 'Unknown'}}
|
||||
errors += f"{result['error']['data']['id']} | {result['error']['data']['mainArtist']['name']} - {result['error']['data']['title']} | {result['error']['message']}\r\n"
|
||||
if 'searched' in result:
|
||||
searched += result['searched']+"\r\n"
|
||||
|
@ -1,5 +1,5 @@
|
||||
from deemix.utils.misc import getIDFromLink, getTypeFromLink, getBitrateInt
|
||||
from deemix.utils.spotifyHelper import get_trackid_spotify, get_albumid_spotify
|
||||
from deemix.utils.spotifyHelper import get_trackid_spotify, get_albumid_spotify, convert_spotify_playlist
|
||||
from concurrent.futures import ProcessPoolExecutor
|
||||
from deemix.app.downloader import download
|
||||
|
||||
@ -146,6 +146,14 @@ def generateQueueItem(dz, url, settings, bitrate=None, albumAPI=None, socket=Non
|
||||
else:
|
||||
print("Album not found on deezer!")
|
||||
result['error'] = "Album not found on deezer!"
|
||||
elif type == "spotifyplaylist":
|
||||
if socket:
|
||||
socket.emit("toast", {'msg': f"Converting spotify tracks to deezer tracks", 'icon': 'loading', 'dismiss': False, 'id': 'spotifyplaylist_'+str(id)})
|
||||
result = convert_spotify_playlist(dz, id, settings)
|
||||
result['bitrate'] = bitrate
|
||||
result['uuid'] = f"{result['type']}_{id}_{bitrate}"
|
||||
if socket:
|
||||
socket.emit("toast", {'msg': f"Spotify playlist converted", 'icon': 'done', 'dismiss': True, 'id': 'spotifyplaylist_'+str(id)})
|
||||
else:
|
||||
print("URL not supported yet")
|
||||
result['error'] = "URL not supported yet"
|
||||
|
Reference in New Issue
Block a user