Commit Graph

225 Commits

Author SHA1 Message Date
j 548a73f121 python3 only: remove six.moves imports 2020-05-29 12:17:18 +02:00
j 844382b1e8 drop python2 support, upgrade to django 3 2020-05-29 00:25:16 +02:00
j faeb2ddd2d document folded annotations, include clip_id in annots 2019-11-12 11:40:14 +00:00
j 4e0c73c2fa async annotation import 2018-12-31 14:48:10 +01:00
j 55b86bdac8 use get_or_create(defaults...) 2018-11-20 16:15:08 +01:00
j fcc27eb900 sort annotations by id 2018-11-15 15:23:03 +00:00
j 9983fdbf1e layer does not need special case 2018-11-06 15:33:08 +01:00
j 04e1adf53e return annotation layer by default 2018-10-09 19:44:12 +02:00
j f93ece1ab7 add db based translations
load translations from files
and adds option to translate
string layers (i.e. keywords)
2018-09-19 16:53:30 +02:00
j 1e5d7e99b3 merge comment 2018-09-18 11:05:58 +02:00
j 6296be870b use get_user_model 2018-07-29 21:12:56 +01:00
j bd0732b8d5 rename item.json -> item.cache 2018-07-09 15:22:12 +02:00
j ebd23c9e52 use add_arguments 2018-06-19 20:36:22 +02:00
j dbf740e55e use .editorconfig 2018-06-19 08:33:26 +02:00
j 41d4e52f84 don't fail on removed layers 2017-07-26 13:33:08 +02:00
j fb738c25cf self.id 2017-06-28 12:55:01 +02:00
j ae3afc93c3 space 2017-06-09 09:25:43 +02:00
j fbd94867fc fix documents 2017-06-01 17:00:36 +02:00
j f0a4aba751 use python_2_unicode_compatible 2017-03-03 08:56:35 +01:00
j 67b2fd698b fix save place 2017-02-25 11:18:59 +01:00
j 12f3901c9a py3 filter->list(filter 2017-02-16 14:24:51 +01:00
j b23ca9df74 store document references in db 2017-01-26 15:56:28 +00:00
j 844d1697bd remove unused annotation.tasks.update_matches 2016-09-06 00:19:36 +02:00
j 4d1711cb01 only update subtitles if needed 2016-09-06 00:13:40 +02:00
j d53659c0c4 move annotation update_matches logic into models 2016-09-05 23:46:36 +02:00
j 1c580a2df7 async update of annotation matches, fixes deadlock in load_subtitles 2016-08-31 18:03:19 +02:00
j 1468ddbecb towards supporting python 2 and 3
- use absolute_imports
- make use of six.moves
- use exec instead of execfile
- use list(dict) instead if dict.keys()
2016-08-25 18:34:36 +02:00
j 337cafcf76 don't add base keys to Item.data 2016-08-08 15:54:52 +02:00
j 6f4a0ba90a support vtt subtitles 2016-07-01 21:13:13 +02:00
j e9863c238e always use get_operator, avoid case-insensitive match if possible 2016-06-30 11:28:09 +02:00
j b6e4d33a43 add Annotation.findvalue index (used by findClips) 2016-06-30 02:42:24 +02:00
Will Thompson 05e6118a88
findAnnotations: include duration alongside result count
fixes #2921
2016-05-05 15:54:25 +01:00
Will Thompson 2812834ce3
findAnnotations: don't lowercase ids (fixes #2916)
Without this fix, a condition like:

     {key: 'id', operator: '==', value: 'A/B'}

gets mapped to:

     public_id__exact=('A/B'.lower())

which is wrong.

I introduced this bug in b3df5b8. I didn't catch it because I was
mostly interested in the 'layer' key -- but layer names are
conventionally lowercase anyway so lowercasing them had no effect.
2016-04-29 11:03:45 +01:00
Will Thompson aa40a40595
Annotation.json: only include entity id & name
Fetching documents for each entity in turn is expensive. (I have tried
using ArrayAgg to fetch them in the same query as the Entity — no
improvement. It's possible that being able to join to entity_entity,
and then use ArrayAgg, would be better.)

Even once you've fetched them all, if the same entity appears many
times in an item, then get(..., keys=['layers']) duplicates the whole
JSON for the entity many times: expensive to serialize, expensive to
send over the wire.

Pandora's own web interface only depends on the 'id' key of 'entity' in
each annotation, and refetches the rest of the entity to show the pop-up
dialog when you press E. So by just not bothering to fetch and send any
other keys, get(..., keys=['layers']) on an item with many entity
annotations is substantially faster.

(I experimented with splitting the full entities off to one side, so,
you'd have:

    {
        "layers": {
            somelayer: [...,
              {..., "entity": {"id": ABC}},
            ], ...
        },
        "entities": {
            ABC: {...},
            ...
        }
    }

This is quicker than the status quo, but obviously not as fast as not
fetching & sending the rest at all!)
2016-04-28 14:15:23 +01:00
Will Thompson 400b6650a2
Annotation.json: document empty-subtitle special case 2016-04-19 13:52:52 +01:00
Will Thompson af0d87b569
Annotation.json: reduce repeated layer lookups
It's actually quite costly to look up keys in CONFIG, particularly
inside a loop: this trims ~5% off get(keys=['layers']) for
annotation-heavy items.
2016-04-19 13:52:47 +01:00
Will Thompson b3df5b8d56 findAnnotations: match some fields case-sensitively
Requiring layer to have the right case is consistent with
addAnnotation(), and means the _layer[_like] index can be used. In my
testing, if itemsQuery specifies a single item, then postgres doesn't
bother with the layer index anyway; but if not, it makes a pretty big
(~3×) difference.

Matching public_id and item__public_id case-sensitively also seems
reasonable (it's consistent with get() and getAnnotation()).

(Is lower() redundant for the case-insensitive comparisons? ie. is
UPPER(x.lower()) == UPPER(x)? I'm not sure, it's cheap, let's leave it.)
2016-04-05 12:19:32 +01:00
Will Thompson 8d1b4de337 findAnnotations(): make 'findvalue' the default key
Annotations have no 'name' field, so

     findAnnotations({query: {conditions: [{value: 'foo'}]}})

would previously raise an exception.
2016-04-05 12:19:31 +01:00
j 4f28c2c548 fix annotation import, values are decoded in d1.9 2016-03-05 15:36:47 +05:30
j 11924fcb0d Rename api.taskStatus to api.getTaskStatus
still register api.taskStatus since its used
in pandora_client and other scripts.

fixes #2600 and fixes #2859
2016-02-20 18:35:26 +05:30
j 051a3578b4 inline django 1.9 version of ox.django 2016-02-20 10:41:23 +00:00
j 4219246909 db migration 2016-02-20 15:15:01 +05:30
j 1cc795995d user.get_profile()->user.profile 2016-02-19 22:06:11 +05:30
j e22cc432b3 use transaction.atomic 2016-02-19 21:55:09 +05:30
j e738503380 remove old migrations 2016-02-19 15:17:18 +00:00
j 6b1ce30eb2 from __future__ import print_function 2016-02-18 16:19:26 +05:30
Will Thompson cdaa50c4d3 addAnnotations: report which key is missing in error 2016-02-04 10:38:02 +00:00
Will Thompson 729856eb30 Rename getTaskStatus -> taskStatus in API docs (fixes #2859) 2016-02-04 10:38:01 +00:00
rolux 4ed2d940cf migrate annotation sequence in item not annotation 2015-10-12 15:24:03 +01:00
Will Thompson 4f064fda76 Make Annotation.public_id non-NULLable (fixes #2829)
This fixes this race:

     request 1                          request 2
     -----------------------------      -------------------------
     addAnnotation(...)
     super(Annotation.self).save()
                                        findAnnotations(...)
                                        returns [{id: null, ...}]
     annotation.public_id = x
     returns {id: x}
2015-09-14 14:18:10 +02:00