diff options
author | makefu <github@syntax-fehler.de> | 2022-06-07 00:17:23 +0200 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2022-06-07 00:17:23 +0200 |
commit | 9c1799914a2e6f2dc736fe2eaad7134602a3d837 (patch) | |
tree | 08347f7f29bc00c3b40be2a49e069268c0163716 /lass/2configs/mpv.nix | |
parent | 1e405be047a79e1abd0c28e52b5009b9675909b8 (diff) | |
parent | bdc80e55411e197f89990e988f8b7e67c084d3d3 (diff) |
Merge remote-tracking branch 'lass/master' into 22.05
Diffstat (limited to 'lass/2configs/mpv.nix')
-rw-r--r-- | lass/2configs/mpv.nix | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/lass/2configs/mpv.nix b/lass/2configs/mpv.nix index 854af3eb5..f88d0d91d 100644 --- a/lass/2configs/mpv.nix +++ b/lass/2configs/mpv.nix @@ -76,15 +76,43 @@ let mp.add_key_binding('S', "download_subs", download) ''; + mpvInput = pkgs.writeText "mpv.input" '' + : script-binding console/enable + ''; + + mpvConfig = pkgs.writeText "mpv.conf" '' + osd-font-size=20 + ''; + mpv = pkgs.symlinkJoin { name = "mpv"; paths = [ (pkgs.writeDashBin "mpv" '' - exec ${pkgs.mpv}/bin/mpv \ + set -efu + if [ -n "''${DISPLAY+x}" ]; then + Y_RES=$(${pkgs.xorg.xrandr}/bin/xrandr | + ${pkgs.jc}/bin/jc --xrandr | + ${pkgs.jq}/bin/jq '.screens[0].current_width' + ) + else + Y_RES=1000 + fi + # we need to disable sponsorblock local database because of + # https://github.com/po5/mpv_sponsorblock/issues/31 + exec ${pkgs.mpv.override { + scripts = with pkgs.mpvScripts; [ + sponsorblock + youtube-quality + ]; + }}/bin/mpv \ -vo=gpu \ --no-config \ + --input-conf=${mpvInput} \ + --include=${mpvConfig} \ --script=${autosub} \ + --ytdl-format="best[height<$Y_RES]" \ --script-opts=ytdl_hook-ytdl_path=${pkgs.yt-dlp}/bin/yt-dlp \ + --script-opts-append=sponsorblock-local_database=no \ "$@" '') pkgs.mpv |