feat(sync): support playlists

This commit is contained in:
Markury
2026-01-09 16:07:58 -05:00
parent 3d8df1eb48
commit e3e75f0256
3 changed files with 173 additions and 71 deletions

View File

@@ -38,14 +38,18 @@ export type ProgressCallback = (progress: SyncProgress) => void;
* Returns a diff showing which files need to be synced
*/
export async function indexAndCompare(
libraryPath: string,
devicePath: string,
musicLibraryPath: string,
musicDevicePath: string,
playlistsLibraryPath: string | null | undefined,
playlistsDevicePath: string | null | undefined,
overwriteMode: string
): Promise<SyncDiff> {
try {
const result = await invoke<SyncDiff>('index_and_compare', {
libraryPath,
devicePath,
musicLibraryPath,
musicDevicePath,
playlistsLibraryPath: playlistsLibraryPath || undefined,
playlistsDevicePath: playlistsDevicePath || undefined,
overwriteMode
});
return result;
@@ -59,8 +63,10 @@ export async function indexAndCompare(
* Sync files to device with progress updates
*/
export async function syncToDevice(
libraryPath: string,
devicePath: string,
musicLibraryPath: string,
musicDevicePath: string,
playlistsLibraryPath: string | null | undefined,
playlistsDevicePath: string | null | undefined,
filesToCopy: FileInfo[],
onProgress?: ProgressCallback
): Promise<string> {
@@ -76,8 +82,10 @@ export async function syncToDevice(
// Start sync operation
const result = await invoke<string>('sync_to_device', {
libraryPath,
devicePath,
musicLibraryPath,
musicDevicePath,
playlistsLibraryPath: playlistsLibraryPath || undefined,
playlistsDevicePath: playlistsDevicePath || undefined,
filesToCopy
});

View File

@@ -127,6 +127,8 @@
const result = await indexAndCompare(
$settings.musicFolder,
$deviceSyncSettings.musicPath,
$settings.playlistsFolder,
$deviceSyncSettings.playlistsPath,
$deviceSyncSettings.overwriteMode
);
@@ -160,6 +162,8 @@
const result = await syncToDevice(
$settings.musicFolder,
$deviceSyncSettings.musicPath,
$settings.playlistsFolder,
$deviceSyncSettings.playlistsPath,
syncDiff.filesToCopy,
(progress) => {
syncProgress = progress;