diff options
Diffstat (limited to 'nixpkgs/pkgs/applications/video/mpv')
11 files changed, 117 insertions, 89 deletions
diff --git a/nixpkgs/pkgs/applications/video/mpv/scripts/buildLua.nix b/nixpkgs/pkgs/applications/video/mpv/scripts/buildLua.nix index 046b0fa2ea96..c7f510253f94 100644 --- a/nixpkgs/pkgs/applications/video/mpv/scripts/buildLua.nix +++ b/nixpkgs/pkgs/applications/video/mpv/scripts/buildLua.nix @@ -5,31 +5,35 @@ let inherit (lib) hasPrefix hasSuffix removeSuffix; escapedList = with lib; concatMapStringsSep " " (s: "'${escape [ "'" ] s}'"); fileName = pathStr: lib.last (lib.splitString "/" pathStr); - nameFromPath = pathStr: - let fN = fileName pathStr; in - if hasSuffix ".lua" fN then - fN - else if !(hasPrefix "." fN) then - "${fN}.lua" - else - null - ; scriptsDir = "$out/share/mpv/scripts"; + + # similar to `lib.extends`, but with inverted precedence and recursive update + extendedBy = args: orig: self: + let super = args self; + in lib.recursiveUpdate (orig super) super + ; in -lib.makeOverridable ( + +lib.makeOverridable (args: stdenvNoCC.mkDerivation (extendedBy + (if lib.isFunction args then args else (_: args)) ( { pname , extraScripts ? [] , ... }@args: let + strippedName = with builtins; + let groups = match "mpv[-_](.*)" pname; in + if groups != null + then head groups + else pname + ; # either passthru.scriptName, inferred from scriptPath, or from pname scriptName = (args.passthru or {}).scriptName or ( - if args ? scriptPath && nameFromPath args.scriptPath != null - then nameFromPath args.scriptPath - else "${pname}.lua" + if args ? scriptPath + then fileName args.scriptPath + else "${strippedName}.lua" ); scriptPath = args.scriptPath or "./${scriptName}"; - in - stdenvNoCC.mkDerivation (lib.attrsets.recursiveUpdate { + in { dontBuild = true; preferLocalBuild = true; @@ -59,5 +63,5 @@ lib.makeOverridable ( passthru = { inherit scriptName; }; meta.platforms = lib.platforms.all; - } args) -) + }) +)) diff --git a/nixpkgs/pkgs/applications/video/mpv/scripts/chapterskip.nix b/nixpkgs/pkgs/applications/video/mpv/scripts/chapterskip.nix index bffc27bd1eac..20de5d88fd33 100644 --- a/nixpkgs/pkgs/applications/video/mpv/scripts/chapterskip.nix +++ b/nixpkgs/pkgs/applications/video/mpv/scripts/chapterskip.nix @@ -14,7 +14,13 @@ buildLua { }; meta = { + description = "Automatically skips chapters based on title"; + longDescription = '' + MPV script that skips chapters based on their title, categorized using regexes. + The set of skipped categories can be configured globally, or by an auto-profile. + ''; homepage = "https://github.com/po5/chapterskip"; + license = lib.licenses.unfree; # https://github.com/po5/chapterskip/issues/10 maintainers = with lib.maintainers; [ nicoo ]; }; } diff --git a/nixpkgs/pkgs/applications/video/mpv/scripts/cutter.nix b/nixpkgs/pkgs/applications/video/mpv/scripts/cutter.nix index 498fcb530a41..4c385b766c78 100644 --- a/nixpkgs/pkgs/applications/video/mpv/scripts/cutter.nix +++ b/nixpkgs/pkgs/applications/video/mpv/scripts/cutter.nix @@ -1,19 +1,16 @@ -{ lib, stdenvNoCC, fetchFromGitHub, makeWrapper }: +{ lib, buildLua, fetchFromGitHub, makeWrapper }: -stdenvNoCC.mkDerivation { +buildLua { pname = "video-cutter"; - version = "unstable-2021-02-03"; + version = "unstable-2023-11-09"; src = fetchFromGitHub { owner = "rushmj"; repo = "mpv-video-cutter"; - rev = "718d6ce9356e63fdd47208ec44f575a212b9068a"; - sha256 = "sha256-ramID1DPl0UqEzevpqdYKb9aaW3CAy3Dy9CPb/oJ4eY="; + rev = "01a0396c075d5f8bbd1de5b571e6231f8899ab65"; + sha256 = "sha256-veoRFzUCRH8TrvR7x+WWoycpDyxqrJZ/bnp61dVc0pE="; }; - dontBuild = true; - dontCheck = true; - nativeBuildInputs = [ makeWrapper ]; postPatch = '' @@ -27,21 +24,19 @@ stdenvNoCC.mkDerivation { --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 + passthru.scriptName = "cutter.lua"; + extraScripts = [ "c_concat.sh" ]; + postInstall = '' + chmod 0755 $out/share/mpv/scripts/c_concat.sh 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; + license = licenses.mit; maintainers = with maintainers; [ lom ]; }; } diff --git a/nixpkgs/pkgs/applications/video/mpv/scripts/default.nix b/nixpkgs/pkgs/applications/video/mpv/scripts/default.nix index fb75464ab98e..a529bf00ac6b 100644 --- a/nixpkgs/pkgs/applications/video/mpv/scripts/default.nix +++ b/nixpkgs/pkgs/applications/video/mpv/scripts/default.nix @@ -12,6 +12,7 @@ in lib.recurseIntoAttrs autoload = callPackage ./autoload.nix { }; chapterskip = callPackage ./chapterskip.nix { inherit buildLua; }; convert = callPackage ./convert.nix { inherit buildLua; }; + cutter = callPackage ./cutter.nix { inherit buildLua; }; inhibit-gnome = callPackage ./inhibit-gnome.nix { }; mpris = callPackage ./mpris.nix { }; mpv-playlistmanager = callPackage ./mpv-playlistmanager.nix { inherit buildLua; }; @@ -20,13 +21,13 @@ in lib.recurseIntoAttrs quality-menu = callPackage ./quality-menu.nix { inherit buildLua; }; simple-mpv-webui = callPackage ./simple-mpv-webui.nix { inherit buildLua; }; sponsorblock = callPackage ./sponsorblock.nix { }; + sponsorblock-minimal = callPackage ./sponsorblock-minimal.nix { inherit buildLua; }; thumbfast = callPackage ./thumbfast.nix { inherit buildLua; }; thumbnail = callPackage ./thumbnail.nix { inherit buildLua; }; - uosc = callPackage ./uosc.nix { }; - visualizer = callPackage ./visualizer.nix { }; + uosc = callPackage ./uosc.nix { inherit buildLua; }; + visualizer = callPackage ./visualizer.nix { inherit buildLua; }; vr-reversal = callPackage ./vr-reversal.nix { }; webtorrent-mpv-hook = callPackage ./webtorrent-mpv-hook.nix { }; - cutter = callPackage ./cutter.nix { }; } // (callPackage ./occivink.nix { inherit buildLua; })) // lib.optionalAttrs config.allowAliases { diff --git a/nixpkgs/pkgs/applications/video/mpv/scripts/mpv-playlistmanager.nix b/nixpkgs/pkgs/applications/video/mpv/scripts/mpv-playlistmanager.nix index 8ec05a3cf691..c164bae1495d 100644 --- a/nixpkgs/pkgs/applications/video/mpv/scripts/mpv-playlistmanager.nix +++ b/nixpkgs/pkgs/applications/video/mpv/scripts/mpv-playlistmanager.nix @@ -17,8 +17,6 @@ buildLua rec { 'youtube_dl_executable = "${lib.getBin yt-dlp}/bin/yt-dlp"', ''; - scriptPath = "playlistmanager.lua"; - meta = with lib; { description = "Mpv lua script to create and manage playlists"; homepage = "https://github.com/jonniek/mpv-playlistmanager"; diff --git a/nixpkgs/pkgs/applications/video/mpv/scripts/quality-menu.nix b/nixpkgs/pkgs/applications/video/mpv/scripts/quality-menu.nix index e4d82d17ca39..8b9aadaccbc7 100644 --- a/nixpkgs/pkgs/applications/video/mpv/scripts/quality-menu.nix +++ b/nixpkgs/pkgs/applications/video/mpv/scripts/quality-menu.nix @@ -15,7 +15,6 @@ buildLua rec { hash = "sha256-yrcTxqpLnOI1Tq3khhflO3wzhyeTPuvKifyH5/P57Ns="; }; - scriptPath = "quality-menu.lua"; extraScripts = lib.optional oscSupport "quality-menu-osc.lua"; meta = with lib; { diff --git a/nixpkgs/pkgs/applications/video/mpv/scripts/sponsorblock-minimal.nix b/nixpkgs/pkgs/applications/video/mpv/scripts/sponsorblock-minimal.nix new file mode 100644 index 000000000000..f7f8049cbba3 --- /dev/null +++ b/nixpkgs/pkgs/applications/video/mpv/scripts/sponsorblock-minimal.nix @@ -0,0 +1,32 @@ +{ lib +, buildLua +, fetchFromGitea +, curl +}: + +buildLua { + pname = "mpv_sponsorblock_minimal"; + version = "unstable-2023-08-20"; + scriptPath = "sponsorblock_minimal.lua"; + + src = fetchFromGitea { + domain = "codeberg.org"; + owner = "jouni"; + repo = "mpv_sponsorblock_minimal"; + rev = "ca2844b8cf7674bfccd282d389a50427742251d3"; + hash = "sha256-28HWZ6nOhKiE+5Ya1N3Vscd8aeH9OKS0t72e/xPfFQQ="; + }; + + preInstall = '' + substituteInPlace sponsorblock_minimal.lua \ + --replace "curl" "${lib.getExe curl}" + ''; + + meta = with lib; { + description = "A minimal script to skip sponsored segments of YouTube videos"; + homepage = "https://codeberg.org/jouni/mpv_sponsorblock_minimal"; + license = licenses.gpl3Only; + platforms = platforms.all; + maintainers = with maintainers; [ arthsmn ]; + }; +} diff --git a/nixpkgs/pkgs/applications/video/mpv/scripts/thumbfast.nix b/nixpkgs/pkgs/applications/video/mpv/scripts/thumbfast.nix index 0226074ca31b..3ddb701f6d1d 100644 --- a/nixpkgs/pkgs/applications/video/mpv/scripts/thumbfast.nix +++ b/nixpkgs/pkgs/applications/video/mpv/scripts/thumbfast.nix @@ -2,21 +2,18 @@ buildLua { pname = "mpv-thumbfast"; - version = "unstable-2023-06-04"; + version = "unstable-2023-12-08"; src = fetchFromGitHub { owner = "po5"; repo = "thumbfast"; - rev = "4241c7daa444d3859b51b65a39d30e922adb87e9"; - hash = "sha256-7EnFJVjEzqhWXAvhzURoOp/kad6WzwyidWxug6u8lVw="; + rev = "03e93feee5a85bf7c65db953ada41b4826e9f905"; + hash = "sha256-5u5WBvWOEydJrnr/vilEgW4+fxkxM6wNjb9Fyyxx/1c="; }; - postPatch = '' - substituteInPlace thumbfast.lua \ - --replace 'mpv_path = "mpv"' 'mpv_path = "${lib.getExe mpv-unwrapped}"' - ''; - - scriptPath = "thumbfast.lua"; + passthru.extraWrapperArgs = [ + "--prefix" "PATH" ":" "${lib.getBin mpv-unwrapped}/bin" + ]; meta = { description = "High-performance on-the-fly thumbnailer for mpv"; diff --git a/nixpkgs/pkgs/applications/video/mpv/scripts/uosc.nix b/nixpkgs/pkgs/applications/video/mpv/scripts/uosc.nix index b88cd2c5b968..4c434d49f368 100644 --- a/nixpkgs/pkgs/applications/video/mpv/scripts/uosc.nix +++ b/nixpkgs/pkgs/applications/video/mpv/scripts/uosc.nix @@ -1,42 +1,50 @@ -{ stdenvNoCC, lib, fetchFromGitHub, makeFontsConf }: - -stdenvNoCC.mkDerivation (finalAttrs: { +{ lib +, fetchFromGitHub +, fetchpatch +, makeFontsConf +, buildLua +, buildGoModule +}: + +buildLua (finalAttrs: { pname = "uosc"; - version = "4.7.0"; + version = "5.1.1"; + scriptPath = "src/uosc"; src = fetchFromGitHub { owner = "tomasklaen"; repo = "uosc"; rev = finalAttrs.version; - hash = "sha256-JqlBjhwRgmXl6XfHYTwtNWZj656EDHjcdWOlCgihF5I="; + hash = "sha256-+4k8T1yX3IRXK3XkUShsuJSH9w1Zla7CaRENcIqX4iM="; }; - postPatch = '' - substituteInPlace scripts/uosc.lua \ - --replace "mp.find_config_file('scripts')" "\"$out/share/mpv/scripts\"" - ''; - - dontBuild = true; - - installPhase = '' - runHook preInstall - - mkdir -p $out/share/mpv/ - cp -r scripts $out/share/mpv - cp -r fonts $out/share + tools = buildGoModule { + pname = "uosc-bin"; + inherit (finalAttrs) version src; + vendorHash = "sha256-nkY0z2GiDxfNs98dpe+wZNI3dAXcuHaD/nHiZ2XnZ1Y="; + }; - runHook postInstall - ''; + # Patch lua script to get the path to its `ziggy` binary form the environment + patches = [ + # uosc#814: Support overriding `ziggy_path` via environment variable + (fetchpatch { + url = "https://github.com/tomasklaen/uosc/commit/4fdf68a1bcb510824d66f35ecc7672a6452a44b2.patch"; + hash = "sha256-igUqFf8e7LVIIjGxACdIWAeZxjF/yqaCL4QRXrzNQXk="; + }) + ]; - passthru.scriptName = "uosc.lua"; # the script uses custom "texture" fonts as the background for ui elements. # In order for mpv to find them, we need to adjust the fontconfig search path. + postInstall = "cp -r src/fonts $out/share"; passthru.extraWrapperArgs = [ "--set" "FONTCONFIG_FILE" (toString (makeFontsConf { fontDirectories = [ "${finalAttrs.finalPackage}/share/fonts" ]; })) + "--set" + "MPV_UOSC_ZIGGY" + (lib.getExe' finalAttrs.tools "ziggy") ]; meta = with lib; { diff --git a/nixpkgs/pkgs/applications/video/mpv/scripts/visualizer.nix b/nixpkgs/pkgs/applications/video/mpv/scripts/visualizer.nix index a248b63d503a..dedc2c62e907 100644 --- a/nixpkgs/pkgs/applications/video/mpv/scripts/visualizer.nix +++ b/nixpkgs/pkgs/applications/video/mpv/scripts/visualizer.nix @@ -1,34 +1,22 @@ { lib, - stdenvNoCC, + buildLua, fetchFromGitHub, }: -stdenvNoCC.mkDerivation { +buildLua { pname = "visualizer"; - version = "unstable-2021-07-10"; + version = "unstable-2023-08-13"; src = fetchFromGitHub { owner = "mfcc64"; repo = "mpv-scripts"; - rev = "a0cd87eeb974a4602c5d8086b4051b5ab72f42e1"; - sha256 = "1xgd1nd117lpj3ppynhgaa5sbkfm7l8n6c9a2fy8p07is2dkndrq"; + rev = "7dbbfb283508714b73ead2a57b6939da1d139bd3"; + sha256 = "zzB4uBc1M2Gdr/JKY2uk8MY0hmQl1XeomkfTzuM45oE="; }; - dontBuild = true; - - installPhase = '' - runHook preInstall - mkdir -p $out/share/mpv/scripts - cp visualizer.lua $out/share/mpv/scripts - runHook postInstall - ''; - - passthru.scriptName = "visualizer.lua"; - meta = with lib; { description = "various audio visualization"; homepage = "https://github.com/mfcc64/mpv-scripts"; - platforms = platforms.all; maintainers = with maintainers; [kmein]; }; } diff --git a/nixpkgs/pkgs/applications/video/mpv/scripts/webtorrent-mpv-hook.nix b/nixpkgs/pkgs/applications/video/mpv/scripts/webtorrent-mpv-hook.nix index a1713e24375f..e870818fc64f 100644 --- a/nixpkgs/pkgs/applications/video/mpv/scripts/webtorrent-mpv-hook.nix +++ b/nixpkgs/pkgs/applications/video/mpv/scripts/webtorrent-mpv-hook.nix @@ -2,23 +2,23 @@ buildNpmPackage rec { pname = "webtorrent-mpv-hook"; - version = "1.3.3"; + version = "1.4.1"; src = fetchFromGitHub { owner = "mrxdst"; repo = pname; rev = "v${version}"; - hash = "sha256-AFKX31kriacXygZy0Mw+QwO+SwFEu13687mJ/WeAoKY="; + hash = "sha256-/dMtXcIyfAs++Zgz2CxRW0tkzn5QjS+WVGChlCyrU0U="; }; postPatch = '' substituteInPlace src/webtorrent.ts --replace "node_path: 'node'" "node_path: '${nodejs}/bin/node'" # This executable is just for telling non-Nix users how to install - substituteInPlace package.json --replace '"bin": "build/bin.js",' "" + substituteInPlace package.json --replace '"bin": "build/bin.mjs",' "" rm -rf src/bin.ts ''; - npmDepsHash = "sha256-GpNUJ5ZCgMjSYLqsIE/RwkTSFT3uAhxrHPe7XvGDRHE="; + npmDepsHash = "sha256-EqHPBoYyBuW9elxQH/XVTZoPkKHC6+7aksYo60t7WA4="; makeCacheWritable = true; nativeBuildInputs = [ |