From 3f476697d4e632ca2cb86f19ed5ff1bbb7d1f07d Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Thu, 23 Sep 2021 06:53:12 -0700 Subject: [PATCH] add some insanity to mpv_watch --- sh/streamcrap | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/sh/streamcrap b/sh/streamcrap index 6603380..e8531f1 100644 --- a/sh/streamcrap +++ b/sh/streamcrap @@ -72,10 +72,19 @@ mpv_watch() { ### @- argc -ge 1 "$0" "$@" || return pushd ~/play >/dev/null local url="$1"; shift - mpv \ - --af=lavfi="[$_M_PROCESS]" \ - --ytdl-format='[width<=1280]/best' \ - "$@" -- "$url" + # checking for redundant flags might itself be redundant, but i want to be sure. + local seen=0 + for a; do [ "$a" = "${a#--ytdl-format=}" ] || seen=1 done + if [ $seen -eq 0 ]; then + mpv \ + --af=lavfi="[$_M_PROCESS]" \ + --ytdl-format='[width<=1280]/best' \ + "$@" -- "$url" + else + mpv \ + --af=lavfi="[$_M_PROCESS]" \ + "$@" -- "$url" + fi popd >/dev/null }