openzim / libzim

Reference implementation of the ZIM specification

Home Page:https://download.openzim.org/release/libzim/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how to determine the type of `Item`?

xiaoyifang opened this issue · comments

for example ,
to determine if the item is article ,css ,js ,image?
mime_type seems not enough.

commented

@xiaoyifang What do you want to know and why that the mime-type does not tell you?

xiaoyifang/goldendict-ng#725
I'm working on this.

I need to index the article in goldendict which has to distinguish between the article and resource file(css,js).

why that the mime-type does not tell you?

which mime-type does article have? text/html?
will text/plain be article too?

commented

@xiaoyifang Sorry, my comment above is wrong. This is a writer class not for the reader. Once the zim is created, you don't have access to the hint anymore.

For you, there is no real way to know, from an item, is this front/top contentbor a resource.

But you can use the iterator over titles index for your indexation as only front items (theoritically might as well be images) need/have a title.

Hope this helps

I'll have a try. Thanks for the help

commented

@xiaoyifang If you have more questions, it might be easier to join the Kiwix workspace on Slack (#cpp channel) https://join.slack.com/t/kiwixoffline/shared_invite/zt-19s7tsi68-xlgHdmDr5c6MJ7uFmJuBkg