Hi Martin,

Awesome!  Thanks for pointing this out.  The documents app or the Document 
model have no way to report when a document is ready for usage because this 
functionality is done by other apps.  The thumbnail is generated by the 
converter app and the text OCR/parsing is done by the ocr app (
https://github.com/rosarior/mayan/blob/hotfix/v0.12.3/apps/ocr/__init__.py#L78).
 
 Both of these apps in turn call operating system binaries to handle their 
tasks.  I would go about this by adding a .is_parsed() property to the 
Document model that is handled by the ocr app that returns True when the 
document was been processed without errors from the OCR queue and a 
.has_thumbnail() or similar to the Document model handled by the converter 
app if the appropiate preview is ready in the image_cache folder.  Would 
these help you out?

--Roberto

On Monday, October 29, 2012 6:26:33 AM UTC-4, Martin Kubát wrote:
>
> Hi,
> I would like to create API for Mayan (it will be public after will be 
> complete). And I have problem with check state, when is document succesfuly 
> parsed (know good document's page, parsed plain text from document, 
> generated thumbnails).
> Example of development version is here: 
> http://simpledwarf.appspot.com/paste/view/841016 . With other application 
> communicate this API with python Pyro library (
> http://pypi.python.org/pypi/Pyro4).
>
> When I call API upload_document method too fast (more documents in - for 
> example - 10 seconds), method will return wrong value of pages-count. And 
> when I can get plaintext from uploaded document, I must wait (10-? seconds) 
> before is document ready.
> Is there some "document is complete ready" indicator or method?
> Have somebody some hint?
>
> Thanks 
> Martin Kubát, 
> COEX, Czech Republic
>

-- 



Reply via email to