-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix relocating of moved tracks in external collections #2404
Conversation
Rebased on master since no comments received and only a single commit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had expected that after using Relink in Library preferences all tracks will come back without scanning the library. This is not the case. Is this a bug?
- create folder 1 with one track
- start Mixxx add the folder in the library preferences
- Play the track
- quit Mixxx
- rename the folder to 2
- start Mixxx go to the library preferences
- Relink folder 1 to 2
- try to play the track
- ... Missing
- Rescan Library track is back
src/library/dao/directorydao.cpp
Outdated
QString newLocation; | ||
newLocation.reserve(newFolder.size() + oldSuffixLen); | ||
newLocation.append(newFolder); | ||
newLocation.append(oldLocation.right(oldSuffixLen)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think due to Stringbuilder this can become:
QString newLocation = newFolder + oldLocation.right(oldSuffixLen);
src/library/relocatedtrack.h
Outdated
|
||
// The new TrackRef of the relocated track after merging | ||
// the missing with the newly added track. | ||
TrackRef mergedTrackRef() const { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when reading the usage code it was not instantly clear what is merged here.
Can it become newTrackRef .. or something smarter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updatedTrackRef() might better reflect the naming at the call side?
This is a known bug that I discovered while fixing another bug. I was sure that I have already reported it, but I haven't found it yet. Out of scope, will not be fixed in this PR. |
Ups, I mentioned it right here in this PR, see above Note 1 🙈 We should create a bug report. |
Rescan after relinking: https://bugs.launchpad.net/mixxx/+bug/1862396 |
LGTM, Thank you. |
The update of moved tracks in external collections didn't work as expected. Only the aoide integration in #2282 was affected affected. The old id of the old track and the new location of the new track need to be merged into a new
TrackRef
that identifies the relocated track.This bug was mainly caused by using a
QPair
instead of a custom class. The classRelocatedTrack
now encapsulates all the information with appropriate accessor functions and lots of assertions to check consistency. I also added checks to verify that Track::getTrackAdded() is valid for tracks in the library. This was the first indicator for the wrong behavior.Note 1: Relinking library directories in Mixxx still requires to rescan the library manually. This should be fixed independently. Another bug is that the track table view is not updated with the new location after rescanning. This might also affect BaseTrackCache, I didn't check.
Note 2:
During testing duplicate tracks appeared in aoide. This is a different issue that I need to check.Not reproducible, might be fixed. Aoide v0.5.0 will prevent this actively.