diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-03-09 22:52:50 +0100 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-03-09 22:52:50 +0100 |
commit | 8d73085ec9575fb00b14956be8ae66081e98e714 (patch) | |
tree | e828b69c37d3407b3c5e1331c8cc973dad7a813a | |
parent | e99503212cdc28226ee99e9488de5cd5500f46cb (diff) |
changed ytclipo alias to a script
-rwxr-xr-x | bin/common/ytclipo | 17 | ||||
-rw-r--r-- | config/essentials/zsh/aliases.zsh | 1 |
2 files changed, 17 insertions, 1 deletions
diff --git a/bin/common/ytclipo b/bin/common/ytclipo new file mode 100755 index 0000000..ee5bf0f --- /dev/null +++ b/bin/common/ytclipo @@ -0,0 +1,17 @@ +#!/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 + +yt-dlp "$inp" \ + -f "b" \ + -S "res:720" \ + -P "$HOME/vids" \ + -o "%(title)s.%(ext)s" diff --git a/config/essentials/zsh/aliases.zsh b/config/essentials/zsh/aliases.zsh index 493248d..411ae73 100644 --- a/config/essentials/zsh/aliases.zsh +++ b/config/essentials/zsh/aliases.zsh @@ -87,7 +87,6 @@ alias vidlen='ffprobe -show_entries format=duration -v quiet -of csv="p=0" -i' alias whatsmyip='curl "ifconfig.me"' alias icognito='unset HISTFILE' alias penv='python -m venv' -alias ytclipo='yt-dlp "$(xclip -sel c -o)" -f "b" -S "res:720" -P $HOME/vids -o "%(title)s.%(ext)s"' alias -g '...'='../..' alias -g '....'='../../..' |