From 90c4fff1ff9228533c307e8611aa5292ce00de00 Mon Sep 17 00:00:00 2001 From: Bryon Lews Date: Fri, 14 Aug 2020 16:31:25 -0400 Subject: [PATCH 1/3] Video Fix --- server/viame_server/viame_detection.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server/viame_server/viame_detection.py b/server/viame_server/viame_detection.py index ceece63b1..fcc28950b 100644 --- a/server/viame_server/viame_detection.py +++ b/server/viame_server/viame_detection.py @@ -45,10 +45,12 @@ def _get_clip_meta(self, folder): videoUrl = None # Find a video tagged with an h264 codec left by the transcoder - video = Item().findOne({'folderId': folder['_id'], 'meta.codec': 'h264',}) + item = Item().findOne({'folderId': folder['_id'], 'meta.codec': 'h264',}) + video = Item().childFiles(item)[0] + if video: videoUrl = ( - f'/api/v1/item/{str(video["_id"])}/download?contentDisposition=inline' + f'/api/v1/file/{str(video["_id"])}/download?contentDisposition=inline' ) return { From b7a02dfaf552f0ce0f1e490c1af79bdee47a6945 Mon Sep 17 00:00:00 2001 From: Bryon Lews Date: Mon, 17 Aug 2020 07:26:08 -0400 Subject: [PATCH 2/3] Some extra error checking --- server/viame_server/viame_detection.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/server/viame_server/viame_detection.py b/server/viame_server/viame_detection.py index fcc28950b..02332110c 100644 --- a/server/viame_server/viame_detection.py +++ b/server/viame_server/viame_detection.py @@ -46,12 +46,12 @@ def _get_clip_meta(self, folder): videoUrl = None # Find a video tagged with an h264 codec left by the transcoder item = Item().findOne({'folderId': folder['_id'], 'meta.codec': 'h264',}) - video = Item().childFiles(item)[0] - - if video: - videoUrl = ( - f'/api/v1/file/{str(video["_id"])}/download?contentDisposition=inline' - ) + if item: + video = Item().childFiles(item)[0] + if video: + videoUrl = ( + f'/api/v1/file/{str(video["_id"])}/download?contentDisposition=inline' + ) return { 'folder': folder, From 68e84c9ca52df7bea0bbc97e84757214aba2feba Mon Sep 17 00:00:00 2001 From: Bryon Lews Date: Mon, 17 Aug 2020 09:41:00 -0400 Subject: [PATCH 3/3] Addressing comments --- server/viame_server/viame_detection.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/server/viame_server/viame_detection.py b/server/viame_server/viame_detection.py index 02332110c..28932b692 100644 --- a/server/viame_server/viame_detection.py +++ b/server/viame_server/viame_detection.py @@ -48,10 +48,9 @@ def _get_clip_meta(self, folder): item = Item().findOne({'folderId': folder['_id'], 'meta.codec': 'h264',}) if item: video = Item().childFiles(item)[0] - if video: - videoUrl = ( - f'/api/v1/file/{str(video["_id"])}/download?contentDisposition=inline' - ) + videoUrl = ( + f'/api/v1/file/{str(video["_id"])}/download?contentDisposition=inline' + ) return { 'folder': folder,