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.
@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?
OK, this what you search for I believe https://libzim.readthedocs.io/en/latest/api/classzim_1_1writer_1_1Item.html?highlight=front#_CPPv4NK3zim6writer4Item8getHintsEv
@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
@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