Skip to content

Commit 36ac3bb

Browse files
authored
Merge branch 'master' into item-pickle
2 parents 6c5041c + 1f93867 commit 36ac3bb

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

beets/util/artresizer.py

+5
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,11 @@ def compare(self, im1, im2, compare_threshold):
314314
else:
315315
out_str = stdout
316316

317+
# ImageMagick 7.1.1-44 outputs in a different format.
318+
if b"(" in out_str and out_str.endswith(b")"):
319+
# Extract diff from "... (diff)".
320+
out_str = out_str[out_str.index(b"(") + 1 : -1]
321+
317322
try:
318323
phash_diff = float(out_str)
319324
except ValueError:

docs/changelog.rst

+1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ Bug fixes:
7575
* :doc:`plugins/lyrics`: Fix plugin crash when ``genius`` backend returns empty
7676
lyrics.
7777
:bug:`5583`
78+
* ImageMagick 7.1.1-44 is now supported.
7879

7980
For packagers:
8081

test/plugins/test_embedart.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,8 @@ def _mock_popens(
285285
mock_extract,
286286
mock_subprocess,
287287
compare_status=0,
288-
compare_stdout="",
289-
compare_stderr="",
288+
compare_stdout=b"",
289+
compare_stderr=b"",
290290
convert_status=0,
291291
):
292292
mock_extract.return_value = b"extracted_path"
@@ -298,33 +298,33 @@ def _mock_popens(
298298
]
299299

300300
def test_compare_success_similar(self, mock_extract, mock_subprocess):
301-
self._mock_popens(mock_extract, mock_subprocess, 0, "10", "err")
301+
self._mock_popens(mock_extract, mock_subprocess, 0, b"10", b"err")
302302
assert self._similarity(20)
303303

304304
def test_compare_success_different(self, mock_extract, mock_subprocess):
305-
self._mock_popens(mock_extract, mock_subprocess, 0, "10", "err")
305+
self._mock_popens(mock_extract, mock_subprocess, 0, b"10", b"err")
306306
assert not self._similarity(5)
307307

308308
def test_compare_status1_similar(self, mock_extract, mock_subprocess):
309-
self._mock_popens(mock_extract, mock_subprocess, 1, "out", "10")
309+
self._mock_popens(mock_extract, mock_subprocess, 1, b"out", b"10")
310310
assert self._similarity(20)
311311

312312
def test_compare_status1_different(self, mock_extract, mock_subprocess):
313-
self._mock_popens(mock_extract, mock_subprocess, 1, "out", "10")
313+
self._mock_popens(mock_extract, mock_subprocess, 1, b"out", b"10")
314314
assert not self._similarity(5)
315315

316316
def test_compare_failed(self, mock_extract, mock_subprocess):
317-
self._mock_popens(mock_extract, mock_subprocess, 2, "out", "10")
317+
self._mock_popens(mock_extract, mock_subprocess, 2, b"out", b"10")
318318
assert self._similarity(20) is None
319319

320320
def test_compare_parsing_error(self, mock_extract, mock_subprocess):
321-
self._mock_popens(mock_extract, mock_subprocess, 0, "foo", "bar")
321+
self._mock_popens(mock_extract, mock_subprocess, 0, b"foo", b"bar")
322322
assert self._similarity(20) is None
323323

324324
def test_compare_parsing_error_and_failure(
325325
self, mock_extract, mock_subprocess
326326
):
327-
self._mock_popens(mock_extract, mock_subprocess, 1, "foo", "bar")
327+
self._mock_popens(mock_extract, mock_subprocess, 1, b"foo", b"bar")
328328
assert self._similarity(20) is None
329329

330330
def test_convert_failure(self, mock_extract, mock_subprocess):

0 commit comments

Comments
 (0)