added vimperator, updated folder filter for email, updated vdirsyncer url
[dotfiles.git] / .mutt / offlineimap.py
index 46a4aa8..02e4e2b 100644 (file)
@@ -1,11 +1,18 @@
-#!/bin/env python
-# -*- coding: utf-8 -*-
-
 import subprocess
+import datetime
+import re
+
 
 def mailpasswd():
-    args = '/home/mart/.config/i3/gpass.sh mart@martlubbers.net'
-    try:
-        return subprocess.check_output(args, shell='/bin/bash').strip()
-    except subprocess.CalledProcessError:
-        return ""
+    return subprocess.check_output('pass mail/mart@martlubbers.net',
+                                   shell='/bin/bash').strip()
+
+
+def folderfilter(x):
+    match = re.match('archive\.(\d\d\d\d).(\d\d)', x)
+    if match:
+        return abs(datetime.date.today() -
+                   datetime.date(int(match.group(1)), int(match.group(2)), 1)
+                   ).days <= 31*2
+    else:
+        return not x.startswith('archive')