This commit is contained in:
j 2012-02-16 14:59:00 +05:30
parent d81c50f590
commit 58f0f1cbeb

View file

@ -140,6 +140,7 @@ def item_data(data):
u'source': u'project', u'source': u'project',
u'collection': u'source', u'collection': u'source',
u'languages': u'language', u'languages': u'language',
u'description': u'summary',
}.get(key, key)] = value }.get(key, key)] = value
if 'director' in d: if 'director' in d:
d['director'] = unicode(d['director']).replace(' and ', ', ').strip().split(', ') d['director'] = unicode(d['director']).replace(' and ', ', ').strip().split(', ')
@ -162,8 +163,8 @@ def import_layers(item, layers):
'locations': 'places' 'locations': 'places'
}.get(layer_name, layer_name) }.get(layer_name, layer_name)
annotation = Annotation(item=item, layer=layer_name) annotation = Annotation(item=item, layer=layer_name)
annotation.start = float(layer['time_in'])/1000 annotation.start = max(float(layer['time_in'])/1000, 0)
annotation.end = float(layer['time_out'])/1000 annotation.end = max(float(layer['time_out'])/1000, 0)
if annotation.end < annotation.start: if annotation.end < annotation.start:
annotation.end, annotation.start = annotation.start, annotation.end annotation.end, annotation.start = annotation.start, annotation.end
username = layer['creator'].strip() username = layer['creator'].strip()
@ -274,7 +275,7 @@ for l in locations:
l['modified'] = datetime.fromtimestamp(int(l['modified'])) l['modified'] = datetime.fromtimestamp(int(l['modified']))
l['alternativeNames'] = tuple(l['alternativeNames']) l['alternativeNames'] = tuple(l['alternativeNames'])
l['geoname'] = l['name'] l['geoname'] = l['name']
l['type'] = 'city' l['type'] = 'feature'
p, c = Place.objects.get_or_create(name=l['name']) p, c = Place.objects.get_or_create(name=l['name'])
for key in l: for key in l:
if key != 'annotations': if key != 'annotations':