From 93afb4e4659e5ab7209d14c4d1a79bd8a5f9b1d3 Mon Sep 17 00:00:00 2001 From: j Date: Thu, 9 Aug 2018 14:42:54 +0100 Subject: [PATCH 1/2] build blob from Uint8Array --- static/js/exportAnnotationsDialog.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/static/js/exportAnnotationsDialog.js b/static/js/exportAnnotationsDialog.js index dbf74c34..4db7cf84 100644 --- a/static/js/exportAnnotationsDialog.js +++ b/static/js/exportAnnotationsDialog.js @@ -105,6 +105,17 @@ pandora.ui.exportAnnotationsDialog = function(options) { updateLink(); } + function textBlob(data) { + data = Ox.encodeUTF8(data); + var byteNumbers = new Array(data.length); + for (var i = 0; i < data.length; i++) { + byteNumbers[i] = data.charCodeAt(i); + } + var byteArray = new Uint8Array(byteNumbers); + var blob = new Blob([byteArray], {type: 'text/plain; charset=utf-8'}); + return blob; + } + function updateLink() { var layer = $layerSelect.value(), format = $formatSelect.value(), @@ -121,11 +132,11 @@ pandora.ui.exportAnnotationsDialog = function(options) { text: text }; }), - blob = new Blob([Ox.encodeUTF8( + blob = textBlob( format == 'json' ? JSON.stringify(items, null, ' ') : Ox.formatSRT(items) - )], {type: 'text/plain; charset=utf-8'}), + ), url = window.URL.createObjectURL(blob); $link.attr({ From cb55ebaf4cf8097f87de1e46869ca5e90c9ad9aa Mon Sep 17 00:00:00 2001 From: j Date: Thu, 9 Aug 2018 15:47:29 +0100 Subject: [PATCH 2/2] followup to 0c99cbfaac158faa31c888ff20120ee2d1345624 list of filters now --- pandora/clip/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandora/clip/models.py b/pandora/clip/models.py index 64639bdd..76cc4588 100644 --- a/pandora/clip/models.py +++ b/pandora/clip/models.py @@ -117,7 +117,8 @@ class MetaClip(object): #annotations = self.annotations.filter(layer__in=settings.CONFIG['clipLayers']) annotations = self.annotations.all() if qs: - annotations = annotations.filter(qs) + for q in qs: + annotations = annotations.filter(q) entity_cache = {} j['annotations'] = [ a.json(keys=['value', 'id', 'layer'], entity_cache=entity_cache) for a in annotations