summaryrefslogtreecommitdiff
path: root/blm
blob: 5b70f0d8803f454493389eaf36a247f866d1cad8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/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[].url] | map("X-Image: " + . + "?type=original") | join("\n")) + "\n" +
	"\n" + .body + "\n" +
	"\n"
'