summaryrefslogtreecommitdiff
path: root/blm
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2020-11-22 18:54:41 +0100
committerJohn Ankarström <john@ankarstrom.se>2020-11-22 18:54:41 +0100
commit3537be9e7c578f8ca84e9d420044654577706a11 (patch)
tree379184e06cf5907b053bb9ff44d639dedd63a9b4 /blm
parent9c9207c0141b816e351c62e659079912367dbeff (diff)
downloadweb-3537be9e7c578f8ca84e9d420044654577706a11.tar.gz
Add more useful headers
Diffstat (limited to 'blm')
-rwxr-xr-xblm18
1 files changed, 15 insertions, 3 deletions
diff --git a/blm b/blm
index f00e254..51bd0e5 100755
--- a/blm
+++ b/blm
@@ -4,9 +4,21 @@
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 + ")\" <noreply@localhost>\n" +
- "Subject: " + "(" + (.price.value | tostring) + ") " + .subject + "\n" +
- ([.images[].url] | map("X-Image: " + . + "?type=original") | join("\n")) + "\n" +
+'"$(test "$1" = -d && printf '%s\n' '
+ "From: \"" + .advertiser.name + ", " + .location[0].name + "\" <noreply@localhost>\n" +
+ "Subject: (" + (.price.value | tostring) + ") " + .subject + "\n" +
+' || printf '%s\n' '
+ "From: \"" + .advertiser.name + "\" <noreply@localhost>\n" +
+ "Subject: " + .subject + "\n" +
+')"'
+ "ID: " + .ad_id + "\n" +
+ "Link: " + .share_url + "\n" +
+ "Price: " + (.price.value | tostring) + " " + .price.suffix + "\n" +
+ "Type: " + .advertiser.type + "\n" +
+ ([.category[].name] | map("Category: " + . ) | join("\n")) + "\n" +
+ ([.location[].name] | map("Location: " + . ) | join("\n")) + "\n" +
+ "Map: " + .map_url + "\n" +
+ ([.images[].url] | map("Image: " + . + "?type=original") | join("\n")) + "\n" +
"\n" + .body + "\n" +
"\n"
'