about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBernardo Meurer <bernardo@meurer.org>2021-01-03 23:44:03 +0000
committerGitHub <noreply@github.com>2021-01-03 23:44:03 +0000
commit77d190f10931c1d06d87bf6d772bf65346c71777 (patch)
tree768dbb2c5f927fa1973aec963d6513df77b80a40
parentd14652cee3c51670379d22e1b428ec6cd13feeac (diff)
parent264f7981eefac5171e75e10c13517e3241f6eb30 (diff)
Merge pull request #108275 from lovesegfault/beetsUnstable
beets: 1.4.9 -> unstable-2020-12-22
-rw-r--r--pkgs/applications/audio/bs1770gain/default.nix22
-rw-r--r--pkgs/tools/audio/beets/badfiles-plugin-nix-paths.patch21
-rw-r--r--pkgs/tools/audio/beets/bash-completion-always-print.patch43
-rw-r--r--pkgs/tools/audio/beets/compatibility-with-breaking-changes-to-the-ast-module.patch55
-rw-r--r--pkgs/tools/audio/beets/convert-plugin-ffmpeg-path.patch43
-rw-r--r--pkgs/tools/audio/beets/default.nix179
-rw-r--r--pkgs/tools/audio/beets/keyfinder-default-bin.patch20
-rw-r--r--pkgs/tools/audio/beets/mutagen-1.43.patch40
-rw-r--r--pkgs/tools/audio/beets/plugins/alternatives.nix (renamed from pkgs/tools/audio/beets/alternatives-plugin.nix)0
-rw-r--r--pkgs/tools/audio/beets/plugins/check-tests.patch (renamed from pkgs/tools/audio/beets/beet-check-tests.patch)0
-rw-r--r--pkgs/tools/audio/beets/plugins/check.nix (renamed from pkgs/tools/audio/beets/check-plugin.nix)0
-rw-r--r--pkgs/tools/audio/beets/plugins/copyartifacts.nix (renamed from pkgs/tools/audio/beets/copyartifacts-plugin.nix)0
-rw-r--r--pkgs/tools/audio/beets/plugins/extrafiles.nix (renamed from pkgs/tools/audio/beets/extrafiles-plugin.nix)0
-rw-r--r--pkgs/tools/audio/beets/replaygain-default-bs1770gain.patch17
-rw-r--r--pkgs/tools/audio/beets/replaygain-default-ffmpeg.patch26
-rw-r--r--pkgs/top-level/aliases.nix1
-rw-r--r--pkgs/top-level/all-packages.nix2
17 files changed, 236 insertions, 233 deletions
diff --git a/pkgs/applications/audio/bs1770gain/default.nix b/pkgs/applications/audio/bs1770gain/default.nix
deleted file mode 100644
index 76a789356193b..0000000000000
--- a/pkgs/applications/audio/bs1770gain/default.nix
+++ /dev/null
@@ -1,22 +0,0 @@
-{ stdenv, fetchurl, ffmpeg, sox }:
-
-stdenv.mkDerivation rec {
-  pname = "bs1770gain";
-  version = "0.5.2";
-
-  src = fetchurl {
-    url = "mirror://sourceforge/bs1770gain/${pname}-${version}.tar.gz";
-    sha256 = "1p6yz5q7czyf9ard65sp4kawdlkg40cfscr3b24znymmhs3p7rbk";
-  };
-
-  buildInputs = [ ffmpeg sox ];
-
-  NIX_CFLAGS_COMPILE = "-Wno-error";
-
-  meta = with stdenv.lib; {
-    description = "A audio/video loudness scanner implementing ITU-R BS.1770";
-    license = licenses.gpl2Plus;
-    homepage = "http://bs1770gain.sourceforge.net/";
-    platforms = platforms.all;
-  };
-}
diff --git a/pkgs/tools/audio/beets/badfiles-plugin-nix-paths.patch b/pkgs/tools/audio/beets/badfiles-plugin-nix-paths.patch
new file mode 100644
index 0000000000000..6956183344c47
--- /dev/null
+++ b/pkgs/tools/audio/beets/badfiles-plugin-nix-paths.patch
@@ -0,0 +1,21 @@
+diff --git i/beetsplug/badfiles.py w/beetsplug/badfiles.py
+index 36b45de3..5208b696 100644
+--- i/beetsplug/badfiles.py
++++ w/beetsplug/badfiles.py
+@@ -71,14 +71,14 @@ class BadFiles(BeetsPlugin):
+         return status, errors, [line for line in output.split("\n") if line]
+ 
+     def check_mp3val(self, path):
+-        status, errors, output = self.run_command(["mp3val", path])
++        status, errors, output = self.run_command(["@mp3val@/bin/mp3val", path])
+         if status == 0:
+             output = [line for line in output if line.startswith("WARNING:")]
+             errors = len(output)
+         return status, errors, output
+ 
+     def check_flac(self, path):
+-        return self.run_command(["flac", "-wst", path])
++        return self.run_command(["@flac@/bin/flac", "-wst", path])
+ 
+     def check_custom(self, command):
+         def checker(path):
diff --git a/pkgs/tools/audio/beets/bash-completion-always-print.patch b/pkgs/tools/audio/beets/bash-completion-always-print.patch
new file mode 100644
index 0000000000000..7bc3e57117e32
--- /dev/null
+++ b/pkgs/tools/audio/beets/bash-completion-always-print.patch
@@ -0,0 +1,43 @@
+diff --git i/beets/ui/commands.py w/beets/ui/commands.py
+index 4d010f4b..0b023585 100755
+--- i/beets/ui/commands.py
++++ w/beets/ui/commands.py
+@@ -1741,20 +1741,6 @@ default_commands.append(config_cmd)
+ def print_completion(*args):
+     for line in completion_script(default_commands + plugins.commands()):
+         print_(line, end=u'')
+-    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.')
+-
+-BASH_COMPLETION_PATHS = map(syspath, [
+-    u'/etc/bash_completion',
+-    u'/usr/share/bash-completion/bash_completion',
+-    u'/usr/local/share/bash-completion/bash_completion',
+-    # SmartOS
+-    u'/opt/local/share/bash-completion/bash_completion',
+-    # Homebrew (before bash-completion2)
+-    u'/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
+--- i/test/test_ui.py
++++ w/test/test_ui.py
+@@ -1230,12 +1230,7 @@ class CompletionTest(_common.TestCase, TestHelper):
+                                   stdout=subprocess.PIPE, env=env)
+ 
+         # Load bash_completion library.
+-        for path in commands.BASH_COMPLETION_PATHS:
+-            if os.path.exists(util.syspath(path)):
+-                bash_completion = path
+-                break
+-        else:
+-            self.skipTest(u'bash-completion script not found')
++        self.skipTest(u'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/compatibility-with-breaking-changes-to-the-ast-module.patch b/pkgs/tools/audio/beets/compatibility-with-breaking-changes-to-the-ast-module.patch
deleted file mode 100644
index 4865b6f623418..0000000000000
--- a/pkgs/tools/audio/beets/compatibility-with-breaking-changes-to-the-ast-module.patch
+++ /dev/null
@@ -1,55 +0,0 @@
-From 771ce704ebeac4cd9bd74b3ddde9fb01f3dc7eb4 Mon Sep 17 00:00:00 2001
-From: wisp3rwind <17089248+wisp3rwind@users.noreply.github.com>
-Date: Tue, 9 Jun 2020 19:34:31 +0200
-Subject: [PATCH] compatibility with breaking changes to the ast module
-
-new in 3.10, also backported to 3.8 and 3.9: https://github.com/python/cpython/pull/20649
-In fact, our generation of some Literals has been invalid since Python
-3.4, fix that too.
----
- beets/util/functemplate.py | 29 ++++++++++++++++++++---------
- 1 file changed, 20 insertions(+), 9 deletions(-)
-
-diff --git a/beets/util/functemplate.py b/beets/util/functemplate.py
-index af22b790..266534a9 100644
---- a/beets/util/functemplate.py
-+++ b/beets/util/functemplate.py
-@@ -73,15 +73,26 @@ def ex_literal(val):
-     """An int, float, long, bool, string, or None literal with the given
-     value.
-     """
--    if val is None:
--        return ast.Name('None', ast.Load())
--    elif isinstance(val, six.integer_types):
--        return ast.Num(val)
--    elif isinstance(val, bool):
--        return ast.Name(bytes(val), ast.Load())
--    elif isinstance(val, six.string_types):
--        return ast.Str(val)
--    raise TypeError(u'no literal for {0}'.format(type(val)))
-+    if sys.version_info[:2] < (3, 4):
-+        if val is None:
-+            return ast.Name('None', ast.Load())
-+        elif isinstance(val, six.integer_types):
-+            return ast.Num(val)
-+        elif isinstance(val, bool):
-+            return ast.Name(bytes(val), ast.Load())
-+        elif isinstance(val, six.string_types):
-+            return ast.Str(val)
-+        raise TypeError(u'no literal for {0}'.format(type(val)))
-+    elif sys.version_info[:2] < (3, 6):
-+        if val in [None, True, False]:
-+            return ast.NameConstant(val)
-+        elif isinstance(val, six.integer_types):
-+            return ast.Num(val)
-+        elif isinstance(val, six.string_types):
-+            return ast.Str(val)
-+        raise TypeError(u'no literal for {0}'.format(type(val)))
-+    else:
-+        return ast.Constant(val)
- 
- 
- def ex_varassign(name, expr):
--- 
-2.27.0
-
diff --git a/pkgs/tools/audio/beets/convert-plugin-ffmpeg-path.patch b/pkgs/tools/audio/beets/convert-plugin-ffmpeg-path.patch
new file mode 100644
index 0000000000000..bcc77179d7968
--- /dev/null
+++ b/pkgs/tools/audio/beets/convert-plugin-ffmpeg-path.patch
@@ -0,0 +1,43 @@
+diff --git i/beetsplug/convert.py w/beetsplug/convert.py
+index 70363f6e..2962aa4f 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',
+                 },
+                 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',
+                 },
+-                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',
+             },
+             u'max_bitrate': 500,
+             u'auto': False,
diff --git a/pkgs/tools/audio/beets/default.nix b/pkgs/tools/audio/beets/default.nix
index 56551891a4a5f..f72692c845c7f 100644
--- a/pkgs/tools/audio/beets/default.nix
+++ b/pkgs/tools/audio/beets/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, writeScript, glibcLocales, diffPlugins
+{ stdenv, lib, fetchFromGitHub, writeScript, glibcLocales, diffPlugins, substituteAll
 , pythonPackages, imagemagick, gobject-introspection, gst_all_1
 , runtimeShell
 , fetchpatch
@@ -6,61 +6,70 @@
 # Attributes needed for tests of the external plugins
 , callPackage, beets
 
-, enableAbsubmit       ? stdenv.lib.elem stdenv.hostPlatform.system essentia-extractor.meta.platforms, essentia-extractor ? null
-, enableAcousticbrainz ? true
-, enableAcoustid       ? true
-, enableBadfiles       ? true, flac ? null, mp3val ? null
-, enableConvert        ? true, ffmpeg_3 ? null
-, enableDiscogs        ? true
-, enableEmbyupdate     ? true
-, enableFetchart       ? true
-, enableGmusic         ? true
-, enableKeyfinder      ? true, keyfinder-cli ? null
-, enableKodiupdate     ? true
-, enableLastfm         ? true
-, enableLoadext        ? true
-, enableMpd            ? true
-, enablePlaylist       ? true
-, enableReplaygain     ? true, bs1770gain ? null
-, enableSonosUpdate    ? true
-, enableSubsonicupdate ? true
-, enableThumbnails     ? true
-, enableWeb            ? true
+, enableAbsubmit         ? lib.elem stdenv.hostPlatform.system essentia-extractor.meta.platforms, essentia-extractor ? null
+, enableAcousticbrainz   ? true
+, enableAcoustid         ? true
+, enableBadfiles         ? true, flac ? null, mp3val ? null
+, enableBeatport         ? true
+, enableBpsync           ? true
+, enableConvert          ? true, ffmpeg ? null
+, enableDeezer           ? true
+, enableDiscogs          ? true
+, enableEmbyupdate       ? true
+, enableFetchart         ? true
+, enableGmusic           ? true
+, enableKeyfinder        ? true, keyfinder-cli ? null
+, enableKodiupdate       ? true
+, enableLastfm           ? true
+, enableLoadext          ? true
+, enableMpd              ? true
+, enablePlaylist         ? true
+, enableReplaygain       ? true
+, enableSonosUpdate      ? true
+, enableSubsonicplaylist ? true
+, enableSubsonicupdate   ? true
+, enableThumbnails       ? true
+, enableWeb              ? true
 
 # External plugins
-, enableAlternatives   ? false
-, enableCheck          ? false, liboggz ? null
-, enableCopyArtifacts  ? false
-, enableExtraFiles     ? false
+, enableAlternatives     ? false
+, enableCheck            ? false, liboggz ? null
+, enableCopyArtifacts    ? false
+, enableExtraFiles       ? false
 
 , bashInteractive, bash-completion
 }:
 
