fix: Failure to create playlist from importing an M3U file with duplicate tracks - #486
Conversation
- 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.
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR deduplicates track URIs computed during M3U playlist reading by wrapping the strategy-based URI mapping in a ChangesM3U Playlist URI Deduplication
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Comment |
Why
This PR fixes an edge case which prevents the creation of a playlist when importing from an M3U file. The problem is that it's possible for the M3U file to reference the same track multiple time (ie: if it was created from a different app which supports having a track appear multiple times). In our case, we didn't account for this, so when we went to create the
tracksToPlaylistsrelations, Drizzle will throw an error since we were trying to insert a new entry with a track id that's already used.Checklist
pnpm sync:licenses.pnpm android:prod.Summary by CodeRabbit