summary refs log tree commit diff
path: root/pkgs/applications/audio/whipper
diff options
context:
space:
mode:
authorJan Tojnar <jtojnar@gmail.com>2018-09-13 16:42:28 +0200
committerJan Tojnar <jtojnar@gmail.com>2018-09-14 20:31:33 +0200
commita74b4cf6ace5ca9c30b3bcc3c49ff00354f63e70 (patch)
treeae63d751ab59c338c2d050b5c40fc35e5e98d463 /pkgs/applications/audio/whipper
parent884c629832c663c0c6b82d17bbe15ec48ca3f5c7 (diff)
whipper: replace morituri
morituri has been dead for a while now and uses gst-python which is
no longer supported wth Python 2. whipper is a maintained fork,
packaged, for example, in Arch.
Diffstat (limited to 'pkgs/applications/audio/whipper')
-rw-r--r--pkgs/applications/audio/whipper/default.nix48
-rw-r--r--pkgs/applications/audio/whipper/paths.patch105
2 files changed, 153 insertions, 0 deletions
diff --git a/pkgs/applications/audio/whipper/default.nix b/pkgs/applications/audio/whipper/default.nix
new file mode 100644
index 0000000000000..162d5459d6488
--- /dev/null
+++ b/pkgs/applications/audio/whipper/default.nix
@@ -0,0 +1,48 @@
+{ stdenv, fetchFromGitHub, python2, cdparanoia, cdrdao, flac
+, sox, accuraterip-checksum, utillinux, substituteAll }:
+
+python2.pkgs.buildPythonApplication rec {
+  name = "whipper-${version}";
+  version = "0.7.0";
+
+  src = fetchFromGitHub {
+    owner = "JoeLametta";
+    repo = "whipper";
+    rev = "v${version}";
+    sha256 = "04m8s0s9dcnly9l6id8vv99n9kbjrjid79bss52ay9yvwng0frmj";
+  };
+
+  pythonPath = with python2.pkgs; [
+    pygobject2 musicbrainzngs urllib3 chardet
+    pycdio setuptools mutagen
+    requests
+  ];
+
+  checkInputs = with python2.pkgs; [
+    twisted
+  ];
+
+  patches = [
+    (substituteAll {
+      src = ./paths.patch;
+      inherit cdrdao cdparanoia utillinux flac sox;
+      accurateripChecksum = accuraterip-checksum;
+    })
+  ];
+
+  # some tests require internet access
+  # https://github.com/JoeLametta/whipper/issues/291
+  doCheck = false;
+
+  preCheck = ''
+    HOME=$TMPDIR
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/JoeLametta/whipper;
+    description = "A CD ripper aiming for accuracy over speed";
+    maintainers = with maintainers; [ rycee jgeerds ];
+    license = licenses.gpl3Plus;
+    platforms = platforms.linux;
+  };
+}
diff --git a/pkgs/applications/audio/whipper/paths.patch b/pkgs/applications/audio/whipper/paths.patch
new file mode 100644
index 0000000000000..9fe9f7a57c51d
--- /dev/null
+++ b/pkgs/applications/audio/whipper/paths.patch
@@ -0,0 +1,105 @@
+--- a/whipper/program/arc.py
++++ b/whipper/program/arc.py
+@@ -3,8 +3,8 @@
+ import logging
+ logger = logging.getLogger(__name__)
+ 
+-ARB = 'accuraterip-checksum'
+-FLAC = 'flac'
++ARB = '@accurateripChecksum@/bin/accuraterip-checksum'
++FLAC = '@flac@/bin/flac'
+ 
+ 
+ def _execute(cmd, **redirects):
+--- a/whipper/program/cdparanoia.py
++++ b/whipper/program/cdparanoia.py
+@@ -280,10 +280,10 @@
+ 
+         bufsize = 1024
+         if self._overread:
+-            argv = ["cd-paranoia", "--stderr-progress",
++            argv = ["@cdparanoia@/bin/cdparanoia", "--stderr-progress",
+                     "--sample-offset=%d" % self._offset, "--force-overread", ]
+         else:
+-            argv = ["cd-paranoia", "--stderr-progress",
++            argv = ["@cdparanoia@/bin/cdparanoia", "--stderr-progress",
+                     "--sample-offset=%d" % self._offset, ]
+         if self._device:
+             argv.extend(["--force-cdrom-device", self._device, ])
+@@ -560,7 +560,7 @@
+ 
+ def getCdParanoiaVersion():
+     getter = common.VersionGetter('cd-paranoia',
+-                                  ["cd-paranoia", "-V"],
++                                  ["@cdparanoia@/bin/cdparanoia", "-V"],
+                                   _VERSION_RE,
+                                   "%(version)s %(release)s")
+ 
+@@ -585,7 +585,7 @@
+     def __init__(self, device=None):
+         # cdparanoia -A *always* writes cdparanoia.log
+         self.cwd = tempfile.mkdtemp(suffix='.whipper.cache')
+-        self.command = ['cd-paranoia', '-A']
++        self.command = ['@cdparanoia@/bin/cdparanoia', '-A']
+         if device:
+             self.command += ['-d', device]
+ 
+--- a/whipper/program/cdrdao.py
++++ b/whipper/program/cdrdao.py
+@@ -9,7 +9,7 @@
+ import logging
+ logger = logging.getLogger(__name__)
+ 
+-CDRDAO = 'cdrdao'
++CDRDAO = '@cdrdao@/bin/cdrdao'
+ 
+ 
+ def read_toc(device, fast_toc=False):
+--- a/whipper/program/sox.py
++++ b/whipper/program/sox.py
+@@ -4,7 +4,7 @@
+ import logging
+ logger = logging.getLogger(__name__)
+ 
+-SOX = 'sox'
++SOX = '@sox@/bin/sox'
+ 
+ 
+ def peak_level(track_path):
+--- a/whipper/program/soxi.py
++++ b/whipper/program/soxi.py
+@@ -6,7 +6,7 @@
+ import logging
+ logger = logging.getLogger(__name__)
+ 
+-SOXI = 'soxi'
++SOXI = '@sox@/bin/soxi'
+ 
+ 
+ class AudioLengthTask(ctask.PopenTask):
+--- a/whipper/program/utils.py
++++ b/whipper/program/utils.py
+@@ -9,7 +9,7 @@
+     Eject the given device.
+     """
+     logger.debug("ejecting device %s", device)
+-    os.system('eject %s' % device)
++    os.system('@utillinux@/bin/eject %s' % device)
+ 
+ 
+ def load_device(device):
+@@ -17,7 +17,7 @@
+     Load the given device.
+     """
+     logger.debug("loading (eject -t) device %s", device)
+-    os.system('eject -t %s' % device)
++    os.system('@utillinux@/bin/eject -t %s' % device)
+ 
+ 
+ def unmount_device(device):
+@@ -32,4 +32,4 @@
+     proc = open('/proc/mounts').read()
+     if device in proc:
+         print 'Device %s is mounted, unmounting' % device
+-        os.system('umount %s' % device)
++        os.system('@utillinux@/bin/umount %s' % device)