blob: 8a90160e53d2e5f25b0ce0495458e85e1b12a636 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
#!/usr/bin/python3
import json
import os.path
import pprint
import smtplib
import sys
if len(sys.argv) < 2:
print(f"sys.argv: {sys.argv}")
sys.exit(1)
out = {}
INP = sys.argv[1]
if not os.path.exists(INP):
sys.exit(2)
with open(INP) as inf:
input = sorted(json.load(inf), key=lambda item: item['iid'])
for issue in input:
id = issue['iid']
out[id] = {
'title': issue['title'],
'desc': issue['description'],
'status': issue['state'],
'comments': []
}
for note in issue['notes']:
out[id]['comments'].append({
'text': note['note']
})
fromaddr="mcepl@cepl.eu"
toaddrs=('~mcepl/json_diff@todo.sr.ht',)
with smtplib.SMTP('redcrew.org', port=587) as smtp:
smtp.starttls()
smtp.login(fromaddr, "]fJTTIuHF7zunkNd")
for key, iss in out.items():
msg = ("From: %s\r\nTo: %s\r\n\r\n"
% (fromaddr, ", ".join(toaddrs)))
if iss['desc'] is not None:
msg += iss['desc']
smtp.sendmail("mcepl@cepl.eu", "~mcepl/json_diff@todo.sr.ht",msg)
|