feat: song editor

This commit is contained in:
2026-09-08 09:52:40 +02:00
parent 6d9853f2c1
commit 047a3a8b29
16 changed files with 169 additions and 51 deletions
@@ -1,9 +1,13 @@
import {
type CloudImport,
openImportTypePicker
} from '@/composables/importTypePicker';
import type {
Song
} from '@/ts/dtype/playlist';
import {
openImportTypePicker
} from '@/composables/importTypePicker';
openSearchInterface
} from '@/composables/searchManager';
import {
searchPlaylists
} from './playlists';
@@ -11,23 +15,29 @@ import {
searchSongs
} from './songs';
export const addFromAppleMusic = async ( cb: ( songs: Song[] ) => void ): Promise<void> => {
export const addFromAppleMusic = async ( cb: ( songs: Song[] ) => void, kindIdx?: number, autoClose?: boolean ): Promise<void> => {
const songs = await searchSongs( cb );
const playlists = await searchPlaylists( cb );
openImportTypePicker( [
const kinds: CloudImport[] = [
{
'name': 'Songs',
'type': 'cloud',
'addSelected': songs.addSelected,
'search': songs.search,
'minChars': 3
'minChars': 3,
'autoClose': autoClose ?? false
},
{
'name': 'Playlists',
'type': 'cloud',
'addSelected': playlists.addSelected,
'search': playlists.search
'search': playlists.search,
'autoClose': autoClose ?? false
}
] );
];
if ( kindIdx === undefined )
openImportTypePicker( kinds );
else
openSearchInterface( kinds[kindIdx]! );
};