Permalink
Browse files

include primary image url in meta/objects.csv

  • Loading branch information...
1 parent 8bc3fa1 commit 24c1f17bed93a84d032bf1da1cdb54b687fef0bd straup committed Dec 10, 2012
Showing with 123,848 additions and 123,820 deletions.
  1. +28 −0 bin/generate-csv-objects.py
  2. +123,820 −123,820 meta/objects.csv
@@ -46,6 +46,33 @@
data = json.load(open(path, 'r'))
images = data.get('images', [])
+ primary_image = None
+
+ if len(images):
+
+ for img in images:
+
+ # huh? why...
+
+ if type(img) != types.DictType:
+ continue
+
+ for sz, details in img.items():
+
+ if sz != 'z':
+ continue
+
+ if int(details['is_primary']) != 1:
+ continue
+
+ primary_image = details['url']
+ break
+
+ if primary_image:
+ break
+
+ data['primary_image'] = primary_image
+
participants = data.get('participants', [])
exhibitions = data.get('exhibitions', [])
@@ -57,6 +84,7 @@
if not writer_objects:
keys = data.keys()
+ keys.append('primary_image')
keys.sort()
writer_objects = csv.DictWriter(fh_objects, fieldnames=keys)
writer_objects.writeheader()
Oops, something went wrong.

0 comments on commit 24c1f17

Please sign in to comment.