Add ability to search video to rofi_mpvtube script (#77)

This commit is contained in:
jpointsman 2020-04-08 01:05:47 +03:00 committed by GitHub
parent a31b2aa26a
commit 06458c76a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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