about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorSoispha <soispha@vhack.eu>2024-01-04 19:53:06 +0100
committerSoispha <soispha@vhack.eu>2024-01-04 19:53:06 +0100
commit552f466a1be0cb0fa794a44510e1c63c2528563a (patch)
tree279f0912d8a379a24268d1a585bdf931b26dab00
parentfix(hm/pkgs/scr/ytcc/ytc): Keep sorting from input (diff)
downloadnixos-config-552f466a1be0cb0fa794a44510e1c63c2528563a.tar.gz
nixos-config-552f466a1be0cb0fa794a44510e1c63c2528563a.zip
feat(hm/pkgs/scr/ytcc/ytc): Add support for direct urls
Diffstat (limited to '')
-rwxr-xr-xhm/soispha/pkgs/scripts/specific/ytcc/ytc9
1 files changed, 8 insertions, 1 deletions
diff --git a/hm/soispha/pkgs/scripts/specific/ytcc/ytc b/hm/soispha/pkgs/scripts/specific/ytcc/ytc
index 8306be7e..5d5da03a 100755
--- a/hm/soispha/pkgs/scripts/specific/ytcc/ytc
+++ b/hm/soispha/pkgs/scripts/specific/ytcc/ytc
@@ -56,8 +56,15 @@ if [ "$1" = "id" ]; then
     for id in "$@"; do
         ytcc --output json list --attributes url --ids "$id" | jq --raw-output 'map("\(.url);\(.id)") | join("\n")' >> "$bases";
     done
+elif [ "$1" = "url" ]; then
+    shift 1
+    bases="$(mktmp)";
+    for url in "$@"; do
+        # use 0 as a noop id
+        echo "$url;0" >> "$bases";
+    done
 else
-    die "The first arg must be id, but it was: '$1'"
+    die "The first arg must be one of id or url, but it was: '$1'"
 fi
 
 [ -d "$STATUS_PATH" ] || mkdir "$STATUS_PATH";