aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscripts/vidrm30
1 files changed, 30 insertions, 0 deletions
diff --git a/scripts/vidrm b/scripts/vidrm
new file mode 100755
index 00000000..a9c1cc7c
--- /dev/null
+++ b/scripts/vidrm
@@ -0,0 +1,30 @@
+#!/bin/sh
+set -eu
+
+QUEUE="$HOME/archive/vid/queue.txt"
+DB="$HOME/archive/vid/metadata-database.txt"
+
+LIST="$(mktemp)"
+touch "$DB"
+for url in $(cat "$QUEUE"); do
+ MATCH="$(grep -F "$url" "$DB" || echo "$url")"
+ echo "$MATCH" >> "$LIST"
+done
+
+file_and_stuff="$(fzf < "$LIST")"
+
+if [ -n "$file_and_stuff" ]; then
+ file="$(echo "$file_and_stuff" | awk -F' - ' '{print $NF}')"
+ NEW_QUEUE="$(mktemp)"
+ awk -v file="$file" '
+ BEGIN {
+ once=0
+ }
+ once == 0 && $0 == file {
+ once=1
+ print file
+ }
+ $0 != file { print }
+ ' "$QUEUE" > "$NEW_QUEUE"
+ mv "$NEW_QUEUE" "$QUEUE"
+fi