Further converter refactor and initial move from document-centric to page-centric image generation. Issue #93.

This commit is contained in:
Roberto Rosario
2015-06-06 06:26:44 -04:00
parent de6182aea0
commit f4752a3f3f
7 changed files with 105 additions and 207 deletions

View File

@@ -36,7 +36,7 @@ from .serializers import (
RecentDocumentSerializer
)
from .settings import DISPLAY_SIZE, ZOOM_MAX_LEVEL, ZOOM_MIN_LEVEL
from .tasks import task_get_document_image, task_new_document
from .tasks import task_get_document_page_image, task_new_document
class APIDocumentListView(generics.ListAPIView):
@@ -202,8 +202,10 @@ class APIDocumentImageView(generics.GenericAPIView):
rotation = int(request.GET.get('rotation', DEFAULT_ROTATION)) % 360
document_page = document.pages.get(page_number=page)
try:
task = task_get_document_image.apply_async(kwargs=dict(document_id=document.pk, size=size, page=page, zoom=zoom, rotation=rotation, as_base64=True, version=version), queue='converter')
task = task_get_document_page_image.apply_async(kwargs=dict(document_page_id=document_page.pk, size=size, zoom=zoom, rotation=rotation, as_base64=True, version=version), queue='converter')
return Response({
'status': 'success',
'data': task.get(timeout=DOCUMENT_IMAGE_TASK_TIMEOUT)