From 06458c76a299a5e1dad85241a0c5a5891f5ee9ae Mon Sep 17 00:00:00 2001 From: jpointsman Date: Wed, 8 Apr 2020 01:05:47 +0300 Subject: [PATCH] Add ability to search video to rofi_mpvtube script (#77) --- bin/rofi_mpvtube | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/rofi_mpvtube b/bin/rofi_mpvtube index 450ca8c..652a9fa 100755 --- a/bin/rofi_mpvtube +++ b/bin/rofi_mpvtube @@ -56,9 +56,10 @@ main() { # Get URL linktoplay="$(grep -m 1 "$choice" $playlist_file | cut -d '@' -f 2)" - # If the choice does not exist, exit + # If the choice does not exist, try searching for it if [ ${#linktoplay} -eq "0" ]; then - exit 1 + yid=$(youtube-dl ytsearch:"$choice" -s | grep "\[youtube\]" | cut -d ']' -f 2 | awk -F ':' '{print $1}' | cut -c 2-) + linktoplay=https://www.youtube.com/watch\?v\="$yid" fi # Send notification