From 77698ae4f81e8a91e57e28a4e3090a9eeee5bf96 Mon Sep 17 00:00:00 2001 From: cyanChill <83375816+cyanChill@users.noreply.github.com> Date: Fri, 15 May 2026 19:02:45 -0400 Subject: [PATCH] fix: Potential fix to #485 - This ensures no duplicate entries when importing an M3U playlist. Order should also be preserved. - This assumes the issue is caused by duplicate tracks in the M3U file, which I guess could happen if the playlist it was generated from supports duplicate tracks. --- mobile/src/modules/backup/M3U.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/mobile/src/modules/backup/M3U.ts b/mobile/src/modules/backup/M3U.ts index 92abd5f27..969e10abe 100644 --- a/mobile/src/modules/backup/M3U.ts +++ b/mobile/src/modules/backup/M3U.ts @@ -50,12 +50,15 @@ export async function readM3UPlaylist() { } // Get uris so we can search our database. - const trackUris = - strategy === "absolute" - ? trackPaths.map((path) => `file://${slashStart ? "" : "/"}${path}`) - : strategy === "relative" - ? trackPaths.map((path) => joinPaths(fileDirectory, path)) - : trackPaths; + const trackUris = Array.from( + new Set( + strategy === "absolute" + ? trackPaths.map((path) => `file://${slashStart ? "" : "/"}${path}`) + : strategy === "relative" + ? trackPaths.map((path) => joinPaths(fileDirectory, path)) + : trackPaths, + ), + ); const playlistTracks = await getTracks([ inArray(structuredTracksView.uri, trackUris),