From 58f0f1cbebbc455cfdea23d2358fde1107b61b8b Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Thu, 16 Feb 2012 14:59:00 +0530 Subject: [PATCH] import --- import_padma.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/import_padma.py b/import_padma.py index 94dbb8c..f28d062 100755 --- a/import_padma.py +++ b/import_padma.py @@ -140,6 +140,7 @@ def item_data(data): u'source': u'project', u'collection': u'source', u'languages': u'language', + u'description': u'summary', }.get(key, key)] = value if 'director' in d: d['director'] = unicode(d['director']).replace(' and ', ', ').strip().split(', ') @@ -162,8 +163,8 @@ def import_layers(item, layers): 'locations': 'places' }.get(layer_name, layer_name) annotation = Annotation(item=item, layer=layer_name) - annotation.start = float(layer['time_in'])/1000 - annotation.end = float(layer['time_out'])/1000 + annotation.start = max(float(layer['time_in'])/1000, 0) + annotation.end = max(float(layer['time_out'])/1000, 0) if annotation.end < annotation.start: annotation.end, annotation.start = annotation.start, annotation.end username = layer['creator'].strip() @@ -274,7 +275,7 @@ for l in locations: l['modified'] = datetime.fromtimestamp(int(l['modified'])) l['alternativeNames'] = tuple(l['alternativeNames']) l['geoname'] = l['name'] - l['type'] = 'city' + l['type'] = 'feature' p, c = Place.objects.get_or_create(name=l['name']) for key in l: if key != 'annotations':