/
generateNotmuchMap.py
48 lines (43 loc) · 1.15 KB
/
generateNotmuchMap.py
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
48
MAILDIRS = ["elte", "priestoferis", "pharmahungary", "elte", "bence"]
FOLDERS = [
"Inbox",
"1_megválaszolni",
"2_rám_vár",
"3_másra_vár",
"4_olvasni",
"5_információ",
"6_visszaigazolások",
"7_hivatalos+pénzügyek",
"8_talán",
"Sent",
"Archive",
]
with open("notmuchmap.conf", "w") as f:
# RECENT
s = "Recent=date:30days..today and not ("
for i, m in enumerate(MAILDIRS):
s += f"path:{m}/Spam/**"
if i != len(MAILDIRS) - 1:
s += " or "
s += ")\n"
f.write(s)
# THREADED INBOX
s = 'InboxThreaded=thread:"{('
for i, m in enumerate(MAILDIRS):
s += f"path:{m}/Inbox/**"
if i != len(MAILDIRS) - 1:
s += " or "
s += ') and not tag:aerc}"\n'
f.write(s)
# FOLDERS
for folder in FOLDERS:
s = f"{folder}=("
for i, m in enumerate(MAILDIRS):
s += f"path:{m}/{folder}/**"
if i != len(MAILDIRS) - 1:
s += " or "
if folder == "Archive":
s += ' or path:oldmail/**) and not tag:aerc"\n'
else:
s += ') and not tag:aerc"\n'
f.write(s)