From 9aceb08d9db7979366753cdef5af55acbca69f99 Mon Sep 17 00:00:00 2001 From: Antonio Larrosa Date: Wed, 15 Mar 2017 09:55:16 +0100 Subject: [PATCH] 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). --- picard/coverart/image.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/picard/coverart/image.py b/picard/coverart/image.py index cb036cd47..ff41cc976 100644 --- a/picard/coverart/image.py +++ b/picard/coverart/image.py @@ -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: