From 38e51a49d283d55b3f6eaf66dcdf930a52335b19 Mon Sep 17 00:00:00 2001 From: Uwe Klotz Date: Fri, 4 Jun 2021 15:36:33 +0200 Subject: Synchronize file modified time with track source on metadata import/export --- src/sources/metadatasourcetaglib.cpp | 8 ++++---- src/sources/soundsourceproxy.cpp | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src/sources') diff --git a/src/sources/metadatasourcetaglib.cpp b/src/sources/metadatasourcetaglib.cpp index 607e9881cf..85e09f49a1 100644 --- a/src/sources/metadatasourcetaglib.cpp +++ b/src/sources/metadatasourcetaglib.cpp @@ -75,20 +75,20 @@ class AiffFile : public TagLib::RIFF::AIFF::File { } }; -inline QDateTime getMetadataSynchronized(const QFileInfo& fileInfo) { - return fileInfo.lastModified(); +inline QDateTime getSourceSynchronizedAt(const QFileInfo& fileInfo) { + return fileInfo.lastModified().toUTC(); } } // anonymous namespace std::pair MetadataSourceTagLib::afterImport(ImportResult importResult) const { - return std::make_pair(importResult, getMetadataSynchronized(QFileInfo(m_fileName))); + return std::make_pair(importResult, getSourceSynchronizedAt(QFileInfo(m_fileName))); } std::pair MetadataSourceTagLib::afterExport(ExportResult exportResult) const { - return std::make_pair(exportResult, getMetadataSynchronized(QFileInfo(m_fileName))); + return std::make_pair(exportResult, getSourceSynchronizedAt(QFileInfo(m_fileName))); } std::pair diff --git a/src/sources/soundsourceproxy.cpp b/src/sources/soundsourceproxy.cpp index 69d94ea198..cc77323401 100644 --- a/src/sources/soundsourceproxy.cpp +++ b/src/sources/soundsourceproxy.cpp @@ -539,9 +539,9 @@ bool SoundSourceProxy::updateTrackFromSource( // values if the corresponding file tags are missing. Depending // on the file type some kind of tags might even not be supported // at all and this information would get lost entirely otherwise! - bool metadataSynchronized = false; + bool headerParsed = false; mixxx::TrackMetadata trackMetadata = - m_pTrack->getMetadata(&metadataSynchronized); + m_pTrack->getMetadata(&headerParsed); // Save for later to replace the unreliable and imprecise audio // properties imported from file tags (see below). @@ -559,7 +559,7 @@ bool SoundSourceProxy::updateTrackFromSource( // if the user did not explicitly choose to (re-)import metadata // explicitly from this file. bool mergeExtraMetadataFromSource = false; - if (metadataSynchronized && mode == UpdateTrackFromSourceMode::Once) { + if (headerParsed && mode == UpdateTrackFromSourceMode::Once) { // No (re-)import needed or desired, only merge missing properties mergeExtraMetadataFromSource = true; } else { @@ -592,7 +592,7 @@ bool SoundSourceProxy::updateTrackFromSource( << "from file" << getUrl().toString(); // make sure that the trackMetadata was not messed up due to the failure - trackMetadata = m_pTrack->getMetadata(&metadataSynchronized); + trackMetadata = m_pTrack->getMetadata(&headerParsed); } // Partial import @@ -610,7 +610,7 @@ bool SoundSourceProxy::updateTrackFromSource( } // Full import - if (metadataSynchronized) { + if (headerParsed) { // Metadata has been synchronized successfully at least // once in the past. Only overwrite this information if // new data has actually been imported, otherwise abort -- cgit v1.2.3