Show shot thumbnails.

This commit is contained in:
2016-11-03 14:48:19 +01:00
parent 4c3a537b1c
commit 7c9f762785
2 changed files with 11 additions and 5 deletions

View File

@@ -12,6 +12,7 @@ from pillar.web.system_util import pillar_api
from attract.routes import attract_project_view
from attract.node_types.shot import node_type_shot
from attract import current_attract, ROLES_REQUIRED_TO_VIEW_ITEMS
from pillar.web.utils import get_file
perproject_blueprint = Blueprint('attract.shots.perproject', __name__,
url_prefix='/<project_url>/shots')
@@ -35,6 +36,15 @@ def for_project(project, attract_props, task_id=None, shot_id=None):
}, api=api)
shots = found['_items']
thumb_placeholder = flask.url_for('static_attract', filename='assets/img/placeholder.jpg')
for shot in shots:
picture = get_file(shot.picture, api=api)
if picture:
shot._thumbnail = next((var.link for var in picture.variations
if var.size == 't'), thumb_placeholder)
else:
shot._thumbnail = thumb_placeholder
tasks_for_shots = current_attract.shot_manager.tasks_for_shots(
shots,
attract_props.task_types.attract_shot,