-assert enableAbsubmit    -> essentia-extractor            != null;
-assert enableAcoustid    -> pythonPackages.pyacoustid     != null;
+assert enableAbsubmit    -> essentia-extractor               != null;
+assert enableAcoustid    -> pythonPackages.pyacoustid        != null;
 assert enableBadfiles    -> flac != null && mp3val != null;
+assert enableBeatport    -> pythonPackages.requests_oauthlib != null;
+assert enableBpsync      -> enableBeatport;
 assert enableCheck       -> flac != null && mp3val != null && liboggz != null;
-assert enableConvert     -> ffmpeg_3 != null;
-assert enableDiscogs     -> pythonPackages.discogs_client != null;
-assert enableFetchart    -> pythonPackages.responses      != null;
-assert enableGmusic      -> pythonPackages.gmusicapi      != null;
-assert enableKeyfinder   -> keyfinder-cli != null;
-assert enableLastfm      -> pythonPackages.pylast         != null;
-assert enableMpd         -> pythonPackages.mpd2           != null;
-assert enableReplaygain  -> bs1770gain                    != null;
-assert enableSonosUpdate -> pythonPackages.soco           != null;
-assert enableThumbnails  -> pythonPackages.pyxdg          != null;
-assert enableWeb         -> pythonPackages.flask          != null;
-
-with stdenv.lib;
+assert enableConvert     -> ffmpeg                         != null;
+assert enableDiscogs     -> pythonPackages.discogs_client    != null;
+assert enableFetchart    -> pythonPackages.responses         != null;
+assert enableGmusic      -> pythonPackages.gmusicapi         != null;
+assert enableKeyfinder   -> keyfinder-cli                    != null;
+assert enableLastfm      -> pythonPackages.pylast            != null;
+assert enableMpd         -> pythonPackages.mpd2              != null;
+assert enableReplaygain  -> ffmpeg                         != null;
+assert enableSonosUpdate -> pythonPackages.soco              != null;
+assert enableThumbnails  -> pythonPackages.pyxdg             != null;
+assert enableWeb         -> pythonPackages.flask             != null;
+
+with lib;
 
 let
   optionalPlugins = {
     absubmit = enableAbsubmit;
     acousticbrainz = enableAcousticbrainz;
     badfiles = enableBadfiles;
+    beatport = enableBeatport;
+    bpsync = enableBpsync;
     chroma = enableAcoustid;
     convert = enableConvert;
+    deezer = enableDeezer;
     discogs = enableDiscogs;
     embyupdate = enableEmbyupdate;
     fetchart = enableFetchart;
@@ -75,18 +84,19 @@ let
     playlist = enablePlaylist;
     replaygain = enableReplaygain;
     sonosupdate = enableSonosUpdate;
+    subsonicplaylist = enableSubsonicplaylist;
     subsonicupdate = enableSubsonicupdate;
     thumbnails = enableThumbnails;
     web = enableWeb;
   };
 
   pluginsWithoutDeps = [
-    "beatport" "bench" "bpd" "bpm" "bucket" "cue" "duplicates" "edit" "embedart"
-    "export" "filefilter" "freedesktop" "fromfilename" "ftintitle" "fuzzy"
+    "bench" "bpd" "bpm" "bucket" "cue" "duplicates" "edit" "embedart"
+    "export" "filefilter" "fish" "freedesktop" "fromfilename" "ftintitle" "fuzzy"
     "hook" "ihate" "importadded" "importfeeds" "info" "inline" "ipfs" "lyrics"
-    "mbcollection" "mbsubmit" "mbsync" "metasync" "missing" "permissions" "play"
+    "mbcollection" "mbsubmit" "mbsync" "metasync" "missing" "parentwork" "permissions" "play"
     "plexupdate" "random" "rewrite" "scrub" "smartplaylist" "spotify" "the"
-    "types" "zero"
+    "types" "unimported" "zero"
   ];
 
   enabledOptionalPlugins = attrNames (filterAttrs (_: id) optionalPlugins);
