[Xapian-discuss] PowerPoint 2007 filter

James Aylett james-xapian at tartarus.org
Tue Feb 3 14:45:54 GMT 2009


On Wed, Feb 04, 2009 at 12:13:27AM +1030, Frank John Bruzzaniti wrote:

> I'm trying to write the PowerPoint2007 filter in the same manner that I
> did for *.docx and *.xlsx but I'm getting the following error when I tru
> an index.
> 
> The document is called:  
> 
> Indexing "/Frisk in Power Point.pptx" as
> application/vnd.openxmlformats-officedocument.presentationml.presentation ... caution: filename not matched:  ppt/notesSlides/notesSlide*.xml
> caution: filename not matched:  ppt/comments/comment*.xml
> 
> The problem is that not all pptx files contain notes and comments.
> 
> Do you think just including the slide text is enough, if not how can I
> test to see if the files exists, it looks like unzip throws an error id
> the file dosen;t exsist can I test this with a couple of if's (my c
> isn;t very good was hoping someone could help me with the coding).

One solution would be to do them individually, and check the return
value of unzip. Another would be to use something like:

$ unzip -lqq <pptx> ppt/notesSlides/notesSlide*.xml

which will give you one line per matched file; if there are none, you
can skip it. That's more fragile, though; I'd recommend checking the
return value instead.

You won't be able to use stdout_to_string() for that as it stands, but
you could perhaps extend it to sink stderr to /dev/null (and return the
return value through a referenced argument, although I don't think
you'll need it).

With the HAVE_FORK branch you could do that with
fd=open('/dev/null'); if (fd) { dup2(fd, 2); } or similar (heavens
knows what you'd do on a non-Unix platform). On the other branch, I
guess you might be able to do output redirection on the shell
invocation.

(If this doesn't mean much, you may need to wait for someone else to
come along to take this further.)

J

-- 
  James Aylett

  talktorex.co.uk - xapian.org - uncertaintydivision.org



More information about the Xapian-discuss mailing list