mirror of
https://github.com/beetbox/beets.git
synced 2025-12-15 21:14:19 +01:00
artresizer: move can_compare property to backend classes
This commit is contained in:
parent
cb9a765997
commit
b097b19506
1 changed files with 12 additions and 5 deletions
|
|
@ -238,6 +238,10 @@ class IMBackend(LocalBackend):
|
|||
except subprocess.CalledProcessError:
|
||||
return source
|
||||
|
||||
@property
|
||||
def can_compare(self):
|
||||
return self.version() > (6, 8, 7)
|
||||
|
||||
def compare(self, im1, im2, compare_threshold):
|
||||
is_windows = platform.system() == "Windows"
|
||||
|
||||
|
|
@ -425,6 +429,10 @@ class PILBackend(LocalBackend):
|
|||
log.exception("failed to convert image {} -> {}", source, target)
|
||||
return source
|
||||
|
||||
@property
|
||||
def can_compare(self):
|
||||
return False
|
||||
|
||||
def compare(self, im1, im2, compare_threshold):
|
||||
# It is an error to call this when ArtResizer.can_compare is not True.
|
||||
raise NotImplementedError()
|
||||
|
|
@ -563,11 +571,10 @@ class ArtResizer(metaclass=Shareable):
|
|||
def can_compare(self):
|
||||
"""A boolean indicating whether image comparison is available"""
|
||||
|
||||
return (
|
||||
self.local
|
||||
and self.local_method.ID == IMAGEMAGICK
|
||||
and self.local_method.version() > (6, 8, 7)
|
||||
)
|
||||
if self.local:
|
||||
return self.local_method.can_compare
|
||||
else:
|
||||
return False
|
||||
|
||||
def compare(self, im1, im2, compare_threshold):
|
||||
"""Return a boolean indicating whether two images are similar.
|
||||
|
|
|
|||
Loading…
Reference in a new issue