@@ -102,28 +112,33 @@ let
     enableAlternatives = false;
     enableCopyArtifacts = false;
     enableExtraFiles = false;
-  }).overrideAttrs (stdenv.lib.const {
+  }).overrideAttrs (const {
     doInstallCheck = false;
   });
 
   pluginArgs = externalTestArgs // { inherit pythonPackages; };
 
   plugins = {
-    alternatives = callPackage ./alternatives-plugin.nix pluginArgs;
-    check = callPackage ./check-plugin.nix pluginArgs;
-    copyartifacts = callPackage ./copyartifacts-plugin.nix pluginArgs;
-    extrafiles = callPackage ./extrafiles-plugin.nix pluginArgs;
+    alternatives = callPackage ./plugins/alternatives.nix pluginArgs;
+    check = callPackage ./plugins/check.nix pluginArgs;
+    copyartifacts = callPackage ./plugins/copyartifacts.nix pluginArgs;
+    extrafiles = callPackage ./plugins/extrafiles.nix pluginArgs;
   };
 
 in pythonPackages.buildPythonApplication rec {
   pname = "beets";
-  version = "1.4.9";
+  # While there is a stable version, 1.4.9, it is more than 1000 commits behind
+  # master and lacks many bug fixes and improvements[1]. Also important,
+  # unstable does not require bs1770gain[2].
+  # [1]: https://discourse.beets.io/t/forming-a-beets-core-team/639
+  # [2]: https://github.com/NixOS/nixpkgs/pull/90504
+  version = "unstable-2020-12-22";
 
   src = fetchFromGitHub {
     owner = "beetbox";
     repo = "beets";
-    rev = "v${version}";
-    sha256 = "1qxdqbzvz97zgykzdwn78g2xyxmg0q2jdb12dnjnrwvhmjv67vi8";
+    rev = "53dcb24d10788897f20c341774b474808ec2c0b6";
+    sha256 = "sha256-P++NA13T2TRHW3Se10np8BSe/WRBYAKRte5xKoHKW50=";
   };
 
   propagatedBuildInputs = [
@@ -137,19 +152,25 @@ in pythonPackages.buildPythonApplication rec {
     pythonPackages.unidecode
     pythonPackages.gst-python
     pythonPackages.pygobject3
+    pythonPackages.reflink
+    pythonPackages.confuse
+    pythonPackages.mediafile
     gobject-introspection
   ] ++ optional enableAbsubmit      essentia-extractor
     ++ optional enableAcoustid      pythonPackages.pyacoustid
+    ++ optional enableBeatport      pythonPackages.requests_oauthlib
     ++ optional (enableFetchart
+              || enableDeezer
               || enableEmbyupdate
               || enableKodiupdate
               || enableLoadext
               || enablePlaylist
+              || enableSubsonicplaylist
               || enableSubsonicupdate
               || enableAcousticbrainz)
                                     pythonPackages.requests
     ++ optional enableCheck         plugins.check
-    ++ optional enableConvert       ffmpeg_3
+    ++ optional enableConvert       ffmpeg
     ++ optional enableDiscogs       pythonPackages.discogs_client
     ++ optional enableGmusic        pythonPackages.gmusicapi
     ++ optional enableKeyfinder     keyfinder-cli
@@ -187,41 +208,35 @@ in pythonPackages.buildPythonApplication rec {
   ];
 
   patches = [
-    ./replaygain-default-bs1770gain.patch
+    # 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
-    ./mutagen-1.43.patch
-    (fetchpatch {
-      # Fixes failing testcases around the werkzeug component; can dropped after 1.4.9
-      url = "https://github.com/beetbox/beets/commit/d43d54e21cde97f57f19486925ab56b419254cc8.patch";
-      sha256 = "13n2gzmcgfi0m2ycl2r1hpczgksplnkc3y6b66vg57rx5y8nnv5c";
+  ]
+    # 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 {
+      src = ./replaygain-default-ffmpeg.patch;
+      ffmpeg = getBin ffmpeg;
     })
+    # Put absolute Nix paths in place
+    ++ lib.optional enableConvert (substituteAll {
+      src = ./convert-plugin-ffmpeg-path.patch;
+      ffmpeg = getBin ffmpeg;
+    })
+    ++ lib.optional enableBadfiles (substituteAll {
+      src = ./badfiles-plugin-nix-paths.patch;
+      inherit mp3val flac;
+    })
+  ;
 
-    # Fixes 548 tests due to breaking changes to the ast module
-    # https://github.com/beetbox/beets/pull/3621
-    # Can be dropped after 1.4.9
-    ./compatibility-with-breaking-changes-to-the-ast-module.patch
-  ];
-
+  # 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
 
-    sed -i -e '/^BASH_COMPLETION_PATHS *=/,/^])$/ {
-      /^])$/i u"${completion}"
-    }' beets/ui/commands.py
-  '' + optionalString enableBadfiles ''
-    sed -i -e '/self\.run_command(\[/ {
-      s,"flac","${flac.bin}/bin/flac",
-      s,"mp3val","${mp3val}/bin/mp3val",
-    }' beetsplug/badfiles.py
-  '' + optionalString enableConvert ''
-    sed -i -e 's,\(util\.command_output(\)\([^)]\+\)),\1[b"${ffmpeg_3.bin}/bin/ffmpeg" if args[0] == b"ffmpeg" else args[0]] + \2[1:]),' beetsplug/convert.py
-  '' + optionalString enableReplaygain ''
-    sed -i -re '
-      s!^( *cmd *= *b?['\'''"])(bs1770gain['\'''"])!\1${bs1770gain}/bin/\2!
-    ' beetsplug/replaygain.py
-    sed -i -e 's/if has_program.*bs1770gain.*:/if True:/' \
-      test/test_replaygain.py
+    sed -i -e 's/len(mf.images)/0/' test/test_zero.py
   '';
 
   postInstall = ''
@@ -281,7 +296,7 @@ in pythonPackages.buildPythonApplication rec {
     description = "Music tagger and library organizer";
     homepage = "http://beets.io";
     license = licenses.mit;
-    maintainers = with maintainers; [ aszlig domenkozar pjones ];
+    maintainers = with maintainers; [ aszlig domenkozar doronbehar lovesegfault pjones ];
     platforms = platforms.linux;
   };
 }
diff --git a/pkgs/tools/audio/beets/keyfinder-default-bin.patch b/pkgs/tools/audio/beets/keyfinder-default-bin.patch
index 1ea195a678e8c..ec6bc3a5561c5 100644
--- a/pkgs/tools/audio/beets/keyfinder-default-bin.patch
+++ b/pkgs/tools/audio/beets/keyfinder-default-bin.patch
@@ -1,8 +1,8 @@
 diff --git a/beetsplug/keyfinder.py b/beetsplug/keyfinder.py
-index 34a4abc..59e8539 100644
+index 702003f0..08689cd8 100644
 --- a/beetsplug/keyfinder.py
 +++ b/beetsplug/keyfinder.py
-@@ -30,7 +30,7 @@ class KeyFinderPlugin(BeetsPlugin):
+@@ -31,7 +31,7 @@ class KeyFinderPlugin(BeetsPlugin):
      def __init__(self):
          super(KeyFinderPlugin, self).__init__()
          self.config.add({
@@ -11,18 +11,8 @@ index 34a4abc..59e8539 100644
              u'auto': True,
              u'overwrite': False,
          })
-@@ -59,8 +59,7 @@ class KeyFinderPlugin(BeetsPlugin):
-                 continue
- 
-             try:
--                output = util.command_output([bin, '-f',
--                                              util.syspath(item.path)])
-+                output = util.command_output([bin, util.syspath(item.path)])
-             except (subprocess.CalledProcessError, OSError) as exc:
-                 self._log.error(u'execution failed: {0}', exc)
-                 continue
 diff --git a/test/test_keyfinder.py b/test/test_keyfinder.py
-index 57e2bcd..c1ee916 100644
+index c8735e47..d7d670a4 100644
 --- a/test/test_keyfinder.py
 +++ b/test/test_keyfinder.py
 @@ -44,7 +44,7 @@ class KeyFinderTest(unittest.TestCase, TestHelper):
@@ -31,6 +21,6 @@ index 57e2bcd..c1ee916 100644
          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 = 'dbm'
+         command_output.return_value = util.CommandOutput(b"dbm", b"")
diff --git a/pkgs/tools/audio/beets/mutagen-1.43.patch b/pkgs/tools/audio/beets/mutagen-1.43.patch
deleted file mode 100644
index d0d448c15e9a5..0000000000000
--- a/pkgs/tools/audio/beets/mutagen-1.43.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-Backport
-https://github.com/beetbox/mediafile/commit/b3343c4ee08d1251ae5e2344401a2f5892b4e868
-https://github.com/beetbox/mediafile/commit/d2fc3b59f77c515b02dfe7ad936f89264375d2b4
-to Beets 1.4.9.
-
-diff --git i/setup.py w/setup.py
-index 79278f8b..b8d60687 100755
---- i/setup.py
-+++ w/setup.py
-@@ -87,7 +87,7 @@ setup(
- 
-     install_requires=[
-         'six>=1.9',
--        'mutagen>=1.33',
-+        'mutagen>=1.43',
-         'unidecode',
-         'musicbrainzngs>=0.4',
-         'pyyaml',
-diff --git i/test/test_mediafile.py w/test/test_mediafile.py
-index 36a2c53a..0ddde44e 100644
---- i/test/test_mediafile.py
-+++ w/test/test_mediafile.py
-@@ -888,7 +888,7 @@ class WavpackTest(ReadWriteTestBase, unittest.TestCase):
-         'bitrate': 109312,
-         'format': u'WavPack',
-         'samplerate': 44100,
--        'bitdepth': 0,
-+        'bitdepth': 16,
-         'channels': 1,
-     }
- 
-@@ -912,7 +912,7 @@ class AIFFTest(ReadWriteTestBase, unittest.TestCase):
-         'bitrate': 705600,
-         'format': u'AIFF',
-         'samplerate': 44100,
--        'bitdepth': 0,
-+        'bitdepth': 16,
-         'channels': 1,
-     }
- 
diff --git a/pkgs/tools/audio/beets/alternatives-plugin.nix b/pkgs/tools/audio/beets/plugins/alternatives.nix
index fdad7dd89844b..fdad7dd89844b 100644
--- a/pkgs/tools/audio/beets/alternatives-plugin.nix
+++ b/pkgs/tools/audio/beets/plugins/alternatives.nix
diff --git a/pkgs/tools/audio/beets/beet-check-tests.patch b/pkgs/tools/audio/beets/plugins/check-tests.patch
index 2de97b86c8b44..2de97b86c8b44 100644
--- a/pkgs/tools/audio/beets/beet-check-tests.patch
+++ b/pkgs/tools/audio/beets/plugins/check-tests.patch
diff --git a/pkgs/tools/audio/beets/check-plugin.nix b/pkgs/tools/audio/beets/plugins/check.nix
index 241dcdad45213..241dcdad45213 100644
--- a/pkgs/tools/audio/beets/check-plugin.nix
+++ b/pkgs/tools/audio/beets/plugins/check.nix
diff --git a/pkgs/tools/audio/beets/copyartifacts-plugin.nix b/pkgs/tools/audio/beets/plugins/copyartifacts.nix
index 9432cb9bd0b95..9432cb9bd0b95 100644
--- a/pkgs/tools/audio/beets/copyartifacts-plugin.nix
+++ b/pkgs/tools/audio/beets/plugins/copyartifacts.nix
diff --git a/pkgs/tools/audio/beets/extrafiles-plugin.nix b/pkgs/tools/audio/beets/plugins/extrafiles.nix
index 7d0e446ce6051..7d0e446ce6051 100644
--- a/pkgs/tools/audio/beets/extrafiles-plugin.nix
+++ b/pkgs/tools/audio/beets/plugins/extrafiles.nix
diff --git a/pkgs/tools/audio/beets/replaygain-default-bs1770gain.patch b/pkgs/tools/audio/beets/replaygain-default-bs1770gain.patch
deleted file mode 100644
index 538f9e9330398..0000000000000
--- a/pkgs/tools/audio/beets/replaygain-default-bs1770gain.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-diff --git a/beetsplug/replaygain.py b/beetsplug/replaygain.py
-index 40b3a3a..9b54a5a 100644
---- a/beetsplug/replaygain.py
-+++ b/beetsplug/replaygain.py
-@@ -627,11 +627,10 @@ class ReplayGainPlugin(BeetsPlugin):
-         super(ReplayGainPlugin, self).__init__()
-         self.import_stages = [self.imported]
- 
--        # default backend is 'command' for backward-compatibility.
-         self.config.add({
-             'overwrite': False,
-             'auto': True,
--            'backend': u'command',
-+            'backend': u'bs1770gain',
-             'targetlevel': 89,
-         })
- 
diff --git a/pkgs/tools/audio/beets/replaygain-default-ffmpeg.patch b/pkgs/tools/audio/beets/replaygain-default-ffmpeg.patch
new file mode 100644
index 0000000000000..0ceba3c094423
--- /dev/null
+++ b/pkgs/tools/audio/beets/replaygain-default-ffmpeg.patch
@@ -0,0 +1,26 @@
+diff --git i/beetsplug/replaygain.py w/beetsplug/replaygain.py
+index 9d6fa23c..c5800039 100644
+--- i/beetsplug/replaygain.py
++++ w/beetsplug/replaygain.py
+@@ -391,7 +391,7 @@ class FfmpegBackend(Backend):
+ 
+     def __init__(self, config, log):
+         super(FfmpegBackend, self).__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):
+     def __init__(self):
+         super(ReplayGainPlugin, self).__init__()
+ 
+-        # default backend is 'command' for backward-compatibility.
+         self.config.add({
+             'overwrite': False,
+             'auto': True,
+-            'backend': u'command',
++            'backend': u'ffmpeg',
+             'threads': cpu_count(),
+             'parallel_on_import': False,
+             'per_disc': False,
diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix
index 6f95da017edd8..4a4277c207299 100644
--- a/pkgs/top-level/aliases.nix
+++ b/pkgs/top-level/aliases.nix
@@ -78,6 +78,7 @@ mapAliases ({
   bittorrentSync = throw "bittorrentSync has been deprecated by resilio-sync."; # added 2019-06-03
   bittorrentSync14 = throw "bittorrentSync14 has been deprecated by resilio-sync."; # added 2019-06-03
   bittorrentSync20 = throw "bittorrentSync20 has been deprecated by resilio-sync."; # added 2019-06-03
+  bs1770gain = throw "bs1770gain has been removed from nixpkgs, as it had no maintainer or reverse dependencies."; # added 2021-01-02
   btc1 = throw "btc1 has been removed, it was abandoned by upstream"; # added 2020-11-03
   buildPerlPackage = perlPackages.buildPerlPackage; # added 2018-10-12
   buildGo112Package = throw "buildGo112Package has been removed"; # added 2020-04-26
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 0e53bfa0bc248..6824961426791 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -20801,8 +20801,6 @@ in
 
   bristol = callPackage ../applications/audio/bristol { };
 
-  bs1770gain = callPackage ../applications/audio/bs1770gain { };
-
   bjumblr = callPackage ../applications/audio/bjumblr { };
 
   bschaffl = callPackage ../applications/audio/bschaffl { };