do not dump undefined locations, make sure out point is > inpoint
This commit is contained in:
parent
2b8e2e8219
commit
764a22aafb
2 changed files with 30 additions and 23 deletions
|
|
@ -160,6 +160,8 @@ def import_layers(item, layers):
|
|||
annotation = Annotation(item=item, layer=layer_name)
|
||||
annotation.start = float(layer['time_in'])/1000
|
||||
annotation.end = float(layer['time_out'])/1000
|
||||
if annotation.end < annotation.start:
|
||||
annotation.end = annotation.start + 3
|
||||
username = layer['creator'].strip()
|
||||
annotation.user = User.objects.get(username=username)
|
||||
annotation.value = html_parser(layer['value'])
|
||||
|
|
@ -183,6 +185,9 @@ for oldId in sorted(padma, key=lambda x: padma[x]['created']):
|
|||
item.user = User.objects.get(username=username)
|
||||
for key in _data:
|
||||
item.data[key] = _data[key]
|
||||
if 'collection' in data and data['collection']:
|
||||
group, created = Group.objects.get_or_create(name=data['collection'])
|
||||
item.groups.add(group)
|
||||
if 'poster_frame' in item.data:
|
||||
item.poster_frame = float(item.data.pop('poster_frame')) / 1000
|
||||
if 'published' in item.data:
|
||||
|
|
@ -260,6 +265,7 @@ for l in locations:
|
|||
l['user'] = User.objects.get(username=l['user'].strip())
|
||||
else:
|
||||
l['user'] = User.objects.all().order_by('id')[0]
|
||||
l['name'] = ox.decodeHtml(l['name'])
|
||||
l['created'] = datetime.fromtimestamp(int(l['created']))
|
||||
l['modified'] = datetime.fromtimestamp(int(l['modified']))
|
||||
l['alternativeNames'] = tuple(l['alternativeNames'])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue