summaryrefslogtreecommitdiff
path: root/xii
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2020-11-21 17:41:20 +0100
committerJohn Ankarström <john@ankarstrom.se>2020-11-21 17:41:20 +0100
commit8b4e99e55b54b61a9b0c7063e9ee8482f99537b0 (patch)
treeb6ad55d148ae9484a00f0692c9fa4b30fed0c7b5 /xii
parentacb8ecc09ba2185b21c31dba896b9d77b5f23af8 (diff)
downloadweb-8b4e99e55b54b61a9b0c7063e9ee8482f99537b0.tar.gz
Add 'xii' tool (downloads and displays X-Image images)
Diffstat (limited to 'xii')
-rwxr-xr-xxii20
1 files changed, 20 insertions, 0 deletions
diff --git a/xii b/xii
new file mode 100755
index 0000000..dc4a620
--- /dev/null
+++ b/xii
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+# Download and display X-Image images
+
+: ${VIEWER:=fbi}
+
+# Create temporary directory for images
+dir=/tmp/$RANDOM
+mkdir $dir
+
+grep '^X-Image: ' |
+sed 's/^X-Image: //' |
+while read url
+do
+ curl "$url" > $dir/$RANDOM
+done
+
+# Display images and delete them afterwards
+$VIEWER $dir/* < /dev/tty
+rm -r $dir