summaryrefslogtreecommitdiff
path: root/blm
blob: b3aa146f42391e1fb9c38508f7c405961a90d095 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/sh

# Format Blocket.se search results

# 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" +
	"Subject: " + "(" + (.price.value | tostring) + ") " + .subject + "\n" +
	# (.images[] | "X-Image: " + .url + "\n") +
	([.images[].url] | map("X-Image: " + .) | join("\n")) + "\n" +
	"\n" + .body + "\n" +
	"\n"
'