From ddcc8c65e30a9ca3b56e25466e749cb100b28510 Mon Sep 17 00:00:00 2001
From: Gregor Kleen <gkleen@yggdrasil.li>
Date: Sat, 22 Oct 2022 19:33:45 +0200
Subject: ...

---
 user-profiles/mpv/default.nix | 46 +++++++++++++++++++++++++++++++++++++++----
 1 file changed, 42 insertions(+), 4 deletions(-)

(limited to 'user-profiles/mpv')

diff --git a/user-profiles/mpv/default.nix b/user-profiles/mpv/default.nix
index 0c87b6e7..9c9d077b 100644
--- a/user-profiles/mpv/default.nix
+++ b/user-profiles/mpv/default.nix
@@ -7,8 +7,10 @@
     };
     config = {
       ytdl = true;
-      sub = false;
-      osd-font = "DejaVu Sans";
+      subs-with-matching-audio = false;
+      audio-display = false;
+      osd-font = "Fira Sans";
+      sub-font = "Fira Sans";
       # vo = "gpu";
       hwdec = "auto";
       force-window = "yes";
@@ -18,8 +20,36 @@
         "vidscale=no"
         "deadzonesize=0.9"
         "ytdl_hook-ytdl_path=${pkgs.yt-dlp}/bin/yt-dlp"
-        "chapterskip-skip=sponsor;intro;endcard"
-        "chapterskip-categories=sponsor>%[SponsorBlock%]: .*Sponsor.*;intro>%[SponsorBlock%]: .*Intro Animation.*;endcard>%[SponsorBlock%]: .*Endcards.*"
+        "chapterskip-skip=sponsor;intro;endcard;interact"
+        "chapterskip-categories=sponsor>%[SponsorBlock%]: .*Sponsor.*;intro>%[SponsorBlock%]: .*Intro Animation.*;endcard>%[SponsorBlock%]: .*Endcards.*;interact>%[SponsorBlock%]: .*Interaction Reminder.*"
+        "sub_select-config=${pkgs.writeTextDir "sub-select.json" (builtins.toJSON [
+          {
+            alang = "*";
+            slang = "forced";
+          }
+          {
+            alang = ["jpn" "ja"];
+            slang = "eng?";
+            blacklist = [ "sign" ];
+          }
+          {
+            alang = ["jpn" "ja"];
+            slang = "und";
+            blacklist = [ "sign" ];
+          }
+          {
+            alang = ["eng?" "deu?"];
+            slang = "no";
+          }
+          {
+            alang = "*";
+            slang = "eng?";
+          }
+          {
+            alang = "*";
+            slang = "und";
+          }
+        ])}"
       ];
     };
     scripts = [
@@ -65,6 +95,14 @@
 
         passthru.scriptName = "chapterskip.lua";
       }))
+      (pkgs.stdenv.mkDerivation (sources.mpv-subselect // rec {
+        installPhase = ''
+          install -d $out/share/mpv/scripts
+          install -m 0644 sub-select.lua $out/share/mpv/scripts/${passthru.scriptName}
+        '';
+
+        passthru.scriptName = "sub-select.lua";
+      }))
     ];
   };
 }
-- 
cgit v1.2.3