Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 4BC18429E29 for ; Wed, 12 Jan 2011 14:39:47 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pHjb9mlIQ52g for ; Wed, 12 Jan 2011 14:39:47 -0800 (PST) Received: from everglades.pioto.org (mail.pioto.org [207.192.71.235]) by olra.theworths.org (Postfix) with ESMTP id E14E142D2BF for ; Wed, 12 Jan 2011 14:39:46 -0800 (PST) Received: by everglades.pioto.org (Postfix, from userid 1000) id 249251616D0; Wed, 12 Jan 2011 17:39:45 -0500 (EST) From: Mike Kelly Subject: Re: About the json output and the number of results shown. To: notmuch@notmuchmail.org References: In-Reply-To: MIME-Version: 1.0 Date: Wed, 12 Jan 2011 22:39:45 +0000 Message-Id: <1294871985-ner-781@everglades> Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jan 2011 22:39:47 -0000 I've had other problems attempting to use the JSON interface recently. For starters, if I'm simply trying to retrieve a single message, the interface is rather awkard. I seem to need to do something like: my $json = `notmuch show --format=json id:$message_id`; my $parsed_json = decode_json($json); my $message = $parsed_json->[0][0][0]; And, when I'm doing my search earlier to even find those message ids, I need to do a check to `notmuch count` first to see if I'll even get any results, because the 0 result case is not valid JSON. Of course, any feedback, like "you're doing it wrong" would be helpful. My script is available at: http://git.pioto.org/gitweb?p=pioto-scripts.git;a=blob;f=mail/notmuch-poll.pl;hb=master -- Mike Kelly