diff options
author | Uwe Klotz <uklotz@mixxx.org> | 2020-01-03 09:43:58 +0100 |
---|---|---|
committer | Uwe Klotz <uklotz@mixxx.org> | 2020-01-03 12:30:10 +0100 |
commit | 2a8eb5b2efd0fcbc6f918fc725faba48dc9b94fc (patch) | |
tree | 26df27365430e5de25518f7b187f718b5aceb179 /src/sources/soundsourceproxy.cpp | |
parent | 6d77d320b76c51c774261f737bef6aba8e562381 (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.cpp | 29 |
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); } } |