l mpv: set youtube video size

This commit is contained in:
lassulus 2022-05-27 13:42:45 +02:00
parent 41935c401d
commit cfee9e89e7

View File

@ -81,17 +81,28 @@ let
''; '';
mpvConfig = pkgs.writeText "mpv.conf" '' mpvConfig = pkgs.writeText "mpv.conf" ''
osd-font-size=20
''; '';
mpv = pkgs.symlinkJoin { mpv = pkgs.symlinkJoin {
name = "mpv"; name = "mpv";
paths = [ paths = [
(pkgs.writeDashBin "mpv" '' (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 # we need to disable sponsorblock local database because of
# https://github.com/po5/mpv_sponsorblock/issues/31 # https://github.com/po5/mpv_sponsorblock/issues/31
exec ${pkgs.mpv.override { exec ${pkgs.mpv.override {
scripts = [ scripts = with pkgs.mpvScripts; [
pkgs.mpvScripts.sponsorblock sponsorblock
youtube-quality
]; ];
}}/bin/mpv \ }}/bin/mpv \
-vo=gpu \ -vo=gpu \
@ -99,6 +110,7 @@ let
--input-conf=${mpvInput} \ --input-conf=${mpvInput} \
--include=${mpvConfig} \ --include=${mpvConfig} \
--script=${autosub} \ --script=${autosub} \
--ytdl-format="best[height<$Y_RES]" \
--script-opts=ytdl_hook-ytdl_path=${pkgs.yt-dlp}/bin/yt-dlp \ --script-opts=ytdl_hook-ytdl_path=${pkgs.yt-dlp}/bin/yt-dlp \
--script-opts-append=sponsorblock-local_database=no \ --script-opts-append=sponsorblock-local_database=no \
"$@" "$@"