Le mer 06/01/10 14:27, "Tommi Mäkitalo" [email protected] a écrit:
> There is a flag -t in zimDump, which switches to search by title. I just
> realized that this is missing on the help page. I will add that.
>
> To find a article by title use:
> zimDump -t -i -f "MyTitle" myzimfile.zim
:)
I wanted to try the "-t" parameter, but I now don' t understand why the second
command does not return the article with idx=4
$zimDump -i -f 8P articles.zim
url: 9
title: The Beatles
idx: 4
namespace: A
redirect: 0
mime-type: 0
article size: 177163
$ zimDump -t -i -f "The Beatles" articles.zim
url: 10
title: 10
idx: 9
namespace: I
redirect: 0
mime-type: 3
article size: 24152
The ZIM file can be found here:
http://tmp.kiwix.org/tmp/articles.zim
> To use it in your application use iterators:
>
> zim::File::const_iterator it = zimFile.find('A', "MyUrl");
> or
> zim::File::const_iterator it = zimFile.findByTitle('A', "MyTitle");
>
> This will return a iterator to the first article whose url (or title) is
> equal
or greater than the passed string. You have to compare the iterator against
>
zimFile.end() to check, if it points really to a valid article. If you look
>
for a range of articles starting with a specific url (or title) you have to
> do
that manually e.g.:
> zim::File::const_iterator itFirst = zimFile.find('A', "MyUrl");
> zim::File::const_iterator itLast = zimFile.find('A', "MyUrm");
>
> or by comparing yourself:
> for (zim::File::const_iterator it = zimFile.find('A', "MyUrl");
> it != zimFile.end() && it->getUrl().compare(0, 5, "MyUrl") == 0)
> ++it)
> {
> }
Perfect, will test it ASAP.
Emmanuel
_______________________________________________
dev-l mailing list
[email protected]
https://intern.openzim.org/mailman/listinfo/dev-l