summaryrefslogtreecommitdiff
path: root/bin/common/ytclipo
diff options
context:
space:
mode:
authorRaymaekers Luca <raymaekers.luca@gmail.com>2023-03-12 18:35:36 +0100
committerRaymaekers Luca <raymaekers.luca@gmail.com>2023-03-12 18:35:36 +0100
commitdef003a709daac88d91499f50e9d3fd246ee3db2 (patch)
tree6b18eec5e30f300bca47cf3b8bd89cab12627def /bin/common/ytclipo
parente1b3f28bb1f8f1f9084ae96aa5ef79d39769049f (diff)
parentfab8d61418e2652881a56b586588f3373df5f971 (diff)
Merge remote-tracking branch 'refs/remotes/origin/main'
Diffstat (limited to 'bin/common/ytclipo')
-rwxr-xr-xbin/common/ytclipo19
1 files changed, 19 insertions, 0 deletions
diff --git a/bin/common/ytclipo b/bin/common/ytclipo
new file mode 100755
index 0000000..0ac412c
--- /dev/null
+++ b/bin/common/ytclipo
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+# argument ($1) -> clipboard -> stdin
+test -z "${inp:=${1:-"$(xclip -sel c -o)"}}" \
+ && inp="$(cat /dev/stdin)"
+
+echo "inp: ${inp}" 1>&2
+# take last link from clipboard
+# works when link is from yt-local
+inp="$(echo -n "$inp" | awk -F 'https?://' '{print $NF}')"
+echo "inp: ${inp}" 1>&2
+notify-send "ytclipo" "<b>ytclipo</b><br><i>downloading</i> $inp"
+
+yt-dlp "$inp" \
+ -f "b" \
+ -S "res:720" \
+ -P "$HOME/vids" \
+ -o "%(title)s.%(ext)s"
+notify-send "ytclipo" "<b>ytclipo</b><br>finished downloading."