about summary refs log tree commit diff
path: root/pkgs/applications/video
diff options
context:
space:
mode:
authorPeder Bergebakken Sundt <pbsds@hotmail.com>2023-12-28 17:22:20 +0100
committerGitHub <noreply@github.com>2023-12-28 17:22:20 +0100
commitc227074c1bcaa14d2548a39c1eb01d50d3efcd04 (patch)
tree6a3f0ec8cec9aef816f9007c454e56b90bf0c514 /pkgs/applications/video
parente2b40f683401b9ba63f6544148fa38b38e31ee53 (diff)
parentfd1fed39d26a1db7373ff452297db583273ee695 (diff)
Merge pull request #273155 from nbraud/mpvScripts/mpv
mpvScripts: Refactor drvs for mpv's builtin scripts
Diffstat (limited to 'pkgs/applications/video')
-rw-r--r--pkgs/applications/video/mpv/scripts/acompressor.nix17
-rw-r--r--pkgs/applications/video/mpv/scripts/autocrop.nix19
-rw-r--r--pkgs/applications/video/mpv/scripts/autodeint.nix19
-rw-r--r--pkgs/applications/video/mpv/scripts/autoload.nix20
-rw-r--r--pkgs/applications/video/mpv/scripts/default.nix5
-rw-r--r--pkgs/applications/video/mpv/scripts/mpv.nix35
6 files changed, 36 insertions, 79 deletions
diff --git a/pkgs/applications/video/mpv/scripts/acompressor.nix b/pkgs/applications/video/mpv/scripts/acompressor.nix
deleted file mode 100644
index d82d12f163e7f..0000000000000
--- a/pkgs/applications/video/mpv/scripts/acompressor.nix
+++ /dev/null
@@ -1,17 +0,0 @@
-{ lib
-, buildLua
-, mpv-unwrapped
-}:
-
-buildLua {
-  inherit (mpv-unwrapped) src version;
-  pname = "mpv-acompressor";
-  scriptPath = "TOOLS/lua/acompressor.lua";
-
-  meta = with lib; {
-    inherit (mpv-unwrapped.meta) license;
-    description = "Script to toggle and control ffmpeg's dynamic range compression filter.";
-    homepage = "https://github.com/mpv-player/mpv/blob/master/TOOLS/lua/acompressor.lua";
-    maintainers = with maintainers; [ nicoo ];
-  };
-}
diff --git a/pkgs/applications/video/mpv/scripts/autocrop.nix b/pkgs/applications/video/mpv/scripts/autocrop.nix
deleted file mode 100644
index 645a4dd16899f..0000000000000
--- a/pkgs/applications/video/mpv/scripts/autocrop.nix
+++ /dev/null
@@ -1,19 +0,0 @@
-{ stdenvNoCC, mpv-unwrapped, lib }:
-
-stdenvNoCC.mkDerivation rec {
-  pname = "mpv-autocrop";
-  version = mpv-unwrapped.version;
-  src = "${mpv-unwrapped.src.outPath}/TOOLS/lua/autocrop.lua";
-  dontBuild = true;
-  dontUnpack = true;
-  installPhase = ''
-    install -Dm644 ${src} $out/share/mpv/scripts/autocrop.lua
-  '';
-  passthru.scriptName = "autocrop.lua";
-
-  meta = {
-    description = "This script uses the lavfi cropdetect filter to automatically insert a crop filter with appropriate parameters for the currently playing video.";
-    homepage = "https://github.com/mpv-player/mpv/blob/master/TOOLS/lua/autocrop.lua";
-    license = lib.licenses.gpl2Plus;
-  };
-}
diff --git a/pkgs/applications/video/mpv/scripts/autodeint.nix b/pkgs/applications/video/mpv/scripts/autodeint.nix
deleted file mode 100644
index b5369b748faf6..0000000000000
--- a/pkgs/applications/video/mpv/scripts/autodeint.nix
+++ /dev/null
@@ -1,19 +0,0 @@
-{ stdenvNoCC, mpv-unwrapped, lib }:
-
-stdenvNoCC.mkDerivation rec {
-  pname = "mpv-autodeint";
-  version = mpv-unwrapped.version;
-  src = "${mpv-unwrapped.src.outPath}/TOOLS/lua/autodeint.lua";
-  dontBuild = true;
-  dontUnpack = true;
-  installPhase = ''
-    install -Dm644 ${src} $out/share/mpv/scripts/autodeint.lua
-  '';
-  passthru.scriptName = "autodeint.lua";
-
-  meta = {
-    description = "This script uses the lavfi idet filter to automatically insert the appropriate deinterlacing filter based on a short section of the currently playing video.";
-    homepage = "https://github.com/mpv-player/mpv/blob/master/TOOLS/lua/autodeint.lua";
-    license = lib.licenses.gpl2Plus;
-  };
-}
diff --git a/pkgs/applications/video/mpv/scripts/autoload.nix b/pkgs/applications/video/mpv/scripts/autoload.nix
deleted file mode 100644
index c4a85c50d9384..0000000000000
--- a/pkgs/applications/video/mpv/scripts/autoload.nix
+++ /dev/null
@@ -1,20 +0,0 @@
-{ stdenvNoCC, mpv-unwrapped, lib }:
-
-stdenvNoCC.mkDerivation rec {
-  pname = "mpv-autoload";
-  version = mpv-unwrapped.version;
-  src = "${mpv-unwrapped.src.outPath}/TOOLS/lua/autoload.lua";
-  dontBuild = true;
-  dontUnpack = true;
-  installPhase = ''
-    install -Dm644 ${src} $out/share/mpv/scripts/autoload.lua
-  '';
-  passthru.scriptName = "autoload.lua";
-
-  meta = {
-    description = "This script automatically loads playlist entries before and after the currently played file";
-    homepage = "https://github.com/mpv-player/mpv/blob/master/TOOLS/lua/autoload.lua";
-    maintainers = [ lib.maintainers.dawidsowa ];
-    license = lib.licenses.gpl2Plus;
-  };
-}
diff --git a/pkgs/applications/video/mpv/scripts/default.nix b/pkgs/applications/video/mpv/scripts/default.nix
index 9154e3adf4904..3520138a7d60d 100644
--- a/pkgs/applications/video/mpv/scripts/default.nix
+++ b/pkgs/applications/video/mpv/scripts/default.nix
@@ -58,10 +58,6 @@ in
 
 lib.recurseIntoAttrs
   (lib.mapAttrs addTests ({
-    acompressor = callPackage ./acompressor.nix { inherit buildLua; };
-    autocrop = callPackage ./autocrop.nix { };
-    autodeint = callPackage ./autodeint.nix { };
-    autoload = callPackage ./autoload.nix { };
     chapterskip = callPackage ./chapterskip.nix { inherit buildLua; };
     convert = callPackage ./convert.nix { inherit buildLua; };
     cutter = callPackage ./cutter.nix { inherit buildLua; };
@@ -81,6 +77,7 @@ lib.recurseIntoAttrs
     vr-reversal = callPackage ./vr-reversal.nix { };
     webtorrent-mpv-hook = callPackage ./webtorrent-mpv-hook.nix { };
   }
+  // (callPackage ./mpv.nix      { inherit buildLua; })
   // (callPackage ./occivink.nix { inherit buildLua; })))
   // lib.optionalAttrs config.allowAliases {
   youtube-quality = throw "'youtube-quality' is no longer maintained, use 'quality-menu' instead"; # added 2023-07-14
diff --git a/pkgs/applications/video/mpv/scripts/mpv.nix b/pkgs/applications/video/mpv/scripts/mpv.nix
new file mode 100644
index 0000000000000..06e9ccb4d74a8
--- /dev/null
+++ b/pkgs/applications/video/mpv/scripts/mpv.nix
@@ -0,0 +1,35 @@
+{ lib
+, buildLua
+, mpv-unwrapped
+}:
+
+let mkBuiltin = name: args:
+  let srcPath = "TOOLS/lua/${name}.lua";
+  in buildLua (lib.attrsets.recursiveUpdate rec {
+    inherit (mpv-unwrapped) src version;
+    pname = "mpv-${name}";
+
+    dontUnpack = true;
+    scriptPath = "${src}/${srcPath}";
+
+    meta = with lib; {
+      inherit (mpv-unwrapped.meta) license;
+      homepage = "https://github.com/mpv-player/mpv/blob/v${version}/${srcPath}";
+    };
+  } args);
+
+in lib.mapAttrs (name: lib.makeOverridable (mkBuiltin name)) {
+  acompressor.meta = {
+    description = "Script to toggle and control ffmpeg's dynamic range compression filter.";
+    maintainers = with lib.maintainers; [ nicoo ];
+  };
+
+  autocrop.meta.description = "This script uses the lavfi cropdetect filter to automatically insert a crop filter with appropriate parameters for the currently playing video.";
+
+  autodeint.meta.description = "This script uses the lavfi idet filter to automatically insert the appropriate deinterlacing filter based on a short section of the currently playing video.";
+
+  autoload.meta = {
+    description = "This script automatically loads playlist entries before and after the currently played file";
+    maintainers = [ lib.maintainers.dawidsowa ];
+  };
+}