Attempting to Import a Track With the Same Track Title, Album, and Artist (But Different Positions) Results in the Track Being Skipped as a Duplicate
Steps to reproduce
- Visit the "Add Content" page on an existing Funkwhale instance.
- Prepare to upload content (Get Started -> Upload -> Proceed).
- Upload two tracks that are from the same album, artist, with the same track name (different track positions). (Here is the release I was attempting to upload: OCTOPATH TRAVELER Arrangements Break & Boost; the track "Decisive Battle II")
What happens?
The second track with the same name, album, and artist is marked as a duplicate of the first, and is skipped in the import task process.
What is expected?
I would expect that because the tracks are in different positions on the album (or if they were on different discs) that they would not be marked as duplicates.
Context
Funkwhale version(s) affected: 0.18.1
I believe that the this has to do with the following line in file tasks.py:
query = Q(title__iexact=track_title, artist=artist, album=album)
Because the query to find duplicate tracks doesn't segment by the track position, this means that any albums which release which have the same title, artist, and album may be marked as duplicate. If possible, we should take track position and maybe disc number into consideration to ensure there are no collisions.
In case it helps, I'm using a Docker instance with an nginx proxy.
Work-Arounds
If you are here because you experience this issue, one possible work-around is to alter the title of the track using a tag editor to be different just to bypass the duplication detection logic, you can then log in to the admin pages ($HOST/api/admin) to change the track name back to what it originally was.