diff options
Diffstat (limited to '.local/bin/web')
-rwxr-xr-x | .local/bin/web/yth | 19 | ||||
-rwxr-xr-x | .local/bin/web/ytplaylist | 34 | ||||
-rwxr-xr-x | .local/bin/web/ytv | 13 |
3 files changed, 32 insertions, 34 deletions
diff --git a/.local/bin/web/yth b/.local/bin/web/yth new file mode 100755 index 0000000..26cbe91 --- /dev/null +++ b/.local/bin/web/yth @@ -0,0 +1,19 @@ +#!/bin/sh + +[ -n "$YT_HISTFILE" ] || + export YT_HISTFILE="${XDG_STATE_HOME:-$HOME/.local/state}/yt_history.tsv" + +menu() { + case "$1" in + dmenu) tac "$YT_HISTFILE" | dmenu -l 30 ;; + *) + bat --color=always --language=tsv --style=plain "$YT_HISTFILE" | + fzf --ansi --tac \ + --delimiter '\t' --with-nth 2,3 \ + --header-first --header "YT History" \ + --preview="echo {1}" --preview-window="up,1" \ + --bind 'ctrl-y:execute-silent(printf "%s\n" {1} | xsel --clipboard)' ;; + esac +} + + menu "$@" | sed -E "s/\t.*\t.*$//" diff --git a/.local/bin/web/ytplaylist b/.local/bin/web/ytplaylist deleted file mode 100755 index 7bc9026..0000000 --- a/.local/bin/web/ytplaylist +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh - -# Useful when creating a directory of videos sequenced as per a youtube -# playlist. -# Run this script from from the root of a directory that contains all the media -# and metadata files. -# The playlist file is expected to be in 'playlist' directory within the root -# with .pl.txt extension. (playlist/PLAYLIST_NAME.pl.txt) -# The new playlist directory will be created in the current directory i.e. the -# root if no other destination is passed as the second argument. - -case "$1" in - '') echo "ytplaylist - build a directory of sequenced videos using a playlist file\n -USAGE:\n\tytplaylist <PLAYLIST_FILE> [DESTINATION_DIR] " >&2; exit ;; - playlist/*.pl.txt) ;; - *) - printf "%s" "Unconventional file path, contniue? [y/N] " - read -r ans - case "$ans" in y) ;; *) exit 1 ;; esac - ;; -esac - -playlist="$(readlink -f $1)" -i=1 -fpl "$playlist" | while read -r file; do - if [ -z "$file" ]; then - i=$(( $i + 1 )) - continue - fi - dir="$(dirname "$file")" - base="$(basename "$file")" - rsync -Pru --mkpath "$file" \ - "${2:-$(basename "${playlist%.pl.txt}")}/${dir#$(readlink -f "$PWD")}/$(printf "%02d" "$i") $base" -done diff --git a/.local/bin/web/ytv b/.local/bin/web/ytv index c6e9eec..697c86f 100755 --- a/.local/bin/web/ytv +++ b/.local/bin/web/ytv @@ -1,3 +1,16 @@ #!/bin/sh +case "$(echo "$PWD" | tr '[:upper:]' '[:lower:]')" in + *videos*|*movies*|*series*) ;; + *) + printf "Non standard path for video download, continue? [Y/n] " >&2 + + read -r arg + case "$arg" in + n|N) exit ;; + esac + echo + ;; +esac + yt-dlp "$@" --config ~/.config/yt-dlp/videos.conf |