mpvScripts: Refactor drvs for mpv's builtin scripts

This commit is contained in:
nicoo 2023-10-17 15:20:30 +00:00
parent 0c7f041600
commit 34105536c8
6 changed files with 33 additions and 79 deletions

View File

@ -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 ];
};
}

View File

@ -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;
};
}

View File

@ -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;
};
}

View File

@ -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;
};
}

View File

@ -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

View File

@ -0,0 +1,32 @@
{ lib
, buildLua
, mpv-unwrapped
}:
let mkBuiltin = name: args:
buildLua (lib.attrsets.recursiveUpdate rec {
inherit (mpv-unwrapped) src version;
pname = "mpv-${name}";
scriptPath = "TOOLS/lua/${name}.lua";
meta = with lib; {
inherit (mpv-unwrapped.meta) license;
homepage = "https://github.com/mpv-player/mpv/blob/master/${scriptPath}";
};
} 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 ];
};
}