mirror of
https://github.com/beetbox/beets.git
synced 2025-12-29 03:52:51 +01:00
artresizer: parse output of identify command to check IM version
we used to parse `convert` output but `convert` happens to be a Windows cli command too. using `identify` is less error prone.
This commit is contained in:
parent
e4180e406e
commit
a0c38a07a6
1 changed files with 5 additions and 1 deletions
|
|
@ -167,6 +167,7 @@ class ArtResizer(object):
|
|||
|
||||
def _can_compare(self):
|
||||
"""A boolean indicating whether image comparison is available"""
|
||||
|
||||
return self.method[0] == IMAGEMAGICK and self.method[1] > (6, 8, 7)
|
||||
|
||||
@staticmethod
|
||||
|
|
@ -174,6 +175,7 @@ class ArtResizer(object):
|
|||
"""A tuple indicating whether current method is available and its version.
|
||||
If no method is given, it returns a supported one.
|
||||
"""
|
||||
|
||||
# Guess available method
|
||||
if not method:
|
||||
for m in [IMAGEMAGICK, PIL]:
|
||||
|
|
@ -183,9 +185,11 @@ class ArtResizer(object):
|
|||
return (WEBPROXY, (0))
|
||||
|
||||
if method == IMAGEMAGICK:
|
||||
|
||||
# Try invoking ImageMagick's "convert".
|
||||
try:
|
||||
out = util.command_output(['convert', '--version'])
|
||||
out = util.command_output(['identify', '--version'])
|
||||
|
||||
if 'imagemagick' in out.lower():
|
||||
pattern = r".+ (\d+)\.(\d+)\.(\d+).*"
|
||||
match = re.search(pattern, out)
|
||||
|
|
|
|||
Loading…
Reference in a new issue