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'])
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- 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
|
||||
|
||||
import pkg_resources
|
||||
|
@ -93,6 +93,7 @@ with open(os.path.join(prefix, 'lists.json'), 'w') as f:
|
|||
|
||||
locations = []
|
||||
for l in Location.select().orderBy('id'):
|
||||
if l.lat_center != 0 and l.lng_center != 0 and l.area != 0:
|
||||
data = {}
|
||||
data['id'] = l.hid
|
||||
data['name'] = l.name
|
||||
|
|
Loading…
Reference in a new issue