From c032a9d071ee4b7eb2bfe79ec03d2a7dc4020f15 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Sun, 15 Oct 2023 00:32:34 +0200 Subject: added termux detection --- bin/common/ytclipo | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'bin/common') diff --git a/bin/common/ytclipo b/bin/common/ytclipo index 7e7b9cc..6da7059 100755 --- a/bin/common/ytclipo +++ b/bin/common/ytclipo @@ -2,19 +2,20 @@ # argument ($1) -> clipboard -> stdin if [ "$WAYLAND_DISPLAY" ] -then - paste="$(wl-paste)" -else - paste="$(xclip -o -sel c)" +then paste() { wl-paste; } +elif [ "$TERMUX_VERSION" ] +then paste() { termux-clipboard-get; } +else paste() { xclip -o -sel c; } fi -test -z "${inp:=${1:-$paste}}" && - inp="$(cat /dev/stdin)" + +inp=”$1” +[ "${inp:=$(paste)}" ] || inp="$(cat /dev/stdin)" # take last link from clipboard # works when link is from yt-local inp="https://youtu.be/$(echo "$inp" | sed 's/.*\(.\{11\}\)$/\1/')" -echo "inp: ${inp}" 1>&2 -notify-send "ytclipo" "downloading $inp" +>&2 printf "inp: %s\n" "$inp" +notify-send "ytclipo" "downloading $inp" || : yt-dlp "$inp" \ --restrict-filenames \ @@ -22,5 +23,4 @@ yt-dlp "$inp" \ -S "res:1080" \ -P "$HOME/vids/youtube/" \ -o "%(channel)s - %(title)s.%(ext)s" -notify-send "ytclipo" "ytclipo
finished downloading." -echo "$inp" >> /tmp/ytclipo_history +notify-send "ytclipo" "ytclipo
finished downloading." || : -- cgit v1.2.3