beets: fix embedart with imagick 7.1.1-12

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu 2023-07-05 18:58:49 +02:00
parent d2e03dddbb
commit 7631229b5e
No known key found for this signature in database
GPG Key ID: E13DFD4B47127951
4 changed files with 32 additions and 29 deletions

View File

@ -23,6 +23,7 @@
, src
, version
, extraPatches ? [ ]
, pluginOverrides ? { }
, disableAllPlugins ? false
@ -45,22 +46,19 @@ let
pluginWrapperBins = concatMap (p: p.wrapperBins) (attrValues enabledPlugins);
in
python3Packages.buildPythonApplication rec {
python3Packages.buildPythonApplication {
pname = "beets";
inherit src version;
patches = [
# Bash completion fix for Nix
./patches/bash-completion-always-print.patch
# Reported upstream at:
# https://github.com/beetbox/beets/issues/4836
./patches/remove-failing-embedart-test.patch
(fetchpatch {
# Fix unidecode>=1.3.5 compat
url = "https://github.com/beetbox/beets/commit/5ae1e0f3c8d3a450cb39f7933aa49bb78c2bc0d9.patch";
hash = "sha256-gqkrE+U1j3tt1qPRJufTGS/GftaSw/gweXunO/mCVG8=";
})
];
] ++ extraPatches;
propagatedBuildInputs = with python3Packages; [
confuse

View File

@ -1,6 +1,7 @@
{ lib
, callPackage
, fetchFromGitHub
, fetchpatch
}:
/*
** To customize the enabled beets plugins, use the pluginOverrides input to the
@ -26,6 +27,12 @@ lib.makeExtensible (self: {
rev = "v${version}";
hash = "sha256-fT+rCJJQR7bdfAcmeFRaknmh4ZOP4RCx8MXpq7/D8tM=";
};
extraPatches = [
# Fix embedart with ImageMagick 7.1.1-12
# https://github.com/beetbox/beets/pull/4839
# The upstream patch does not apply on 1.6.0, as the related code has been refactored since
./patches/stable-fix-embedart-imagick-7.1.1-12.patch
];
};
beets-minimal = self.beets.override { disableAllPlugins = true; };
@ -38,6 +45,15 @@ lib.makeExtensible (self: {
rev = "50bd693057de472470ab5175fae0cdb5b75811c6";
hash = "sha256-91v1StaByG60ryhQqByBXu6sFCjk0qT0nsUPnocSEE4=";
};
extraPatches = [
(fetchpatch {
# Fix embedart with ImageMagick 7.1.1-12
# https://github.com/beetbox/beets/pull/4839
name = "fix-embedart-imagick-7.1.1-12.patch";
url = "https://github.com/beetbox/beets/commit/a873a191b9d25236774cec82df2ceb6399ed4ce3.patch";
hash = "sha256-1b3igHx0jKQkyVUlwOx6Oo3O1f3w8oZDw4xpHFw0DO0=";
})
];
pluginOverrides = {
# unstable has a new plugin, so we register it here.
limit = { builtin = true; };

View File

@ -1,24 +0,0 @@
diff --git i/test/test_embedart.py w/test/test_embedart.py
index 23a6f5e5..91b9c8c2 100644
--- i/test/test_embedart.py
+++ w/test/test_embedart.py
@@ -163,19 +163,6 @@ class EmbedartCliTest(TestHelper, FetchImageHelper):
'Image written is not {}'.format(
displayable_path(self.abbey_artpath)))
- @require_artresizer_compare
- def test_accept_similar_art(self):
- self._setup_data(self.abbey_similarpath)
- album = self.add_album_fixture()
- item = album.items()[0]
- self.run_command('embedart', '-y', '-f', self.abbey_artpath)
- config['embedart']['compare_threshold'] = 20
- self.run_command('embedart', '-y', '-f', self.abbey_similarpath)
- mediafile = MediaFile(syspath(item.path))
-
- self.assertEqual(mediafile.images[0].data, self.image_data,
- 'Image written is not {}'.format(
- displayable_path(self.abbey_similarpath)))
def test_non_ascii_album_path(self):
resource_path = os.path.join(_common.RSRC, b'image.mp3')

View File

@ -0,0 +1,13 @@
diff --git a/beets/art.py b/beets/art.py
index 13d5dfbd..ac1d2fd8 100644
--- a/beets/art.py
+++ b/beets/art.py
@@ -132,7 +132,7 @@ def check_art_similarity(log, item, imagepath, compare_threshold):
convert_cmd = ['convert', syspath(imagepath, prefix=False),
syspath(art, prefix=False),
'-colorspace', 'gray', 'MIFF:-']
- compare_cmd = ['compare', '-metric', 'PHASH', '-', 'null:']
+ compare_cmd = ['compare', '-define', 'phash:colorspaces=sRGB,HCLp', '-metric', 'PHASH', '-', 'null:']
log.debug('comparing images with pipeline {} | {}',
convert_cmd, compare_cmd)
convert_proc = subprocess.Popen(