LMS-Community / slimserver

Server for Squeezebox and compatible players. This server is also called Lyrion Music Server.
https://lyrion.org
Other
1.16k stars 293 forks source link

Duplicate title entries after library update #547

Closed schnillerman closed 2 years ago

schnillerman commented 3 years ago

Whenever I update files that are registered in the library, a few of them are registered as duplicates (in the same album) in the library after a re-scan. The nature of the file update can be just (mp3-) tag updates, but also file renaming (directory name remains the same).

The only solution I have found to this is to rename or move the album's directory, re-scan, rename/move it back to its original state and do a second rescan.

Version: 8.2.0 - 1614990095 @ Sat Mar 6 01:43:25 CET 2021

This happens in earlier 8.x and 7.x versions as well.

bobbydriver commented 2 years ago

This has been working fine with everything I've thrown at it in terms of folder/file changes so far, but today found a test case that still gives duplication

1) added a brand new folder with an album in it. Scanned into the database and it created 2 duplicate albums. This is because I had made an error in the album tag on one of the tracks so it was slightly different to the other tracks. So the behaviour was correct - so far

2) went into the folder and corrected the album tag on the bad track so it matched the album track of the others. Re-wrote the existing tags on all the files, so that they all got a new Date Modified. Did a rescan and it still shows up as 2 duplicate albums

3) went back into the folder and this time changed the album title to something new - and applied to all tracks. Rescanned and it is still showing as 2 duplicate albums

Can you recreate this? I'm on today's latest nightly

michaelherger commented 2 years ago

Please whenever you encounter such issues put aside a copy of your server.log, scanner.log and library.db and send me a copy. This would greatly help me to better understand what's going on.

michaelherger commented 2 years ago

Ok, I've been able to reproduce this... Argh...

michaelherger commented 2 years ago

You wouldn't need to touch any of the other tracks. "fixing" one track's album name would be enough to trigger this issue: on the initial scan two albums would be created for those tracks. When we fix the album title, LMS would simply rename the second album's title, but not try to merge all tracks of that album.

The latest commit attempts to fix this situation: it would re-assign the fixed track to the existing correct album, then remove the old, incorrect album (if no track was left on it). Please give the next build another try.

And thanks for your reports!

bobbydriver commented 2 years ago

Tested at my end and that seems to have fixed it - thank you!

Will pipe up again if I find any more test fail scenarios, but fingers crossed that this is done now