From 26125cd9d471bf12bb3c4237e5b5819d631c45de Mon Sep 17 00:00:00 2001 From: Felix Stupp Date: Fri, 30 Aug 2024 21:50:31 +0000 Subject: [PATCH] frontend: configure sponsorblock on mpv --- nix/nixos-modules/frontend/home.nix | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/nix/nixos-modules/frontend/home.nix b/nix/nixos-modules/frontend/home.nix index 5ead59d..e1dc08a 100644 --- a/nix/nixos-modules/frontend/home.nix +++ b/nix/nixos-modules/frontend/home.nix @@ -197,6 +197,10 @@ in thumbfast ]; scriptOpts = + let + scriptNames = map (p: lib.getName p) config.programs.mpv.scripts; + mkIfScript = name: lib.mkIf (builtins.elem name scriptNames); + in { modernx = { # order by README (https://github.com/zydezu/ModernX#configurable-options) @@ -209,6 +213,19 @@ in downloadbutton = false; showyoutubecomments = false; }; + sponsorblock = { + skip_categories = "sponsor,intro,outro,interaction,selfpromo"; + local_database = true; + auto_update = true; + skip_once = true; + server_fallback = true; + make_chapters = true; + audio_fade = mkIfScript "quack" false; # quack does the same, but always + fast_forward = false; + # Lua pattern: https://www.lua.org/pil/20.2.html + # TL;DR: '%' = '\', rest is as normal + local_pattern = (lib.mkIf config.programs.yt-dlp.enable "[%s_-]%[([%w-_]+)%]%.[mw][kpe][v4b]m?$"); # tuned for yt-dlp default + }; }; };