From 126cecc9681ad05fcb52058e12db192b90dbd9ec Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Wed, 26 Feb 2014 15:39:28 +0100 Subject: [PATCH] adapted to work with recoll --- src/python/samples/mutt-recoll.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) mode change 100644 => 100755 src/python/samples/mutt-recoll.py diff --git a/src/python/samples/mutt-recoll.py b/src/python/samples/mutt-recoll.py old mode 100644 new mode 100755 index 308206a8..51e4e97f --- a/src/python/samples/mutt-recoll.py +++ b/src/python/samples/mutt-recoll.py @@ -1,24 +1,23 @@ #!/usr/bin/env python """ -mutt-notmuch-py +Modified from github:honza/mutt-notmuch-py -This is a Gmail-only version of the original mutt-notmuch script. +This is a recoll version of the original mutt-notmuch script. It will interactively ask you for a search query and then symlink the matching messages to $HOME/.cache/mutt_results. Add this to your muttrc. -macro index / "unset wait_keymutt-notmuch-py~/.cache/mutt_results" \ - "search mail (using notmuch)" +macro index / "unset wait_keymutt-recoll.py~/.cache/mutt_results" \ + "search mail (using recoll)" This script overrides the $HOME/.cache/mutt_results each time you run a query. Install this by adding this file somewhere on your PATH. -Tested on OSX Lion and Arch Linux. - (c) 2012 - Honza Pokorny +(c) 2014 - Jean-Francois Dockes Licensed under BSD """ @@ -59,12 +58,14 @@ def main(dest_box, is_gmail): empty_dir(dest_box) - files = command('notmuch search --output=files %s' % query).split('\n') + files = command('recoll -t -b -q %s' % query).split('\n') data = defaultdict(list) messages = [] for f in files: + # Recoll outputs file:// urls + f = f[7:] if not f: continue @@ -86,6 +87,7 @@ def main(dest_box, is_gmail): target = os.path.join(dest_box, 'cur', os.path.basename(m)) if not os.path.exists(target): + print "symlink [%s] -> [%s]" % (m, target) os.symlink(m, target) @@ -103,6 +105,8 @@ if __name__ == '__main__': dest = args[0] else: dest = '~/.cache/mutt_results' - + if not os.path.exists(dest): + os.makedirs(dest) + # Use expanduser() so that os.symlink() won't get weirded out by tildes. main(os.path.expanduser(dest).rstrip('/'), options.gmail)