about summary refs log tree commit diff
path: root/pkgs/applications/audio/r128gain
diff options
context:
space:
mode:
authorAluísio Augusto Silva Gonçalves <aluisio@aasg.name>2020-02-11 15:02:24 -0300
committerJon <jonringer@users.noreply.github.com>2020-02-14 21:17:38 -0800
commit6f24be13ee1e28fb48dbd8cdc59edbf51633cbec (patch)
tree4c7e55b2397066fd35727495a8718951b029ea24 /pkgs/applications/audio/r128gain
parent07c817f9d21b1040863063911eb703a21e2ba052 (diff)
downloadnixlib-6f24be13ee1e28fb48dbd8cdc59edbf51633cbec.tar
nixlib-6f24be13ee1e28fb48dbd8cdc59edbf51633cbec.tar.gz
nixlib-6f24be13ee1e28fb48dbd8cdc59edbf51633cbec.tar.bz2
nixlib-6f24be13ee1e28fb48dbd8cdc59edbf51633cbec.tar.lz
nixlib-6f24be13ee1e28fb48dbd8cdc59edbf51633cbec.tar.xz
nixlib-6f24be13ee1e28fb48dbd8cdc59edbf51633cbec.tar.zst
nixlib-6f24be13ee1e28fb48dbd8cdc59edbf51633cbec.zip
r128gain: 0.9.3 -> 1.0.1
Switched the source to GitHub so that test files are available for
local, unsandboxed testing.
Diffstat (limited to 'pkgs/applications/audio/r128gain')
-rw-r--r--pkgs/applications/audio/r128gain/default.nix36
-rw-r--r--pkgs/applications/audio/r128gain/ffmpeg-location.patch31
2 files changed, 58 insertions, 9 deletions
diff --git a/pkgs/applications/audio/r128gain/default.nix b/pkgs/applications/audio/r128gain/default.nix
index c4d8a1c20167..fb2b30632761 100644
--- a/pkgs/applications/audio/r128gain/default.nix
+++ b/pkgs/applications/audio/r128gain/default.nix
@@ -1,19 +1,37 @@
-{ lib, python3Packages, ffmpeg }:
+{ lib
+, fetchFromGitHub
+, substituteAll
+, ffmpeg
+, python3Packages
+, sox
+}:
 
 python3Packages.buildPythonApplication rec {
   pname = "r128gain";
-  version = "0.9.3";
+  version = "1.0.1";
 
-  src = python3Packages.fetchPypi {
-    inherit pname version;
-    sha256 = "0dx2grryp0lj58bawx1zcq9a6b4ijz9r5qrg8h6nvm92kqlya26i";
+  src = fetchFromGitHub {
+    owner = "desbma";
+    repo = "r128gain";
+    rev = version;
+    sha256 = "0fnxis2g7mw8mb0cz9bws909lrndli7ml54nnzda49vc2fhbjwxr";
   };
 
-  propagatedBuildInputs = [ ffmpeg ]
-    ++ (with python3Packages; [ crcmod mutagen tqdm ])
-    ;
+  patches = [
+    (
+      substituteAll {
+        src = ./ffmpeg-location.patch;
+        inherit ffmpeg;
+      }
+    )
+  ];
 
-  doCheck = false; # downloads media files for testing
+  propagatedBuildInputs = with python3Packages; [ crcmod ffmpeg-python mutagen tqdm ];
+  checkInputs = with python3Packages; [ requests sox ];
+
+  # Testing downloads media files for testing, which requires the
+  # sandbox to be disabled.
+  doCheck = false;
 
   meta = with lib; {
     description = "Fast audio loudness scanner & tagger (ReplayGain v2 / R128)";
diff --git a/pkgs/applications/audio/r128gain/ffmpeg-location.patch b/pkgs/applications/audio/r128gain/ffmpeg-location.patch
new file mode 100644
index 000000000000..ff118024011e
--- /dev/null
+++ b/pkgs/applications/audio/r128gain/ffmpeg-location.patch
@@ -0,0 +1,31 @@
+diff --git i/r128gain/__init__.py w/r128gain/__init__.py
+index 53fc3ef..f144e15 100755
+--- i/r128gain/__init__.py
++++ w/r128gain/__init__.py
+@@ -78,7 +78,7 @@ def get_ffmpeg_lib_versions(ffmpeg_path=None):
+   Example: 0x3040100 for FFmpeg 3.4.1
+   """
+   r = collections.OrderedDict()
+-  cmd = (ffmpeg_path or "ffmpeg", "-version")
++  cmd = (ffmpeg_path or "@ffmpeg@/bin/ffmpeg", "-version")
+   output = subprocess.run(cmd,
+                           check=True,
+                           stdout=subprocess.PIPE,
+@@ -156,7 +156,7 @@ def get_r128_loudness(audio_filepaths, *, calc_peak=True, enable_ffmpeg_threadin
+                                      os.devnull,
+                                      **additional_ffmpeg_args,
+                                      f="null"),
+-                       cmd=ffmpeg_path or "ffmpeg")
++                       cmd=ffmpeg_path or "@ffmpeg@/bin/ffmpeg")
+ 
+   # run
+   logger().debug(cmd_to_string(cmd))
+@@ -740,7 +740,7 @@ def cl_main():
+                           help="Maximum number of tracks to scan in parallel. If not specified, autodetect CPU count")
+   arg_parser.add_argument("-f",
+                           "--ffmpeg-path",
+-                          default=shutil.which("ffmpeg"),
++                          default="@ffmpeg@/bin/ffmpeg",
+                           help="""Full file path of ffmpeg executable (only needed if not in PATH).
+                                   If not specified, autodetect""")
+   arg_parser.add_argument("-d",