mirror of
https://github.com/markuryy/shark.git
synced 2026-06-18 18:41:03 +00:00
feat(sync): support playlists
This commit is contained in:
@@ -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
|
||||
});
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user