mirror of
https://github.com/fergalmoran/picard.git
synced 2026-02-19 14:13:58 +00:00
PICARD-2549: Fixed similarity not getting updated if only difference is cover art
If a file is moved to a track where the metadata matches perfectly but only cover art is different, then the similarity score of this file was not recalculated. That means the file retains the similarity of the previous (probably bad) match. Also only do this change if the state was NORMAL before (similar to the other state updates, ignoring states like PENDING and ERROR).
This commit is contained in:
@@ -710,12 +710,12 @@ class File(QtCore.QObject, Item):
|
||||
self.state = File.CHANGED
|
||||
break
|
||||
else:
|
||||
if (self.metadata.images
|
||||
self.similarity = 1.0
|
||||
if self.state in (File.CHANGED, File.NORMAL):
|
||||
if (self.metadata.images
|
||||
and self.orig_metadata.images != self.metadata.images):
|
||||
self.state = File.CHANGED
|
||||
else:
|
||||
self.similarity = 1.0
|
||||
if self.state == File.CHANGED:
|
||||
self.state = File.CHANGED
|
||||
else:
|
||||
self.state = File.NORMAL
|
||||
if signal:
|
||||
log.debug("Updating file %r", self)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# Picard, the next-generation MusicBrainz tagger
|
||||
#
|
||||
# Copyright (C) 2018-2021 Philipp Wolfer
|
||||
# Copyright (C) 2018-2022 Philipp Wolfer
|
||||
# Copyright (C) 2019-2022 Laurent Monin
|
||||
# Copyright (C) 2021 Bob Swift
|
||||
# Copyright (C) 2021 Sophist-UK
|
||||
@@ -459,7 +459,7 @@ class FileUpdateTest(PicardTestCase):
|
||||
self.file.state = File.NORMAL
|
||||
|
||||
self.file.update(signal=False)
|
||||
self.assertEqual(self.file.similarity, self.INVALIDSIMVAL) # it shouldbn't be modified
|
||||
self.assertEqual(self.file.similarity, 1.0)
|
||||
self.assertEqual(self.file.state, File.CHANGED)
|
||||
|
||||
def test_signal(self):
|
||||
|
||||
Reference in New Issue
Block a user