about summary refs log tree commit diff
diff options
context:
space:
mode:
authorlegendofmiracles <legendofmiracles@protonmail.com>2021-11-21 15:40:15 -0600
committerJonathan Ringer <jonringer@users.noreply.github.com>2021-11-24 13:49:33 -0800
commitc85680db4fb2137cad8e2395c02d2ad4a5af59cc (patch)
tree5cff0ecf0a43e0bae5ed947057de843346e54660
parentab7d727c97d4ff90bb9009a1746a9313b6416fed (diff)
mpvScripts.video-cutter: init at unstable-2021-02-03
-rw-r--r--pkgs/applications/video/mpv/scripts/cutter.nix47
-rw-r--r--pkgs/top-level/all-packages.nix1
2 files changed, 48 insertions, 0 deletions
diff --git a/pkgs/applications/video/mpv/scripts/cutter.nix b/pkgs/applications/video/mpv/scripts/cutter.nix
new file mode 100644
index 0000000000000..a4f6255fae85b
--- /dev/null
+++ b/pkgs/applications/video/mpv/scripts/cutter.nix
@@ -0,0 +1,47 @@
+{ lib, stdenvNoCC, fetchFromGitHub, makeWrapper }:
+
+stdenvNoCC.mkDerivation {
+  pname = "video-cutter";
+  version = "unstable-2021-02-03";
+
+  src = fetchFromGitHub {
+    owner = "rushmj";
+    repo = "mpv-video-cutter";
+    rev = "718d6ce9356e63fdd47208ec44f575a212b9068a";
+    sha256 = "sha256-ramID1DPl0UqEzevpqdYKb9aaW3CAy3Dy9CPb/oJ4eY=";
+  };
+
+  dontBuild = true;
+  dontCheck = true;
+
+  nativeBuildInputs = [ makeWrapper ];
+
+  postPatch = ''
+    substituteInPlace cutter.lua \
+      --replace '~/.config/mpv/scripts/c_concat.sh' '${placeholder "out"}/share/mpv/scripts/c_concat.sh'
+
+    # needs to be ran separately so that we can replace everything, and not every single mention explicitly
+    # original script places them in the scripts folder, just spawning unnecessary errors
+    # i know that hardcoding .config and especially the .mpv directory isn't best practice, but I didn't want to deviate too much from upstream
+    substituteInPlace cutter.lua \
+      --replace '~/.config/mpv/scripts' "''${XDG_CONFIG_HOME:-~/.config}/mpv/cutter"
+  '';
+
+  installPhase = ''
+    install -Dm755 c_concat.sh $out/share/mpv/scripts/c_concat.sh
+    install cutter.lua $out/share/mpv/scripts/cutter.lua
+
+    wrapProgram $out/share/mpv/scripts/c_concat.sh \
+      --run "mkdir -p ~/.config/mpv/cutter/"
+  '';
+
+  passthru.scriptName = "cutter.lua";
+
+  meta = with lib; {
+    description = "Cut videos and concat them automatically";
+    homepage = "https://github.com/rushmj/mpv-video-cutter";
+    # repo doesn't have a license
+    license = licenses.unfree;
+    maintainers = with maintainers; [ legendofmiracles ];
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index a79915ac60e1a..10a1b558a0427 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -26963,6 +26963,7 @@ with pkgs;
     sponsorblock = callPackage ../applications/video/mpv/scripts/sponsorblock.nix {};
     thumbnail = callPackage ../applications/video/mpv/scripts/thumbnail.nix { };
     youtube-quality = callPackage ../applications/video/mpv/scripts/youtube-quality.nix { };
+    cutter = callPackage ../applications/video/mpv/scripts/cutter.nix { };
   };
 
   mrpeach = callPackage ../applications/audio/pd-plugins/mrpeach { };