mirror of
https://github.com/janishutz/MusicPlayer.git
synced 2026-09-10 14:25:24 +02:00
feat: song editor
This commit is contained in:
@@ -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]! );
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user