Skip to content
Snippets Groups Projects
Verified Commit c876437b authored by Timm Fitschen's avatar Timm Fitschen
Browse files

TST: add webm test data

parent a3a89be6
Branches
Tags
No related merge requests found
...@@ -22,10 +22,15 @@ ...@@ -22,10 +22,15 @@
# #
# ** end header # ** end header
import os
import caosdb import caosdb
import random 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 # clean
old = caosdb.execute_query("FIND Test*") old = caosdb.execute_query("FIND Test*")
...@@ -47,14 +52,19 @@ testdata = caosdb.Container() ...@@ -47,14 +52,19 @@ testdata = caosdb.Container()
## record with references ## record with references
refrec = caosdb.Record("TestPreviewRecord-references").add_parent("TestPreviewRecordType") refrec = caosdb.Record("TestPreviewRecord-references").add_parent("TestPreviewRecordType")
testdata.append(refrec) testdata.append(refrec)
video = caosdb.File(name="TestFile", file=filename, path="testfile.webm")
for i in ["load-forever", "fall-back", "error", "success", "success-2"]: for i in ["load-forever", "fall-back", "error", "success", "success-2"]:
rec = caosdb.Record("TestPreviewRecord-{}".format(i)).add_parent("TestPreviewRecordType") rec = caosdb.Record("TestPreviewRecord-{}".format(i)).add_parent("TestPreviewRecordType")
testdata.append(rec) testdata.append(rec)
refrec.add_property("TestPreviewRecordType", rec) refrec.add_property("TestPreviewRecordType", rec)
#testdate.append(image)
testdata.append(video)
testdata.insert(); testdata.insert();
os.remove(filename)
...@@ -86,7 +86,7 @@ var ext_bottom_line = function ($, logger, is_in_view_port, load_config, getEnti ...@@ -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_has_file_extension = function (entity, extensions) {
const path = getEntityPath(entity); const path = getEntityPath(entity);
if (path) { if (path) {
for (var ext in extensions) { for (var ext of extensions) {
if(path.toLowerCase().endsWith(ext)) { if(path.toLowerCase().endsWith(ext)) {
return true; return true;
} }
......
...@@ -181,15 +181,6 @@ ...@@ -181,15 +181,6 @@
<xsl:apply-templates mode="entity-body" select="Property"/> <xsl:apply-templates mode="entity-body" select="Property"/>
</xsl:if> </xsl:if>
</ul> </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> </div>
<!-- Annotations --> <!-- Annotations -->
<xsl:call-template name="annotation-section"> <xsl:call-template name="annotation-section">
...@@ -198,38 +189,6 @@ ...@@ -198,38 +189,6 @@
</xsl:call-template> </xsl:call-template>
</div> </div>
</xsl:template> </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 --> <!-- PROPERTIES -->
<xsl:template match="Property" mode="entity-body"> <xsl:template match="Property" mode="entity-body">
<li class="list-group-item caosdb-v-property-row caosdb-f-entity-property"> <li class="list-group-item caosdb-v-property-row caosdb-f-entity-property">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment