summary refs log tree commit diff
path: root/pkgs/tools/audio
diff options
context:
space:
mode:
authorDoron Behar <doron.behar@gmail.com>2021-12-19 22:36:18 +0200
committerGitHub <noreply@github.com>2021-12-19 22:36:18 +0200
commitde5d0afeba6a7d511d6e76ceeb8626cd0a54688e (patch)
tree6fa82328be8f6f454dd5783684a33d1d1e5841b3 /pkgs/tools/audio
parentba81dcc5c73b06b297738454e964ad227839d0e2 (diff)
parent5b12a5ea1adbbea74f1fbf97a90bd00baff17eb7 (diff)
downloadnixpkgs-de5d0afeba6a7d511d6e76ceeb8626cd0a54688e.tar
nixpkgs-de5d0afeba6a7d511d6e76ceeb8626cd0a54688e.tar.gz
nixpkgs-de5d0afeba6a7d511d6e76ceeb8626cd0a54688e.tar.bz2
nixpkgs-de5d0afeba6a7d511d6e76ceeb8626cd0a54688e.tar.lz
nixpkgs-de5d0afeba6a7d511d6e76ceeb8626cd0a54688e.tar.xz
nixpkgs-de5d0afeba6a7d511d6e76ceeb8626cd0a54688e.tar.zst
nixpkgs-de5d0afeba6a7d511d6e76ceeb8626cd0a54688e.zip
Merge pull request #151208 from NixOS/pkg/beets
Diffstat (limited to 'pkgs/tools/audio')
-rw-r--r--pkgs/tools/audio/beets/bash-completion-always-print.patch29
-rw-r--r--pkgs/tools/audio/beets/convert-plugin-ffmpeg-path.patch65
-rw-r--r--pkgs/tools/audio/beets/default.nix58
-rw-r--r--pkgs/tools/audio/beets/imagemagick-nix-path.patch20
-rw-r--r--pkgs/tools/audio/beets/keyfinder-default-bin.patch26
-rw-r--r--pkgs/tools/audio/beets/replaygain-default-ffmpeg.patch14
6 files changed, 102 insertions, 110 deletions
diff --git a/pkgs/tools/audio/beets/bash-completion-always-print.patch b/pkgs/tools/audio/beets/bash-completion-always-print.patch
index 7bc3e57117e..8a31fe22f72 100644
--- a/pkgs/tools/audio/beets/bash-completion-always-print.patch
+++ b/pkgs/tools/audio/beets/bash-completion-always-print.patch
@@ -1,33 +1,34 @@
 diff --git i/beets/ui/commands.py w/beets/ui/commands.py
-index 4d010f4b..0b023585 100755
+index 3a337401..d08a6763 100755
 --- i/beets/ui/commands.py
 +++ w/beets/ui/commands.py
-@@ -1741,20 +1741,6 @@ default_commands.append(config_cmd)
+@@ -1759,21 +1759,6 @@ default_commands.append(config_cmd)
  def print_completion(*args):
      for line in completion_script(default_commands + plugins.commands()):
-         print_(line, end=u'')
+         print_(line, end='')
 -    if not any(map(os.path.isfile, BASH_COMPLETION_PATHS)):
