Skip to content
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 reimport of track metadata #3998

Merged
merged 2 commits into from
Jun 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/library/dlgtrackinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,11 @@ void DlgTrackInfo::slotImportMetadataFromFile() {
// losing existing metadata or to lose the beat grid by replacing
// it with a default grid created from an imprecise BPM.
// See also: https://bugs.launchpad.net/mixxx/+bug/1929311
mixxx::TrackMetadata trackMetadata = m_pLoadedTrack->getMetadata();
// In additiona we need to preserve all other track properties
// that are stored in TrackRecord, which serves as the underlying
// model for this dialog.
mixxx::TrackRecord trackRecord = m_pLoadedTrack->getRecord();
mixxx::TrackMetadata trackMetadata = trackRecord.getMetadata();
QImage coverImage;
const auto [importResult, metadataSynchronized] =
SoundSourceProxy(m_pLoadedTrack)
Expand All @@ -682,7 +686,6 @@ void DlgTrackInfo::slotImportMetadataFromFile() {
fileAccess.info(),
trackMetadata.getAlbumInfo().getTitle(),
coverImage);
mixxx::TrackRecord trackRecord;
trackRecord.replaceMetadataFromSource(
std::move(trackMetadata),
metadataSynchronized);
Expand Down
5 changes: 5 additions & 0 deletions src/track/trackrecord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ bool copyIfNotEmpty(
bool TrackRecord::replaceMetadataFromSource(
TrackMetadata&& importedMetadata,
const QDateTime& metadataSynchronized) {
if (m_streamInfoFromSource) {
// Preserve precise stream info if available, i.e. discard the
// audio properties that are also stored as track metadata.
importedMetadata.updateStreamInfoFromSource(*m_streamInfoFromSource);
}
bool modified = false;
if (getMetadata() != importedMetadata) {
setMetadata(std::move(importedMetadata));
Expand Down