summaryrefslogtreecommitdiffstats
path: root/src/sources/soundsourceproxy.cpp
diff options
context:
space:
mode:
authorUwe Klotz <uklotz@mixxx.org>2020-01-03 09:43:58 +0100
committerUwe Klotz <uklotz@mixxx.org>2020-01-03 12:30:10 +0100
commit2a8eb5b2efd0fcbc6f918fc725faba48dc9b94fc (patch)
tree26df27365430e5de25518f7b187f718b5aceb179 /src/sources/soundsourceproxy.cpp
parent6d77d320b76c51c774261f737bef6aba8e562381 (diff)
Use CoverArtUtils::guessCoverInfo() when updating track from source
...to consider not only embedded cover art but also image files in the folder of the track's file. Otherwise the source of the cover info would be reset to UNKNOWN.
Diffstat (limited to 'src/sources/soundsourceproxy.cpp')
-rw-r--r--src/sources/soundsourceproxy.cpp29
1 files changed, 5 insertions, 24 deletions
diff --git a/src/sources/soundsourceproxy.cpp b/src/sources/soundsourceproxy.cpp
index 56d75ccd04..a8d37c786a 100644
--- a/src/sources/soundsourceproxy.cpp
+++ b/src/sources/soundsourceproxy.cpp
@@ -438,30 +438,11 @@ void SoundSourceProxy::updateTrackFromSource(
if (pCoverImg) {
// If the pointer is not null then the cover art should be guessed
- // from the embedded metadata
- CoverInfoRelative coverInfoNew;
- DEBUG_ASSERT(coverInfoNew.coverLocation.isNull());
- if (pCoverImg->isNull()) {
- // Cover art will be cleared
- DEBUG_ASSERT(coverInfoNew.source == CoverInfo::UNKNOWN);
- DEBUG_ASSERT(coverInfoNew.type == CoverInfo::NONE);
- if (kLogger.debugEnabled()) {
- kLogger.debug()
- << "No embedded cover art found in file"
- << getUrl().toString();
- }
- } else {
- coverInfoNew.source = CoverInfo::GUESSED;
- coverInfoNew.type = CoverInfo::METADATA;
- // TODO(XXX) here we may introduce a duplicate hash code
- coverInfoNew.hash = CoverArtUtils::calculateHash(coverImg);
- if (kLogger.debugEnabled()) {
- kLogger.debug()
- << "Embedded cover art found in file"
- << getUrl().toString();
- }
- }
- m_pTrack->setCoverInfo(coverInfoNew);
+ auto coverInfo =
+ CoverArtUtils::guessCoverInfo(
+ *m_pTrack, *pCoverImg);
+ DEBUG_ASSERT(coverInfo.source == CoverInfo::GUESSED);
+ m_pTrack->setCoverInfo(coverInfo);
}
}