summary refs log tree commit diff
path: root/pkgs/tools
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2015-12-18 02:03:00 +0100
committeraszlig <aszlig@redmoonstudios.org>2015-12-18 05:58:27 +0100
commit68c504fa8ffed81a4d666b059865cb0ebf85c70b (patch)
treeec5430d17038fa510d5743b435cad104eaed9260 /pkgs/tools
parent59455da5281f628b0269373d8dfd7323eb2a9737 (diff)
downloadnixlib-68c504fa8ffed81a4d666b059865cb0ebf85c70b.tar
nixlib-68c504fa8ffed81a4d666b059865cb0ebf85c70b.tar.gz
nixlib-68c504fa8ffed81a4d666b059865cb0ebf85c70b.tar.bz2
nixlib-68c504fa8ffed81a4d666b059865cb0ebf85c70b.tar.lz
nixlib-68c504fa8ffed81a4d666b059865cb0ebf85c70b.tar.xz
nixlib-68c504fa8ffed81a4d666b059865cb0ebf85c70b.tar.zst
nixlib-68c504fa8ffed81a4d666b059865cb0ebf85c70b.zip
beets: Use bs1770gain by default for replaygain
After trying with a dozen files, it seems the bs1770gain backend is much
more reliable than the audiotools backend and especially does a better
job (well, compared to audiotools which either does doing nothing at all
or throws an exception) when used on alboms that contain different
sample rates/sizes.

Additionally, we already had a few issues regarding the audiotools
backend, even to the extent that @sampsyco almost wanted to drop it
upstream (see sampsyco/beets#1342).

Also related issues are #10376 and sampsyo/beets#1592.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Diffstat (limited to 'pkgs/tools')
-rw-r--r--pkgs/tools/audio/beets/default.nix13
-rw-r--r--pkgs/tools/audio/beets/replaygain-default-bs1770gain.patch (renamed from pkgs/tools/audio/beets/replaygain-default-audiotools.patch)2
2 files changed, 10 insertions, 5 deletions
diff --git a/pkgs/tools/audio/beets/default.nix b/pkgs/tools/audio/beets/default.nix
index 123b183f2d30..7a678148944c 100644
--- a/pkgs/tools/audio/beets/default.nix
+++ b/pkgs/tools/audio/beets/default.nix
@@ -8,7 +8,7 @@
 , enableFetchart   ? true
 , enableLastfm     ? true
 , enableMpd        ? true
-, enableReplaygain ? true
+, enableReplaygain ? true, bs1770gain ? null
 , enableThumbnails ? true
 , enableWeb        ? true
 
@@ -22,7 +22,7 @@ assert enableEchonest    -> pythonPackages.pyechonest     != null;
 assert enableFetchart    -> pythonPackages.responses      != null;
 assert enableLastfm      -> pythonPackages.pylast         != null;
 assert enableMpd         -> pythonPackages.mpd            != null;
-assert enableReplaygain  -> pythonPackages.audiotools     != null;
+assert enableReplaygain  -> bs1770gain                    != null;
 assert enableThumbnails  -> pythonPackages.pyxdg          != null;
 assert enableWeb         -> pythonPackages.flask          != null;
 
@@ -90,7 +90,6 @@ in buildPythonPackage rec {
     ++ optional enableEchonest   pythonPackages.pyechonest
     ++ optional enableLastfm     pythonPackages.pylast
     ++ optional enableMpd        pythonPackages.mpd
-    ++ optional enableReplaygain pythonPackages.audiotools
     ++ optional enableThumbnails pythonPackages.pyxdg
     ++ optional enableWeb        pythonPackages.flask;
 
@@ -104,7 +103,7 @@ in buildPythonPackage rec {
   ];
 
   patches = [
-    ./replaygain-default-audiotools.patch
+    ./replaygain-default-bs1770gain.patch
   ];
 
   postPatch = ''
@@ -119,6 +118,12 @@ in buildPythonPackage rec {
       s,"flac","${flac}/bin/flac",
       s,"mp3val","${mp3val}/bin/mp3val",
     }' beetsplug/badfiles.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
   '';
 
   doCheck = true;
diff --git a/pkgs/tools/audio/beets/replaygain-default-audiotools.patch b/pkgs/tools/audio/beets/replaygain-default-bs1770gain.patch
index d852ea6fecaa..538f9e933039 100644
--- a/pkgs/tools/audio/beets/replaygain-default-audiotools.patch
+++ b/pkgs/tools/audio/beets/replaygain-default-bs1770gain.patch
@@ -11,7 +11,7 @@ index 40b3a3a..9b54a5a 100644
              'overwrite': False,
              'auto': True,
 -            'backend': u'command',
-+            'backend': u'audiotools',
++            'backend': u'bs1770gain',
              'targetlevel': 89,
          })