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 = Annotation(item=item, layer=layer_name)
|
||||||
annotation.start = float(layer['time_in'])/1000
|
annotation.start = float(layer['time_in'])/1000
|
||||||
annotation.end = float(layer['time_out'])/1000
|
annotation.end = float(layer['time_out'])/1000
|
||||||
|
if annotation.end < annotation.start:
|
||||||
|
annotation.end = annotation.start + 3
|
||||||
username = layer['creator'].strip()
|
username = layer['creator'].strip()
|
||||||
annotation.user = User.objects.get(username=username)
|
annotation.user = User.objects.get(username=username)
|
||||||
annotation.value = html_parser(layer['value'])
|
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)
|
item.user = User.objects.get(username=username)
|
||||||
for key in _data:
|
for key in _data:
|
||||||
item.data[key] = _data[key]
|
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:
|
if 'poster_frame' in item.data:
|
||||||
item.poster_frame = float(item.data.pop('poster_frame')) / 1000
|
item.poster_frame = float(item.data.pop('poster_frame')) / 1000
|
||||||
if 'published' in item.data:
|
if 'published' in item.data:
|
||||||
|
@ -260,6 +265,7 @@ for l in locations:
|
||||||
l['user'] = User.objects.get(username=l['user'].strip())
|
l['user'] = User.objects.get(username=l['user'].strip())
|
||||||
else:
|
else:
|
||||||
l['user'] = User.objects.all().order_by('id')[0]
|
l['user'] = User.objects.all().order_by('id')[0]
|
||||||
|
l['name'] = ox.decodeHtml(l['name'])
|
||||||
l['created'] = datetime.fromtimestamp(int(l['created']))
|
l['created'] = datetime.fromtimestamp(int(l['created']))
|
||||||
l['modified'] = datetime.fromtimestamp(int(l['modified']))
|
l['modified'] = datetime.fromtimestamp(int(l['modified']))
|
||||||
l['alternativeNames'] = tuple(l['alternativeNames'])
|
l['alternativeNames'] = tuple(l['alternativeNames'])
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vi:si:et:sw=2:sts=2:ts=2
|
# vi:si:et:sw=4:sts=4:ts=4
|
||||||
# GPL written 2008 by j@pad.ma
|
# GPL written 2008 by j@pad.ma
|
||||||
|
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
|
@ -93,6 +93,7 @@ with open(os.path.join(prefix, 'lists.json'), 'w') as f:
|
||||||
|
|
||||||
locations = []
|
locations = []
|
||||||
for l in Location.select().orderBy('id'):
|
for l in Location.select().orderBy('id'):
|
||||||
|
if l.lat_center != 0 and l.lng_center != 0 and l.area != 0:
|
||||||
data = {}
|
data = {}
|
||||||
data['id'] = l.hid
|
data['id'] = l.hid
|
||||||
data['name'] = l.name
|
data['name'] = l.name
|
||||||
|
|
Loading…
Reference in a new issue