-
-
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
Synchronize external track collections [aoide Prerequisite] #2285
Conversation
Did you also consider online Libraries like Spotify as ExteralTrackCollection? |
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.
Some comments. Thank you for the work.
for (const auto& movedTrackRef : movedTrackRefs) { | ||
replacedTrackRefs += qMakePair(movedTrackRef, movedTrackRef); | ||
} | ||
m_trackDao.databaseTracksReplaced(std::move(replacedTrackRefs)); |
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 thing this needs a comment why this needs to be called with two times movedTrackRef
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 agree, this needs to be reconsidered. I just adapted the code technically to keep it working.
TrackCollection
delegates back to TrackDAO
not for updating the database but just to dispatch some notifications. It somehow works, but I refuse to touch this brittle design.
src/library/library.cpp
Outdated
if (pTrack->getId().isValid()) { | ||
if (pTrack->isDirty()) { | ||
for (const auto& externalTrackCollection : m_externalTrackCollections) { | ||
externalTrackCollection->saveTrack(*pTrack, ExternalTrackCollection::ChangeHint::Modified); |
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.
How do you permit concurrent write to the same track file in case the external library also wants to save to metadata.
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.
Only by convention. The external track collection is not supposed to touch any files that are used by Mixxx. Period.
src/library/library.cpp
Outdated
if (updatedTrackIds.isEmpty()) { | ||
return; | ||
} | ||
if (!m_externalTrackCollections.isEmpty()) { |
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.
This can also become an early exit.
The interface is designed to cover only my use case and to keep the changes to a minimum. It is an adapter that serves as an anti-corruption layer between the new and the old world. I'm not able to repair the internal track management that is wildly scattered among |
…ternal_library_sync
OK, Thank you. LGTM |
Synchronization from Mixxx to external track collections:
ExternalTrackCollection
Library
manages all external collectionsTrackId
toTrackRef
TrackDAO::databaseTracksMoved
has been replaced byTrackDAO::databaseTracksReplaced
with slightly different and more useful parameters. Please don't start discussing the usage ofQPair
, that's just a negligible detail ;)DirectoryDAO
intoTrackCollection
.Considered feature complete for the first iteration.