Allow images with "no type" to match "any type"

This fixes PICARD-1001, which was comparing the following two images:
CoverArtImage(url=u'http://ec2.images-amazon.com/images/P/B001BJAG9O.03.LZZZZZZZ.jpg')
TagCoverArtImage(u'/mnt/data/music/Amy Macdonald/2007 - This Is the Life [2008]/01 - Mr Rock & Roll.flac', tag='FLAC/PICTURE', types=[u'front'], support_types=True)
Which were exactly the same, but the one coming from the release had
an empty types, so they were handled as different.
This commit makes images with "no type" defined match "any type" (as
long as the image data is the same, of course).
This commit is contained in:
Antonio Larrosa
2017-03-15 09:55:16 +01:00
parent 1f220d74e9
commit 9aceb08d9d

View File

@@ -208,7 +208,10 @@ class CoverArtImage:
def __eq__(self, other):
if self and other:
return (self.datahash, self.types) == (other.datahash, other.types)
if self.types and other.types:
return (self.datahash, self.types) == (other.datahash, other.types)
else:
return self.datahash == other.datahash
elif not self and not other:
return True
else: