From 55ddbf26bc1d2dd1eb34cb5794e008eb9e10baaf Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Mon, 25 May 2020 12:02:56 +0100 Subject: [PATCH] Adds the ability to use multiple sources for opening youtube An entry called best of both will now be in the list that will stream the best audio and the best video There is also now the ability to select a video only and an audio only track and they will be combined --- bin/.bin/dmenu/open-youtube | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bin/.bin/dmenu/open-youtube b/bin/.bin/dmenu/open-youtube index 0ea49aab..ea4c7acf 100755 --- a/bin/.bin/dmenu/open-youtube +++ b/bin/.bin/dmenu/open-youtube @@ -13,7 +13,13 @@ if [ -z "$url" ]; then url=$($DMENU 'URL') fi -code=$(youtube-dl "$url" -F | sed -n '/format code/,$ p' | tail -n +2 | $DMENU Quality | awk '{print $1}') +code=$( ( youtube-dl "$url" -F; echo "bb Best of both") | sed -n '/format code/,$ p' | tail -n +2 | $DMENU "Quality " -m | awk '{print $1}') -mpv "$url" --ytdl-format="$code" +code="$(echo "$code" | tr '\n' '+' | sed 's/+$//')" +notify-send "$code" + +case "$code" in + "bb") mpv "$url" --ytdl-format="bestvideo+bestaudio" ;; + *) mpv "$url" --ytdl-format="$code" +esac