makinacorpus/django-screamshot — pull request #26 by lucmilland (2014-04-25 14:11:02+00:00)
Title: added a object implementation of screenshot, with some kind of caching through a manager

Hello,
here is an implementation of screenshot as Django model objects. I needed this because I wanted to be able to display web pages capture on my web site, but I did not want to trigger live captures for all of them at the same time. Some kind of caching was needed.
So here it is : screenshots can be defined in the admin with all capture_js parameters. A custom manager is used to update the oldest expired screenshot each time get_queryset is called.
Screenshot updates can be forced on object save and automatic update can be bypassed.
I don't know if someone will find this usefull, so here it is and use it or not :)
This is not fully tested and should be considered as a work in progress.
Know bug : if a CSS3 selector is used but not found in page, process_casperjs_stdout raises a CaptureError exception which is still not handled in my code (my guess is that a custom validator is needed on the css_selector field).

regards,
Luc