From 796b4c064ffb13813a6f19d982b6605de900ab57 Mon Sep 17 00:00:00 2001 From: iceyrazor Date: Mon, 9 Jun 2025 19:07:42 -0500 Subject: removed last changed. it was allready doing the thing i wanted. renamed get_yt2.sh to getyt. added actual args --- README.md | 11 +++++------ get_yt2.sh | 33 --------------------------------- getyt | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 39 deletions(-) delete mode 100755 get_yt2.sh create mode 100755 getyt diff --git a/README.md b/README.md index 6428b29..1a58c7d 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Technically you can modify this to store anything other than just yt videos ![noimg](https://github.com/iceyrazor/youtube-playlist-cli/blob/main/example.png?raw=true) -# download. +# download Just download this repo and rename youtube_stuffs.db.def to youtube_stuffs.db # requirements @@ -25,16 +25,15 @@ Just download this repo and rename youtube_stuffs.db.def to youtube_stuffs.db - run ``fetch.sh "youtube url/playlist url" "playlist name"``. that should pretty much do everything. - check download_err.txt for download errors. Videos that are marked as nsfw and require sign in will NOT be added to the list and require manual intervention -- then ``get_yt2.sh.``. - - if you want thumbnails ``get_yt2.sh 1``. - - if you want to de a specific "category" or playlist. do ``get_yt2.sh 0 playlistname`` +- then ``getyt``. + - if you want thumbnails ``getyt -c``. + - if you want to de a specific "category" or playlist. do ``getyt playlistname`` - if you want too then delete download.txt and download_err.txt and thumberr.txt # config -- In ``get_yt2.sh`` there is the preview lines and columns. Idk if I can autodetect this because something something fzf doesn't do something something +- In ``getyt`` there is the preview lines and columns. Idk if I can autodetect this because something something fzf doesn't do something something - If you want to change anything else you would have to change the script. Feel free to make your own config system - # todo - auto detect detect last item in list when and before adding new item so thumbnails doesn't start at 1. Or async it or something idk diff --git a/get_yt2.sh b/get_yt2.sh deleted file mode 100755 index 3cafd79..0000000 --- a/get_yt2.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -FZF_PREVIEW_LINES=20 -FZF_PREVIEW_COLUMN=3 - - -cd "$(dirname "$0")" -has_chafa=$1 -! command -v chafa >/dev/null && has_chafa=0 - -playlist=$2 - -if [ "$2" == "" ]; then - item="$(sqlite3 ./youtube_stuffs.db "select rowid,* from ytlist")" -else - item="$(sqlite3 ./youtube_stuffs.db "select rowid,* from ytlist where category='$playlist'")" -fi - -if [ "$has_chafa" == "1" ]; then - item="$( printf -- "%s" "$item" | \ - fzf --no-sort --layout=reverse-list --preview "./preview.sh {} | xargs chafa --clear -f iterm -s ${FZF_PREVIEW_COLUMNS}x${FZF_PREVIEW_LINES}" \ - | sed -- 's/|.*//g')" -else - item="$( printf -- "%s" "$item" | \ - fzf --no-sort --reverse --layout=reverse-list \ - | sed -- 's/|.*//g')" -fi - -url=$(sqlite3 ./youtube_stuffs.db "select id from ytlist where rowid=$item") -if [ -z "$WAYLAND_DISPLAY" ]; then - printf "https://youtube.com/watch?v=$url" | xclip -selection clipboard -else - printf "https://youtube.com/watch?v=$url" | wl-copy -fi diff --git a/getyt b/getyt new file mode 100755 index 0000000..a526cf2 --- /dev/null +++ b/getyt @@ -0,0 +1,47 @@ +#!/bin/bash +FZF_PREVIEW_LINES=20 +FZF_PREVIEW_COLUMN=3 + + +cd "$(dirname "$0")" +has_chafa=0 + +while getopts "c" opt; do + case "$opt" in + c) has_chafa=1 + ;; + esac +done + +shift $((OPTIND-1)) +[ "${1:-}" = "--" ] && shift + +! command -v chafa >/dev/null && has_chafa=0 + +playlist=$1 + + +if [ "$playlist" == "" ]; then + item="$(sqlite3 ./youtube_stuffs.db "select rowid,* from ytlist")" +else + item="$(sqlite3 ./youtube_stuffs.db "select rowid,* from ytlist where category='$playlist'")" +fi + + +if [ "$has_chafa" == "1" ]; then + item="$( printf -- "%s" "$item" | \ + fzf --preview "./preview.sh {} | xargs chafa --clear -f iterm -s ${FZF_PREVIEW_COLUMNS}x${FZF_PREVIEW_LINES}" \ + | sed -- 's/|.*//g')" +else + item="$( printf -- "%s" "$item" | \ + fzf \ + | sed -- 's/|.*//g')" +fi + + +url=$(sqlite3 ./youtube_stuffs.db "select id from ytlist where rowid=$item") +if [ -z "$WAYLAND_DISPLAY" ]; then + printf "https://youtube.com/watch?v=$url" | xclip -selection clipboard +else + printf "https://youtube.com/watch?v=$url" | wl-copy +fi -- cgit v1.3