diff options
Diffstat (limited to 'bin/common')
-rwxr-xr-x | bin/common/targit | 5 | ||||
-rwxr-xr-x | bin/common/ytclipo | 21 | ||||
-rwxr-xr-x | bin/common/ytlink | 14 |
3 files changed, 20 insertions, 20 deletions
diff --git a/bin/common/targit b/bin/common/targit index ae046ac..ca560b3 100755 --- a/bin/common/targit +++ b/bin/common/targit @@ -1,6 +1,5 @@ #!/bin/sh -pwd=$(pwd) root="$(git rev-parse --show-toplevel)" cd "$root" || exit 1 -file="$(basename "$root" | sed 's/^\.//').tar.gz" -tar czf "$pwd/$file" $(git ls-files) +file="${root##*/}".tar.gz +tar czf "$file" $(git ls-files) diff --git a/bin/common/ytclipo b/bin/common/ytclipo index 5d86c3f..6416a15 100755 --- a/bin/common/ytclipo +++ b/bin/common/ytclipo @@ -1,21 +1,8 @@ #!/bin/sh -# argument ($1) -> clipboard -> stdin -if [ "$WAYLAND_DISPLAY" ] -then paste() { wl-paste; } -elif [ "$TERMUX_VERSION" ] -then paste() { termux-clipboard-get; } -else paste() { xclip -o -sel c; } -fi - -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/')" +inp="$(ytlink)" >&2 printf "inp: %s\n" "$inp" -notify-send "ytclipo" "downloading <i>$inp</i>" || : +# notify-send "ytclipo" "downloading <i>$inp</i>" || : yt-dlp "$inp" \ --restrict-filenames \ @@ -23,5 +10,5 @@ yt-dlp "$inp" \ -f "b" \ -S "res:1080" \ -P "$HOME/vids/youtube/" \ - -o "%(channel)s - %(title)s.%(ext)s" -notify-send "ytclipo" "finished downloading." || : + -o "%(channel)s/%(title)s.%(ext)s" +# notify-send "ytclipo" "finished downloading." || : diff --git a/bin/common/ytlink b/bin/common/ytlink new file mode 100755 index 0000000..a5e9bf0 --- /dev/null +++ b/bin/common/ytlink @@ -0,0 +1,14 @@ +#!/bin/sh + +# convert to youtube.com/path url +# works for: +# - 'youtu.be/watch?v=xxxxxx' +# - 'https://piped.video/watch?v=xxxxx' + +inp="$1" +[ "${inp:=$(clipo)}" ] || inp="$(cat /dev/stdin)" + +# remove util scheme +inp="${inp#*//}" +inp="https://youtube.com/${inp#*/}" +printf "%s" "$inp" |