From c876437b811f0750e2e414d50dd03c14866af885 Mon Sep 17 00:00:00 2001 From: Timm Fitschen <t.fitschen@indiscale.com> Date: Fri, 17 Apr 2020 15:05:26 +0200 Subject: [PATCH] TST: add webm test data --- misc/ext_bottom_line_test_data.py | 12 ++++++++- src/core/js/ext_bottom_line.js | 2 +- src/core/xsl/entity.xsl | 41 ------------------------------- 3 files changed, 12 insertions(+), 43 deletions(-) diff --git a/misc/ext_bottom_line_test_data.py b/misc/ext_bottom_line_test_data.py index 8c2609b4..628465fb 100755 --- a/misc/ext_bottom_line_test_data.py +++ b/misc/ext_bottom_line_test_data.py @@ -22,10 +22,15 @@ # # ** end header +import os import caosdb import random +import wget - +filename = "small.webm" +if not os.path.isfile(filename): + filename = wget.download("http://techslides.com/demos/sample-videos/small.webm") +caosdb.configure_connection(ssl_insecure=True) # clean old = caosdb.execute_query("FIND Test*") @@ -47,14 +52,19 @@ testdata = caosdb.Container() ## record with references refrec = caosdb.Record("TestPreviewRecord-references").add_parent("TestPreviewRecordType") testdata.append(refrec) + +video = caosdb.File(name="TestFile", file=filename, path="testfile.webm") for i in ["load-forever", "fall-back", "error", "success", "success-2"]: rec = caosdb.Record("TestPreviewRecord-{}".format(i)).add_parent("TestPreviewRecordType") testdata.append(rec) refrec.add_property("TestPreviewRecordType", rec) +#testdate.append(image) +testdata.append(video) testdata.insert(); +os.remove(filename) diff --git a/src/core/js/ext_bottom_line.js b/src/core/js/ext_bottom_line.js index 39c2f3b2..1de8525c 100644 --- a/src/core/js/ext_bottom_line.js +++ b/src/core/js/ext_bottom_line.js @@ -86,7 +86,7 @@ var ext_bottom_line = function ($, logger, is_in_view_port, load_config, getEnti const _path_has_file_extension = function (entity, extensions) { const path = getEntityPath(entity); if (path) { - for (var ext in extensions) { + for (var ext of extensions) { if(path.toLowerCase().endsWith(ext)) { return true; } diff --git a/src/core/xsl/entity.xsl b/src/core/xsl/entity.xsl index 2a4a803f..7187c6b7 100644 --- a/src/core/xsl/entity.xsl +++ b/src/core/xsl/entity.xsl @@ -181,15 +181,6 @@ <xsl:apply-templates mode="entity-body" select="Property"/> </xsl:if> </ul> - <!-- Thumbnail --> - <xsl:if test="@path"> - <xsl:call-template name="entity-body-thumbnail"> - <xsl:with-param name="path" select="@path"/> - </xsl:call-template> - <xsl:call-template name="entity-body-video"> - <xsl:with-param name="path" select="@path"/> - </xsl:call-template> - </xsl:if> </div> <!-- Annotations --> <xsl:call-template name="annotation-section"> @@ -198,38 +189,6 @@ </xsl:call-template> </div> </xsl:template> - <!-- Thumbnails of images --> - <xsl:template name="entity-body-thumbnail"> - <xsl:param name="path"/> - <xsl:if test="contains('.jpg.gif.png.svg',translate(substring($path, string-length($path) - 3), 'JPGIFNSV', 'jpgifnsv'))"> - <div class="row"> - <div class="col-sm-12"> - <img class="entity-image-preview" style="max-width: 200px; max-height: 140px;"> - <xsl:attribute name="src"> - <xsl:value-of select="concat($filesystempath,$path)"/> - </xsl:attribute> - </img> - </div> - </div> - </xsl:if> - </xsl:template> - <!-- Video display --> - <xsl:template name="entity-body-video"> - <xsl:param name="path"/> - <xsl:if test="contains('.mp4.mov.webm',translate(substring($path, string-length($path) - 3), 'MPOVWEB', 'mpovweb'))"> - <div class="row"> - <div class="col-sm-12"> - <video controls="controls"> - <source> - <xsl:attribute name="src"> - <xsl:value-of select="concat($filesystempath,$path)"/> - </xsl:attribute> - </source> - </video> - </div> - </div> - </xsl:if> - </xsl:template> <!-- PROPERTIES --> <xsl:template match="Property" mode="entity-body"> <li class="list-group-item caosdb-v-property-row caosdb-f-entity-property"> -- GitLab