diff options
-rwxr-xr-x | hm/soispha/pkgs/scripts/specific/ytcc/yts | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/hm/soispha/pkgs/scripts/specific/ytcc/yts b/hm/soispha/pkgs/scripts/specific/ytcc/yts index 1e8f1c8e..4d6cc6e6 100755 --- a/hm/soispha/pkgs/scripts/specific/ytcc/yts +++ b/hm/soispha/pkgs/scripts/specific/ytcc/yts @@ -19,7 +19,45 @@ help_text=" # 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")')" +for arg in "$@"; do + case "$arg" in + "--help") + help; + exit 0; + ;; + "--version") + version; + exit 0; + ;; + esac +done + +case "$1" in + "order") + shift 1; + case "$1" in + "date") + set -- "--order-by" "publish_date" "desc" + ;; + "raw") + shift 1; + if [ -n "$1" ]; then + [ -z "$2" ] && die "A first argument to 'order raw' requires a second" + set -- "--order-by" "$1" "$2" + fi + ;; + *) + die "'$1' is not a valid subcommand for 'order'; See '--help' for a list"; + ;; + esac + ;; + *) + die "'$1' is not a valid subcommand; See '--help' for a list"; + ;; +esac + + +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)"; |