@@ -139,11 +139,9 @@ def objects_extract(args, j):
139139 description = object_description ["content" ]
140140 description += ";" .join (d ["content" ] for d in object_description ["subject_to" ] for d in d ["subject_of" ])
141141
142- author = None
143- if j ["produced_by" ].get ("referred_to_by" ):
144- author = iterables .find_dict_value (
145- j ["produced_by" ]["referred_to_by" ], _label = "Artist/Maker (Producer) Description"
146- ).get ("content" )
142+ author = traverse_obj (j , ["produced_by" , "referred_to_by" ])
143+ if author :
144+ author = iterables .find_dict_value (author , _label = "Artist/Maker (Producer) Description" ).get ("content" )
147145
148146 # TODO: deprecated but I don't want to make another HTTP call... calling their bluff
149147 image_path = [
@@ -165,7 +163,7 @@ def objects_extract(args, j):
165163
166164 d = {
167165 "path" : image_path or None ,
168- "name " : j ["_label" ],
166+ "title " : j ["_label" ],
169167 "types" : "; " .join (set (d ["_label" ] for d in j ["classified_as" ]) - ignore_types ),
170168 "description" : description ,
171169 "culture" : iterables .find_dict_value (j ["referred_to_by" ], _label = "Culture Statement" ).get ("content" ),
@@ -207,7 +205,9 @@ def update_objects(args):
207205 page_data = getty_fetch (unknown_object )
208206 if page_data :
209207 images = objects_extract (args , page_data )
210- args .db ["media" ].insert_all (images , alter = True , replace = True , pk = "id" )
208+ args .db ["media" ].insert_all (images , alter = True , pk = "id" )
209+ else :
210+ args .db ["media" ].insert ({'title' : '404 Not Found' , 'object_path' : unknown_object }, alter = True , pk = "id" )
211211
212212
213213def getty_add ():
0 commit comments