summaryrefslogtreecommitdiff
path: root/blm
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2020-11-22 01:30:55 +0100
committerJohn Ankarström <john@ankarstrom.se>2020-11-22 01:31:32 +0100
commit850f917b6aaea6f25bab8860ede290eb66fe958b (patch)
tree469403bd96d4ea98bc0e0288c7f763457aed51e9 /blm
parent8b4e99e55b54b61a9b0c7063e9ee8482f99537b0 (diff)
downloadweb-850f917b6aaea6f25bab8860ede290eb66fe958b.tar.gz
blq: Add -r option
The -r option processes the search results with blm and opens the mbox file in a given mail reader.
Diffstat (limited to 'blm')
-rwxr-xr-xblm5
1 files changed, 2 insertions, 3 deletions
diff --git a/blm b/blm
index 5b70f0d..f00e254 100755
--- a/blm
+++ b/blm
@@ -1,11 +1,10 @@
#!/bin/sh
-# Format Blocket.se search results
+# Format Blocket.se search results as mboxu
-# Convert json to mbox
jq -r '.data[] |
"From BLOCKET " + (.list_time | sub("\\+[0-9][0-9]:00$"; "Z") | fromdate | strftime("%a %b %e %T %Y")) + "\n" +
- "From: " + .advertiser.name + ", " + .location[0].name + " (" + .advertiser.type + ")\n" +
+ "From: \"" + .advertiser.name + ", " + .location[0].name + " (" + .advertiser.type + ")\" <noreply@localhost>\n" +
"Subject: " + "(" + (.price.value | tostring) + ") " + .subject + "\n" +
([.images[].url] | map("X-Image: " + . + "?type=original") | join("\n")) + "\n" +
"\n" + .body + "\n" +