--        log.warning(u'Warning: Unable to find the bash-completion package. '
--                    u'Command line completion might not work.')
+-        log.warning('Warning: Unable to find the bash-completion package. '
+-                    'Command line completion might not work.')
+-
 -
 -BASH_COMPLETION_PATHS = map(syspath, [
--    u'/etc/bash_completion',
--    u'/usr/share/bash-completion/bash_completion',
--    u'/usr/local/share/bash-completion/bash_completion',
+-    '/etc/bash_completion',
+-    '/usr/share/bash-completion/bash_completion',
+-    '/usr/local/share/bash-completion/bash_completion',
 -    # SmartOS
--    u'/opt/local/share/bash-completion/bash_completion',
+-    '/opt/local/share/bash-completion/bash_completion',
 -    # Homebrew (before bash-completion2)
--    u'/usr/local/etc/bash_completion',
+-    '/usr/local/etc/bash_completion',
 -])
 -
  
  def completion_script(commands):
      """Yield the full completion shell script as strings.
 diff --git i/test/test_ui.py w/test/test_ui.py
-index 5cfed1fd..9d3dc458 100644
+index 9804b0a1..c3b53243 100644
 --- i/test/test_ui.py
 +++ w/test/test_ui.py
-@@ -1230,12 +1230,7 @@ class CompletionTest(_common.TestCase, TestHelper):
+@@ -1229,12 +1229,7 @@ class CompletionTest(_common.TestCase, TestHelper):
                                    stdout=subprocess.PIPE, env=env)
  
          # Load bash_completion library.
@@ -36,8 +37,8 @@ index 5cfed1fd..9d3dc458 100644
 -                bash_completion = path
 -                break
 -        else:
--            self.skipTest(u'bash-completion script not found')
-+        self.skipTest(u'bash-completion script not found')
+-            self.skipTest('bash-completion script not found')
++        self.skipTest('bash-completion script not found')
          try:
              with open(util.syspath(bash_completion), 'rb') as f:
                  tester.stdin.writelines(f)
diff --git a/pkgs/tools/audio/beets/convert-plugin-ffmpeg-path.patch b/pkgs/tools/audio/beets/convert-plugin-ffmpeg-path.patch
index bcc77179d79..1bc17893448 100644
--- a/pkgs/tools/audio/beets/convert-plugin-ffmpeg-path.patch
+++ b/pkgs/tools/audio/beets/convert-plugin-ffmpeg-path.patch
@@ -1,43 +1,34 @@
 diff --git i/beetsplug/convert.py w/beetsplug/convert.py
-index 70363f6e..2962aa4f 100644
+index 6bc07c28..039fb452 100644
 --- i/beetsplug/convert.py
 +++ w/beetsplug/convert.py
-@@ -81,7 +81,7 @@ def get_format(fmt=None):
-         command = config['convert']['command'].as_str()
-     elif 'opts' in keys:
-         # Undocumented option for backwards compatibility with < 1.3.1.
--        command = u'ffmpeg -i $source -y {0} $dest'.format(
-+        command = u'@ffmpeg@/bin/ffmpeg -i $source -y {0} $dest'.format(
-             config['convert']['opts'].as_str()
-         )
-     if 'extension' in keys:
-@@ -121,22 +121,22 @@ class ConvertPlugin(BeetsPlugin):
-             u'id3v23': u'inherit',
-             u'formats': {
-                 u'aac': {
--                    u'command': u'ffmpeg -i $source -y -vn -acodec aac '
-+                    u'command': u'@ffmpeg@/bin/ffmpeg -i $source -y -vn -acodec aac '
-                                 u'-aq 1 $dest',
-                     u'extension': u'm4a',
+@@ -118,22 +118,22 @@ class ConvertPlugin(BeetsPlugin):
+             'id3v23': 'inherit',
+             'formats': {
+                 'aac': {
+-                    'command': 'ffmpeg -i $source -y -vn -acodec aac '
++                    'command': '@ffmpeg@/bin/ffmpeg -i $source -y -vn -acodec aac '
+                     '-aq 1 $dest',
+                     'extension': 'm4a',
                  },
-                 u'alac': {
--                    u'command': u'ffmpeg -i $source -y -vn -acodec alac $dest',
-+                    u'command': u'@ffmpeg@/bin/ffmpeg -i $source -y -vn -acodec alac $dest',
-                     u'extension': u'm4a',
+                 'alac': {
+-                    'command': 'ffmpeg -i $source -y -vn -acodec alac $dest',
++                    'command': '@ffmpeg@/bin/ffmpeg -i $source -y -vn -acodec alac $dest',
+                     'extension': 'm4a',
                  },
--                u'flac': u'ffmpeg -i $source -y -vn -acodec flac $dest',
--                u'mp3': u'ffmpeg -i $source -y -vn -aq 2 $dest',
-+                u'flac': u'@ffmpeg@/bin/ffmpeg -i $source -y -vn -acodec flac $dest',
-+                u'mp3': u'@ffmpeg@/bin/ffmpeg -i $source -y -vn -aq 2 $dest',
-                 u'opus':
--                    u'ffmpeg -i $source -y -vn -acodec libopus -ab 96k $dest',
-+                    u'@ffmpeg@/bin/ffmpeg -i $source -y -vn -acodec libopus -ab 96k $dest',
-                 u'ogg':
--                    u'ffmpeg -i $source -y -vn -acodec libvorbis -aq 3 $dest',
-+                    u'@ffmpeg@/bin/ffmpeg -i $source -y -vn -acodec libvorbis -aq 3 $dest',
-                 u'wma':
--                    u'ffmpeg -i $source -y -vn -acodec wmav2 -vn $dest',
-+                    u'@ffmpeg@/bin/ffmpeg -i $source -y -vn -acodec wmav2 -vn $dest',
+-                'flac': 'ffmpeg -i $source -y -vn -acodec flac $dest',
+-                'mp3': 'ffmpeg -i $source -y -vn -aq 2 $dest',
++                'flac': '@ffmpeg@/bin/ffmpeg -i $source -y -vn -acodec flac $dest',
++                'mp3': '@ffmpeg@/bin/ffmpeg -i $source -y -vn -aq 2 $dest',
+                 'opus':
+-                    'ffmpeg -i $source -y -vn -acodec libopus -ab 96k $dest',
++                    '@ffmpeg@/bin/ffmpeg -i $source -y -vn -acodec libopus -ab 96k $dest',
+                 'ogg':
+-                    'ffmpeg -i $source -y -vn -acodec libvorbis -aq 3 $dest',
++                    '@ffmpeg@/bin/ffmpeg -i $source -y -vn -acodec libvorbis -aq 3 $dest',
+                 'wma':
+-                    'ffmpeg -i $source -y -vn -acodec wmav2 -vn $dest',
++                    '@ffmpeg@/bin/ffmpeg -i $source -y -vn -acodec wmav2 -vn $dest',
              },
-             u'max_bitrate': 500,
-             u'auto': False,
+             'max_bitrate': 500,
+             'auto': False,
diff --git a/pkgs/tools/audio/beets/default.nix b/pkgs/tools/audio/beets/default.nix
index 7114d6801b4..6789bd5f962 100644
--- a/pkgs/tools/audio/beets/default.nix
+++ b/pkgs/tools/audio/beets/default.nix
@@ -1,6 +1,18 @@
-{ stdenv, lib, fetchFromGitHub, writeScript, glibcLocales, diffPlugins, substituteAll
-, pythonPackages, imagemagick, gobject-introspection, gst_all_1
-, runtimeShell, unstableGitUpdater
+{ stdenv
+, lib
+, fetchFromGitHub
+, writeScript
+, glibcLocales
+, diffPlugins
+, substituteAll
+, pythonPackages
+# can be null, if you wish to disable a reference to it. It's needed for the
+# artresizer, see:
+# https://beets.readthedocs.io/en/v1.6.0/plugins/fetchart.html#image-resizing
+, imagemagick
+, gobject-introspection
+, gst_all_1
+, runtimeShell
 
 # external plugins package set
 , beetsExternalPlugins
@@ -73,9 +85,9 @@ let
   };
 
   pluginsWithoutDeps = [
-    "bareasc" "bench" "bpd" "bpm" "bucket" "duplicates" "edit" "embedart"
+    "albumtypes" "bareasc" "bench" "bpd" "bpm" "bucket" "duplicates" "edit" "embedart"
     "export" "filefilter" "fish" "freedesktop" "fromfilename" "ftintitle" "fuzzy"
-    "hook" "ihate" "importadded" "importfeeds" "info" "inline" "ipfs"
+    "hook" "ihate" "importadded" "importfeeds" "info" "inline" "ipfs" "gmusic"
     "mbcollection" "mbsubmit" "mbsync" "metasync" "missing" "parentwork" "permissions" "play"
     "plexupdate" "random" "rewrite" "scrub" "smartplaylist" "spotify" "the"
     "types" "unimported" "zero"
@@ -89,24 +101,15 @@ let
   testShell = "${bashInteractive}/bin/bash --norc";
   completion = "${bash-completion}/share/bash-completion/bash_completion";
 
-  # This is a stripped down beets for testing of the external plugins.
-  externalTestArgs.beets = (lib.beets.override {
-    enableAlternatives = false;
-    enableCopyArtifacts = false;
-    enableExtraFiles = false;
-  }).overrideAttrs (lib.const {
-    doInstallCheck = false;
-  });
-
 in pythonPackages.buildPythonApplication rec {
   pname = "beets";
-  version = "1.5.0";
+  version = "1.6.0";
 
   src = fetchFromGitHub {
     owner = "beetbox";
     repo = "beets";
     rev = "v${version}";
-    sha256 = "sha256-yQMCJUwpjDDhPffBS6LUq6z4iT1VyFQE0R27XEbYXbY=";
+    sha256 = "sha256-fT+rCJJQR7bdfAcmeFRaknmh4ZOP4RCx8MXpq7/D8tM=";
   };
 
   propagatedBuildInputs = [
@@ -152,7 +155,6 @@ in pythonPackages.buildPythonApplication rec {
   ;
 
   buildInputs = [
-    imagemagick
   ] ++ (with gst_all_1; [
     gst-plugins-base
     gst-plugins-good
@@ -167,7 +169,7 @@ in pythonPackages.buildPythonApplication rec {
     responses
     # Although considered as plugin dependencies, they are needed for the
     # tests, for disabling them via an override makes the build fail. see:
-    # https://github.com/beetbox/beets/blob/v1.4.9/setup.py
+    # https://github.com/beetbox/beets/blob/v1.6.0/setup.py
     pylast
     mpd2
     discogs-client
@@ -177,10 +179,14 @@ in pythonPackages.buildPythonApplication rec {
   patches = [
     # Bash completion fix for Nix
     ./bash-completion-always-print.patch
-    # From some reason upstream assumes the program 'keyfinder-cli' is located
-    # in the path as `KeyFinder`
-    ./keyfinder-default-bin.patch
   ]
+    # Fix path to imagemagick, used for the artresizer.py file. This reference
+    # to imagemagick might be expensive for some people, so the patch can be
+    # disabled if imagemagick is set to null
+    ++ lib.optional (imagemagick != null) (substituteAll {
+      src = ./imagemagick-nix-path.patch;
+      inherit imagemagick;
+    })
     # We need to force ffmpeg as the default, since we do not package
     # bs1770gain, and set the absolute path there, to avoid impurities.
     ++ lib.optional enableReplaygain (substituteAll {
@@ -200,13 +206,10 @@ in pythonPackages.buildPythonApplication rec {
 
   # Disable failing tests
   postPatch = ''
-    sed -i -e '/assertIn.*item.*path/d' test/test_info.py
     echo echo completion tests passed > test/rsrc/test_completion.sh
 
+    # https://github.com/beetbox/beets/issues/1187
     sed -i -e 's/len(mf.images)/0/' test/test_zero.py
-
-    # Google Play Music was discontinued
-    rm -r beetsplug/gmusic.py
   '';
 
   postInstall = ''
@@ -256,7 +259,10 @@ in pythonPackages.buildPythonApplication rec {
     runHook postInstallCheck
   '';
 
-  makeWrapperArgs = [ "--set GI_TYPELIB_PATH \"$GI_TYPELIB_PATH\"" "--set GST_PLUGIN_SYSTEM_PATH_1_0 \"$GST_PLUGIN_SYSTEM_PATH_1_0\"" ];
+  makeWrapperArgs = [
+    "--set GI_TYPELIB_PATH \"$GI_TYPELIB_PATH\""
+    "--set GST_PLUGIN_SYSTEM_PATH_1_0 \"$GST_PLUGIN_SYSTEM_PATH_1_0\""
+  ];
 
   passthru = {
     # FIXME: remove in favor of pkgs.beetsExternalPlugins
diff --git a/pkgs/tools/audio/beets/imagemagick-nix-path.patch b/pkgs/tools/audio/beets/imagemagick-nix-path.patch
new file mode 100644
index 00000000000..9a77703ede7
--- /dev/null
+++ b/pkgs/tools/audio/beets/imagemagick-nix-path.patch
@@ -0,0 +1,20 @@
+diff --git i/beets/util/artresizer.py w/beets/util/artresizer.py
+index 8683e228..2f38b4d6 100644
+--- i/beets/util/artresizer.py
++++ w/beets/util/artresizer.py
+@@ -334,13 +334,8 @@ class ArtResizer(metaclass=Shareable):
+         # not, fall back to the older, separate convert and identify
+         # commands.
+         if self.method[0] == IMAGEMAGICK:
+-            self.im_legacy = self.method[2]
+-            if self.im_legacy:
+-                self.im_convert_cmd = ['convert']
+-                self.im_identify_cmd = ['identify']
+-            else:
+-                self.im_convert_cmd = ['magick']
+-                self.im_identify_cmd = ['magick', 'identify']
++            self.im_convert_cmd = ['@imagemagick@/bin/magick']
++            self.im_identify_cmd = ['@imagemagick@/bin/magick', 'identify']
+ 
+     def resize(
+         self, maxwidth, path_in, path_out=None, quality=0, max_filesize=0
diff --git a/pkgs/tools/audio/beets/keyfinder-default-bin.patch b/pkgs/tools/audio/beets/keyfinder-default-bin.patch
deleted file mode 100644
index ec6bc3a5561..00000000000
--- a/pkgs/tools/audio/beets/keyfinder-default-bin.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-diff --git a/beetsplug/keyfinder.py b/beetsplug/keyfinder.py
-index 702003f0..08689cd8 100644
---- a/beetsplug/keyfinder.py
-+++ b/beetsplug/keyfinder.py
-@@ -31,7 +31,7 @@ class KeyFinderPlugin(BeetsPlugin):
-     def __init__(self):
-         super(KeyFinderPlugin, self).__init__()
-         self.config.add({
--            u'bin': u'KeyFinder',
-+            u'bin': u'keyfinder-cli',
-             u'auto': True,
-             u'overwrite': False,
-         })
-diff --git a/test/test_keyfinder.py b/test/test_keyfinder.py
-index c8735e47..d7d670a4 100644
---- a/test/test_keyfinder.py
-+++ b/test/test_keyfinder.py
-@@ -44,7 +44,7 @@ class KeyFinderTest(unittest.TestCase, TestHelper):
-         item.load()
-         self.assertEqual(item['initial_key'], 'C#m')
-         command_output.assert_called_with(
--            ['KeyFinder', '-f', util.syspath(item.path)])
-+            ['keyfinder-cli', util.syspath(item.path)])
-
-     def test_add_key_on_import(self, command_output):
-         command_output.return_value = util.CommandOutput(b"dbm", b"")
diff --git a/pkgs/tools/audio/beets/replaygain-default-ffmpeg.patch b/pkgs/tools/audio/beets/replaygain-default-ffmpeg.patch
index 0ceba3c0944..e441997cae5 100644
--- a/pkgs/tools/audio/beets/replaygain-default-ffmpeg.patch
+++ b/pkgs/tools/audio/beets/replaygain-default-ffmpeg.patch
@@ -1,26 +1,26 @@
 diff --git i/beetsplug/replaygain.py w/beetsplug/replaygain.py
-index 9d6fa23c..c5800039 100644
+index b6297d93..5c1cbbc0 100644
 --- i/beetsplug/replaygain.py
 +++ w/beetsplug/replaygain.py
-@@ -391,7 +391,7 @@ class FfmpegBackend(Backend):
+@@ -139,7 +139,7 @@ class FfmpegBackend(Backend):
  
      def __init__(self, config, log):
-         super(FfmpegBackend, self).__init__(config, log)
+         super().__init__(config, log)
 -        self._ffmpeg_path = "ffmpeg"
 +        self._ffmpeg_path = "@ffmpeg@/bin/ffmpeg"
  
          # check that ffmpeg is installed
          try:
-@@ -1228,11 +1228,10 @@ class ReplayGainPlugin(BeetsPlugin):
+@@ -975,11 +975,10 @@ class ReplayGainPlugin(BeetsPlugin):
      def __init__(self):
-         super(ReplayGainPlugin, self).__init__()
+         super().__init__()
  
 -        # default backend is 'command' for backward-compatibility.
          self.config.add({
              'overwrite': False,
              'auto': True,
--            'backend': u'command',
-+            'backend': u'ffmpeg',
+-            'backend': 'command',
++            'backend': 'ffmpeg',
              'threads': cpu_count(),
              'parallel_on_import': False,
              'per_disc': False,