Shuttle2 icon indicating copy to clipboard operation
Shuttle2 copied to clipboard

Rescanning the local S2 media provider merges playlists

Open daladim opened this issue 1 year ago • 2 comments

🌎 Environment

S2 built from sources (current main branch)

💬 Description

Rescanning the local S2 media provider merges playlists instead of replacing them

🦶 Reproduction Steps

  1. Have a stuff.m3u on the disk, with this content
    A/a.mp3
    B/b.mp3
    C/c.mp3
    
  2. Add a S2 Media Provider
  3. It successfully imports a playlist named stuff, with these 3 items
  4. On the disk, modify stuff.m3uso that it now contains
    A/a.mp3
    D/d.mp3
    C/c.mp3
    
  5. In S2, click Rescan

Expected result (I think): The stuff playlist now contains the items as they are on the disk, because we've just scanned the disk

Actual result: The stuff playlist contains a merged version of the previous content and the one from the disk:

  • A
  • B
  • C
  • D

daladim avatar Feb 27 '23 15:02 daladim

Expected result is not very clear actually. @timusus , what is the "rescan" philosophy after all? The code has a great support for "updating" scanned playlists instead of bluntly replacing them (see e.g. MediaImporter.PlaylistUpdateData). Is this on purpose?

The described behaviour looks like a bug to me, but maybe there are other workflows where this is actually expected? 🤔

Edit: totally removing the S2 Media Provider before adding it again "correctly" imports the stuff playlist with its content from disk. Am I supposed to use this workflow instead? In this case, should we rephrase the "rescan" button (or description) to explain the difference between removing/adding the provider again?

daladim avatar Feb 27 '23 16:02 daladim

There is a deliberate effort to ensure that playlists don't get overwritten during a scan.

I haven't thought about this for some time.. The worry is that you might import a playlist - so it's no longer based on its 'm3u' source, but is now just a 'local' S2 playlist. Then, if you make changes to it, you might not want those changes overwritten when you rescan your library.

One possible solution would be to provide this option as a checkbox.. some sort of UI to indicate whether you want to 'merge' or 'replace'..

timusus avatar Apr 21 '23 23:04 timusus