From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ross Glover Subject: Okular Metadata to Org Date: Fri, 19 Nov 2010 19:51:23 -0500 Message-ID: <87wro8zuk4.fsf@irigaray.ross.mayfirst.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from [140.186.70.92] (port=45795 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PJbtu-0005Lj-TW for emacs-orgmode@gnu.org; Fri, 19 Nov 2010 20:06:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PJbg2-000122-HA for emacs-orgmode@gnu.org; Fri, 19 Nov 2010 19:51:39 -0500 Received: from malcolm.mayfirst.org ([209.51.163.199]:60997) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PJbg2-00011y-FU for emacs-orgmode@gnu.org; Fri, 19 Nov 2010 19:51:38 -0500 Received: from localhost (localhost [127.0.0.1]) by malcolm.mayfirst.org (Postfix) with ESMTP id D8B1040107 for ; Fri, 19 Nov 2010 19:51:37 -0500 (EST) Received: from malcolm.mayfirst.org ([127.0.0.1]) by localhost (malcolm.mayfirst.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XQ5sdGFQzvfB for ; Fri, 19 Nov 2010 19:51:37 -0500 (EST) 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: emacs-orgmode@gnu.org 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 ;) . Hopefully someone else will find this useful, Ross -- Sent from an Emacs buffer.