From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rainer M Krug Subject: Re: Okular Metadata to Org Date: Mon, 22 Nov 2010 10:13:25 +0100 Message-ID: <4CEA3435.9080600@gmail.com> References: <87wro8zuk4.fsf@irigaray.ross.mayfirst.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Return-path: Received: from [140.186.70.92] (port=52589 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PKSSq-0004U5-Bf for emacs-orgmode@gnu.org; Mon, 22 Nov 2010 04:13:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PKSSp-0005kO-2e for emacs-orgmode@gnu.org; Mon, 22 Nov 2010 04:13:32 -0500 Received: from mail-bw0-f41.google.com ([209.85.214.41]:35653) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PKSSo-0005ju-MJ for emacs-orgmode@gnu.org; Mon, 22 Nov 2010 04:13:31 -0500 Received: by bwz16 with SMTP id 16so6091443bwz.0 for ; Mon, 22 Nov 2010 01:13:29 -0800 (PST) In-Reply-To: <87wro8zuk4.fsf@irigaray.ross.mayfirst.org> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Ross Glover Cc: emacs-orgmode@gnu.org -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 11/20/2010 01:51 AM, Ross Glover wrote: > Hi All, > > My first post to the list. I've been working on this python script to > extract Okular metadata and insert it into an org-mode file. I like > using Okular to read and take notes, but accessing those notes is a > total pain. This script takes care of that problem. > > You can get the code here: > git clone git://lair.fifthhorseman.net/~rossg/okutorg.git > > What the script does is read the xml and creates a .org file with this > structure: > > * [[/home/USER/articles/feminism/aronson-Feminism_or_Post-feminism.pdf]] > ** [[bibnotes:1 /home/USER/articles/feminism/aronson-Feminism_or_Post-feminism.pdf][Young women no longer]] > Young women no longer concern themselves with discrimination. > > By adding the following lisp to my .emacs files, each 'bibnotes' link > type will open the file to the page on which the note was taken. > Unfortunately, Okular has no switch for opening on a specified > annotation, but the page is not a bad result. > > {{{ > ;; Open okular from org bibnotes to correct page. > (org-add-link-type "bibnotes" 'org-follow-bibnotes-link) > (defun org-follow-bibnotes-link (link) > "Follow links of the type 'pagenumber path/to/file" > (when (string-match "\\([0-9]+\\)\\([[:blank:]]+\\)\\(\/.*\.pdf\\)" link) > (start-process "okular" nil "okular" "-p" > (match-string 1 link) > (match-string 3 link)))) > }}} > > > The overall code is not great, as I am not a great coder by any > stretch. Nor is the script feature rich, currently it just does a > recursive dump of all the okular metadata files that have > annotations. It does check the .org file for duplicate entries, but in > a rudamentary fashion. > > I wanted to integrate this with pymacs or do the import with > lisp, but both of those things are beyond me at the moment. > > Any thoughts are welcome. You're welcome to flame me about feminism, > but please not about the code (I know it's weak). This is the first > thing I've ever made public. Help don't hate ;) . I like it - it looks really nice. I liked okular as well, but reluctant to use as the comments and notes were for me locked into okular, which I did not like. So with this script, I can at least extract them to be readable from org. 1) Are you planning to also include the edits (new text, ...) into the org file, as it would be useful to have all those in it. 2) Would it be possible to re-use an existing okular instance? it is a little bit annoying to have several instances open, when browsing through notes. As I said, I like the script, and I am thinking about running this as a batch job each time I start emacs. Now we just need the opposite: click in a pdf at a certain location and org opens with the link to there to add the note - am I dreaming here? Cheers, Rainer > > Hopefully someone else will find this useful, > > Ross > - -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Natural Sciences Building Office Suite 2039 Stellenbosch University Main Campus, Merriman Avenue Stellenbosch South Africa Tel: +33 - (0)9 53 10 27 44 Cell: +27 - (0)8 39 47 90 42 Fax (SA): +27 - (0)8 65 16 27 82 Fax (D) : +49 - (0)3 21 21 25 22 44 Fax (FR): +33 - (0)9 58 10 27 44 email: Rainer@krugs.de Skype: RMkrug -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkzqNDUACgkQoYgNqgF2egp9MwCfYracbYeqLz75q20SzrPY3MOv wEQAn3Z5GIpyVhOBbAQz8ISJI4E4udGW =/1s/ -----END PGP SIGNATURE-----