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
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......@@ -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;
}
......
......@@ -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">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment