Development

This commit is contained in:
DeeplyDrumming
2024-08-07 17:46:02 +00:00
parent 66dfe86622
commit 6b31a62492
9 changed files with 50 additions and 29 deletions

View File

@@ -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,

View File

@@ -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": {

View File

@@ -1 +1 @@
2024.8.2-r263.9ddd7fea0e
2024.8.7-r268.4cf457a15f

View File

@@ -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))

View File

@@ -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",

View File

@@ -37,6 +37,14 @@
<h2>Changelog</h2>
<ul class="no-dots" style="font-size: 15px;">
<h3>07/08/2024</h3>
- Restored "Spotify Username" field in Settings, Other, Spotify features.<br>
- Fix for crash when fetching empty Spotify Playlists or without thumbnail image.<br>
- New feature! Added the possibility to insert a list of spotify users instead, separated by commas or spaces.<br><br>
How it works:<br>
Add a list of comma or space separated Spotify user IDs to "follow".<br>
All the public playlists by the listed users will be displayed in the Favorites section. A user ID is the part that comes after 'https://open.spotify.com/user/' and can be a set of alphanumeric characters or a profile name, especially for record labels. You can also insert your own Spotify username ID as before.<br>
<br>
<h3>02/08/2024</h3>
- Removed outdated linters and formatters<br>
- Few fixes in API ts types<br>

View File

@@ -1,7 +1,7 @@
<template>
<div id="home_tab">
<h1 class="mb-8 text-5xl">{{ $t('globals.welcome') }}</h1>
Version published 02/08/2024, see About section for changelog.
Version published 07/08/2024, see About section for changelog.
<section v-if="!isLoggedIn" ref="notLogged" class="py-6 border-0 border-t border-solid border-grayscale-500">
<p id="home_not_logged_text" class="mb-4">{{ $t('home.needTologin') }}</p>
<router-link custom v-slot="{ navigate }" class="btn btn-primary" name="button" :to="{ name: 'Settings' }">

View File

@@ -33,9 +33,11 @@
<template #overviewPage>
<a href="https://www.spotify.com/it/account/overview/" target="_blank">{{ $t('settings.spotify.howTo.usernameQuestion.step1.overviewPage') }}</a>
</template>
</i18n> -->
</i18n>
-->
</div>
</template>
</template>
<script>
export default {}

View File

@@ -705,17 +705,22 @@
<p class="input-group-text">{{ $t('settings.spotify.clientID') }}</p>
<input v-model="spotifyFeatures.clientId" type="text" />
</div>
<br>
<div class="input-group">
<p class="input-group-text">{{ $t('settings.spotify.clientSecret') }}</p>
<input v-model="spotifyFeatures.clientSecret" type="password" />
</div>
<!-- <div class="input-group">
<p class="input-group-text">{{ $t('settings.spotify.username') }}</p>
<br>
<div class="input-group">
<!-- <p class="input-group-text">{{ $t('settings.spotify.username') }}</p> -->
<p class="input-group-text">Spotify Users</p>
<p style="font-size: 13px; font-style: italic;">Tip: you can insert here a list of Spotify Users IDs,
separated by comma or space. All the public
playlists by these users will be displayed in the Favorites section. A user ID is the part that comes after
'https://open.spotify.com/user/' and can be a set of alphanumeric characters or a profile name.<br>You can also insert your own Spotify user ID as before.</p>
<input v-model="spotifyUser" type="text" />
</div> -->
</div>
<br>
<label class="with-checkbox">
<input v-model="spotifyFeatures.fallbackSearch" type="checkbox" />
<span class="checkbox-text">{{ $t('settings.downloads.fallbackSearch') }}</span>