diff --git a/deemix/deemix/plugins/spotify.js b/deemix/deemix/plugins/spotify.js index 86e53e8..2fe4412 100644 --- a/deemix/deemix/plugins/spotify.js +++ b/deemix/deemix/plugins/spotify.js @@ -312,7 +312,8 @@ class Spotify extends Plugin { _convertPlaylistStructure (spotifyPlaylist) { let cover = null - if (spotifyPlaylist.images.length) cover = spotifyPlaylist.images[0].url + // Mickey: some playlists can be faulty, for example https://open.spotify.com/playlist/7vyEjAGrXOIjqlC8pZRupW + if (spotifyPlaylist?.images?.length) cover = spotifyPlaylist.images[0].url const deezerPlaylist = { checksum: spotifyPlaylist.snapshot_id, diff --git a/deemix/package.json b/deemix/package.json index a5cc3f6..dd0eef1 100644 --- a/deemix/package.json +++ b/deemix/package.json @@ -1,6 +1,6 @@ { "name": "deemix", - "version": "3.6.20", + "version": "3.6.21", "description": "a barebones deezer downloader library", "main": "deemix/index.js", "scripts": { diff --git a/latest.txt b/latest.txt index d9ae3f2..b867028 100644 --- a/latest.txt +++ b/latest.txt @@ -1 +1 @@ -2024.8.2-r263.9ddd7fea0e \ No newline at end of file +2024.8.7-r268.4cf457a15f \ No newline at end of file diff --git a/server/src/routes/api/get/getUserSpotifyPlaylists.ts b/server/src/routes/api/get/getUserSpotifyPlaylists.ts index 04057be..6cf2168 100644 --- a/server/src/routes/api/get/getUserSpotifyPlaylists.ts +++ b/server/src/routes/api/get/getUserSpotifyPlaylists.ts @@ -8,24 +8,29 @@ const handler: ApiHandler['handler'] = async (req, res) => { if (deemix.plugins.spotify.enabled) { const sp = deemix.plugins.spotify.sp - const username = req.query.spotifyUser + const usernames = req.query.spotifyUser.split(/[\s,]+/) data = [] - let playlists - try { - playlists = await sp.getUserPlaylists(username) - } catch (e) { - res.send({ error: 'wrongSpotifyUsername', username }) - return - } - playlists = playlists.body - let playlistList = playlists.items - while (playlists.next) { - const regExec = /offset=(\d+)&limit=(\d+)/g.exec(playlists.next) - const offset = regExec![1] - const limit = regExec![2] - const newPlaylists = await sp.getUserPlaylists(username, { offset, limit }) - playlists = newPlaylists.body + let playlistList: any + playlistList = [] + for (let username of usernames) { + username = username.trim() + let playlists + try { + playlists = await sp.getUserPlaylists(username) + } catch (e) { + res.send({ error: 'wrongSpotifyUsername', username }) + return + } + playlists = playlists.body playlistList = playlistList.concat(playlists.items) + while (playlists.next) { + const regExec = /offset=(\d+)/g.exec(playlists.next) + const offset = regExec![1] + // const limit = regExec![2] + const newPlaylists = await sp.getUserPlaylists(username, { offset }) + playlists = newPlaylists.body + playlistList = playlistList.concat(playlists.items) + } } playlistList.forEach((playlist: any) => { data.push(deemix.plugins.spotify._convertPlaylistStructure(playlist)) diff --git a/webui/package.json b/webui/package.json index 1b770fc..3807d71 100644 --- a/webui/package.json +++ b/webui/package.json @@ -1,6 +1,6 @@ { "name": "deemix-webui", - "version": "1.9.7", + "version": "1.9.8", "scripts": { "clean": "rimraf public/js/bundle.js public/js/bundle.temp.js public/js/bundle.js.map", "clean-temp": "rimraf public/js/bundle.temp.js", diff --git a/webui/src/components/pages/About.vue b/webui/src/components/pages/About.vue index 912f1a9..54bb4a8 100644 --- a/webui/src/components/pages/About.vue +++ b/webui/src/components/pages/About.vue @@ -37,6 +37,14 @@
{{ $t('home.needTologin') }}