(→Look for existing code) |
Vandenoever (Talk | contribs) (fix link) |
||
| Line 23: | Line 23: | ||
== Look for existing code == | == Look for existing code == | ||
| − | If you want to see some code examples, take a look at the already implemented file analyzers at [http://websvn.kde.org/trunk/ | + | If you want to see some code examples, take a look at the already implemented file analyzers at [http://websvn.kde.org/trunk/kdesupport/strigi/src/streamindexer/ /kdesupport/strigi/src/streamindexer/] |
== Testing your code == | == Testing your code == | ||
Contents |
File analyzers extract data from files to display in the file dialogs and file managers. The data gathered this way is also used to search for files. KDE4 allows the use of multiple analyzers per file type. Analyzers can extract text which is used for indexing, but they can also retrieve other data such as song title, album title, recipient, md5 sum, the mimetype of a file, and much more.
This tutorial describes how you can write new analyzers.
KDE4 uses stream based file analyzers for retrieving text and metadata from files. This has a number of advantages over file based methods. Stream based access
Writing stream-based analyzers requires a different approach than the usual file-based methods and in the tutorial we will explain how to go about it.
If you want to see some code examples, take a look at the already implemented file analyzers at /kdesupport/strigi/src/streamindexer/
Strigi comes with a simple command line tool to check if your plugins work. This tool is called xmlindexer. It extracts data from files and outputs it as simple xml. To use it call it like this:
xmlindexer [FILE]
or
xmlindexer [DIR]
This is very fast and I recommend using it with valgrind. This hardly slows down your workflow but helps to keep memory managment in good shape:
valgrind xmlindexer [DIR]