summaryrefslogtreecommitdiffstats
path: root/src/library
diff options
context:
space:
mode:
Diffstat (limited to 'src/library')
-rw-r--r--src/library/dao/trackdao.cpp24
-rw-r--r--src/library/library_prefs.cpp6
-rw-r--r--src/library/library_prefs.h6
-rw-r--r--src/library/trackcollectionmanager.cpp2
4 files changed, 30 insertions, 8 deletions
diff --git a/src/library/dao/trackdao.cpp b/src/library/dao/trackdao.cpp
index f10914bfcc..de1b475388 100644
--- a/src/library/dao/trackdao.cpp
+++ b/src/library/dao/trackdao.cpp
@@ -19,6 +19,7 @@
#include "library/dao/libraryhashdao.h"
#include "library/dao/playlistdao.h"
#include "library/dao/trackschema.h"
+#include "library/library_prefs.h"
#include "library/queryutil.h"
#include "library/trackset/crate/cratestorage.h"
#include "moc_trackdao.cpp"
@@ -849,8 +850,10 @@ TrackPointer TrackDAO::addTracksAddFile(
// Initially (re-)import the metadata for the newly created track
// from the file.
- SoundSourceProxy(pTrack).updateTrackFromSource();
- if (!pTrack->isSourceSynchronized()) {
+ SoundSourceProxy(pTrack).updateTrackFromSource(
+ m_pConfig,
+ SoundSourceProxy::UpdateTrackFromSourceMode::Once);
+ if (!pTrack->checkSourceSynchronized()) {
qWarning() << "TrackDAO::addTracksAddFile:"
<< "Failed to parse track metadata from file"
<< pTrack->getLocation();
@@ -1487,7 +1490,22 @@ TrackPointer TrackDAO::getTrackById(TrackId trackId) const {
// file. This import might have never been completed successfully
// before, so just check and try for every track that has been
// freshly loaded from the database.
- SoundSourceProxy(pTrack).updateTrackFromSource();
+ auto updateTrackFromSourceMode =
+ SoundSourceProxy::UpdateTrackFromSourceMode::Once;
+ if (m_pConfig &&
+ m_pConfig->getValueString(
+ mixxx::library::prefs::kSyncTrackMetadataConfigKey)
+ .toInt() == 1) {
+ // An implicit re-import and update is performed if the
+ // user has enabled export of file tags in the preferences.
+ // Either they want to keep their file tags synchronized or
+ // not, no exceptions!
+ updateTrackFromSourceMode =
+ SoundSourceProxy::UpdateTrackFromSourceMode::Newer;
+ }
+ SoundSourceProxy(pTrack).updateTrackFromSource(
+ m_pConfig,
+ updateTrackFromSourceMode);
if (kLogger.debugEnabled() && pTrack->isDirty()) {
kLogger.debug()
<< "Updated track metadata from file tags:"
diff --git a/src/library/library_prefs.cpp b/src/library/library_prefs.cpp
index 020b930dcd..b3b1e3d731 100644
--- a/src/library/library_prefs.cpp
+++ b/src/library/library_prefs.cpp
@@ -28,12 +28,14 @@ const ConfigKey mixxx::library::prefs::kSearchDebouncingTimeoutMillisConfigKey =
mixxx::library::prefs::kConfigGroup,
QStringLiteral("SearchDebouncingTimeoutMillis")};
-const ConfigKey mixxx::library::prefs::kSyncTrackMetadataExportConfigKey =
+// The "Export" suffix in the key is kept for backward compatibility
+const ConfigKey mixxx::library::prefs::kSyncTrackMetadataConfigKey =
ConfigKey{
mixxx::library::prefs::kConfigGroup,
QStringLiteral("SyncTrackMetadataExport")};
-const ConfigKey mixxx::library::prefs::kSeratoMetadataExportConfigKey =
+// The naming is unchanged for backward compatibility
+const ConfigKey mixxx::library::prefs::kSyncSeratoMetadataConfigKey =
ConfigKey{
mixxx::library::prefs::kConfigGroup,
QStringLiteral("SeratoMetadataExport")};
diff --git a/src/library/library_prefs.h b/src/library/library_prefs.h
index 32077ebc3b..cf3bf3b6cb 100644
--- a/src/library/library_prefs.h
+++ b/src/library/library_prefs.h
@@ -20,9 +20,11 @@ extern const ConfigKey kEditMetadataSelectedClickConfigKey;
const bool kEditMetadataSelectedClickDefault = false;
-extern const ConfigKey kSyncTrackMetadataExportConfigKey;
+extern const ConfigKey kSyncTrackMetadataConfigKey;
-extern const ConfigKey kSeratoMetadataExportConfigKey;
+extern const ConfigKey kSyncSeratoMetadataConfigKey;
+
+extern const ConfigKey kSyncSeratoMetadataConfigKey;
} // namespace prefs
diff --git a/src/library/trackcollectionmanager.cpp b/src/library/trackcollectionmanager.cpp
index 761c64ccee..d10e7762e5 100644
--- a/src/library/trackcollectionmanager.cpp
+++ b/src/library/trackcollectionmanager.cpp
@@ -285,7 +285,7 @@ void TrackCollectionManager::exportTrackMetadata(
(pTrack->isDirty() &&
m_pConfig &&
m_pConfig->getValueString(
- mixxx::library::prefs::kSyncTrackMetadataExportConfigKey)
+ mixxx::library::prefs::kSyncTrackMetadataConfigKey)
.toInt() == 1)) {
switch (mode) {
case TrackMetadataExportMode::Immediate: