diff options
author | Soispha <soispha@vhack.eu> | 2024-01-03 22:42:04 +0100 |
---|---|---|
committer | Soispha <soispha@vhack.eu> | 2024-01-03 22:42:04 +0100 |
commit | ea09ccf2e9b48b3aa870e90095a44fc8839ba9ff (patch) | |
tree | 6e9321f643940e7a687fd5472d308e1d31c7f1af /hm/soispha/pkgs/scripts/wrappers/yts | |
parent | feat(hm/pkgs/scr): Add support for python based scripts (diff) | |
download | nixos-config-ea09ccf2e9b48b3aa870e90095a44fc8839ba9ff.zip |
feat(hm/pkgs/scr/ytcc): Add support for showing comments
Diffstat (limited to 'hm/soispha/pkgs/scripts/wrappers/yts')
-rwxr-xr-x | hm/soispha/pkgs/scripts/wrappers/yts | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/hm/soispha/pkgs/scripts/wrappers/yts b/hm/soispha/pkgs/scripts/wrappers/yts deleted file mode 100755 index b5edf52c..00000000 --- a/hm/soispha/pkgs/scripts/wrappers/yts +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="1.10.2" . %SHELL_LIBRARY_PATH - -TASK_UUID=ce4f9e07-8324-4570-8be6-967955e9271e - -cleanup() { - task stop "$TASK_UUID" -} -trap cleanup EXIT - -help_text=" -# -# Commands: -# w, watch <id> = watch id -# d, drop <id> = mark id as watched -# p, pick <id> = leave id as is; This is a noop -# -# These lines can be re-ordered; they are executed from top to bottom. -# vim: ft=gitrebase" - -table="$(ytcc --output json list | jq --raw-output 'map("pick \(.id) \(.title) (\(.playlists | map(.name) | join(", "))) [\(.duration | gsub("^\\s+|\\s+$";""))]") | join("\n")')" - -selection_file="$(mktmp)"; - -task start "$TASK_UUID" - -echo "$table" > "$selection_file"; -echo "$help_text" >> "$selection_file"; - -$EDITOR "$selection_file" - -ids="" -is_first=true; -while read -r line; do - cmd="$(echo "$line" | awk '{print $1}')"; - case "$cmd" in - "#" ) - # This is a comment, do nothing here - ;; - "pick" | "p") - # noop do nothing here - ;; - "drop" | "d") - id="$(echo "$line" | awk '{print $2}')"; - ytcc mark "$id"; - dbg "Marked as watched: $id" - ;; - "watch" | "w") - id="$(echo "$line" | awk '{print $2}')"; - if [ "$is_first" = "true" ]; then - ids="$id"; - else - ids="$ids,$id"; - fi - dbg "Added to be watched: $id" - is_first=false - ;; - esac -done < "$selection_file" - -[ "$ids" != "" ] && ytc "$ids"; - -# vim: ft=sh |