From 68c504fa8ffed81a4d666b059865cb0ebf85c70b Mon Sep 17 00:00:00 2001 From: aszlig Date: Fri, 18 Dec 2015 02:03:00 +0100 Subject: [PATCH] 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 --- pkgs/tools/audio/beets/default.nix | 13 +++++++++---- ...ls.patch => replaygain-default-bs1770gain.patch} | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) rename pkgs/tools/audio/beets/{replaygain-default-audiotools.patch => replaygain-default-bs1770gain.patch} (93%) 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 similarity index 93% rename from pkgs/tools/audio/beets/replaygain-default-audiotools.patch rename to 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, })