diff options
author | lassulus <lassulus@lassul.us> | 2022-05-27 13:42:45 +0200 |
---|---|---|
committer | lassulus <lassulus@lassul.us> | 2022-05-27 13:42:51 +0200 |
commit | cfee9e89e7bd214e8ea9f8e2e6349c6ebc917bf1 (patch) | |
tree | 963bd78a9bd305a693b7d3d54ca375b1de5d3d73 /lass | |
parent | 41935c401d35328054e179455a4de9732c8bbe7c (diff) |
l mpv: set youtube video size
Diffstat (limited to 'lass')
-rw-r--r-- | lass/2configs/mpv.nix | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lass/2configs/mpv.nix b/lass/2configs/mpv.nix index 1061ea64c..f88d0d91d 100644 --- a/lass/2configs/mpv.nix +++ b/lass/2configs/mpv.nix @@ -81,17 +81,28 @@ let ''; mpvConfig = pkgs.writeText "mpv.conf" '' + osd-font-size=20 ''; mpv = pkgs.symlinkJoin { name = "mpv"; paths = [ (pkgs.writeDashBin "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 = [ - pkgs.mpvScripts.sponsorblock + scripts = with pkgs.mpvScripts; [ + sponsorblock + youtube-quality ]; }}/bin/mpv \ -vo=gpu \ @@ -99,6 +110,7 @@ let --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 \ "$@" |