A music player that connects to your cloud/distributed storage.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(facets/v3-import): don't import playlist if one exists with the same name already

+20 -16
+1 -1
src/components/orchestrator/favourites/element.js
··· 4 4 import { createEmptyFavouritesPlaylist } from "./common.js"; 5 5 6 6 /** 7 - * @import {Playlist, Track} from "@definitions/types.d.ts" 7 + * @import {Track} from "@definitions/types.d.ts" 8 8 * @import {ProxiedActions} from "@common/worker.d.ts" 9 9 * @import {OutputElement} from "@components/output/types.d.ts" 10 10 * @import {Actions} from "./types.d.ts"
+19 -15
src/facets/tools/v3-import.html.txt
··· 165 165 const now = new Date().toISOString(); 166 166 const existing = output.playlists.collection() ?? []; 167 167 168 - const newPlaylists = items.map((item) => ({ 169 - $type: "sh.diffuse.output.playlist", 170 - id: crypto.randomUUID(), 171 - name: item.name ?? "Untitled", 172 - unordered: !!item.collection, 173 - items: (item.tracks ?? []).map((track) => ({ 174 - criteria: [ 175 - { field: "tags.album", value: track.album ?? "", transformations: ["toLowerCase"] }, 176 - { field: "tags.artist", value: track.artist ?? "", transformations: ["toLowerCase"] }, 177 - { field: "tags.title", value: track.title ?? "", transformations: ["toLowerCase"] }, 178 - ], 179 - })), 180 - createdAt: now, 181 - updatedAt: now, 182 - })); 168 + const newPlaylists = items 169 + .map((item) => ({ 170 + $type: "sh.diffuse.output.playlist", 171 + id: crypto.randomUUID(), 172 + name: item.name ?? "Untitled", 173 + unordered: !!item.collection, 174 + items: (item.tracks ?? []).map((track) => ({ 175 + criteria: [ 176 + { field: "tags.album", value: track.album ?? "", transformations: ["toLowerCase"] }, 177 + { field: "tags.artist", value: track.artist ?? "", transformations: ["toLowerCase"] }, 178 + { field: "tags.title", value: track.title ?? "", transformations: ["toLowerCase"] }, 179 + ], 180 + })), 181 + createdAt: now, 182 + updatedAt: now, 183 + })) 184 + .filter((playlist) => { 185 + return existing.find((p) => p.name === playlist.name) === undefined; 186 + }); 183 187 184 188 await output.playlists.save([...existing, ...newPlaylists]); 185 189 showStatus(`Imported ${newPlaylists.length} playlist(s).`, "success");