@@ -156,7 +156,7 @@ def update_from_zenodo(
156156
157157 print (f"Collecting items from zenodo: { zenodo_request } " )
158158
159- hits = r .json ()["hits" ]["hits" ]
159+ hits = r .json () # ["hits"]["hits"]
160160 if not hits :
161161 break
162162
@@ -167,8 +167,12 @@ def update_from_zenodo(
167167 assert isinstance (created , datetime ), created
168168 resource_path = collection / resource_doi / "resource.yaml"
169169 resource_output_path = dist / resource_doi / "resource.yaml"
170- version_name = f"version { hit ['metadata' ]['relations' ]['version' ][0 ]['index' ] + 1 } "
171- rdf_urls = [file_hit ["links" ]["self" ] for file_hit in hit ["files" ] if file_hit ["key" ] == "rdf.yaml" ]
170+ version_name = f"version from { hit ['metadata' ]['publication_date' ]} "
171+ rdf_urls = [
172+ file_hit ["links" ]["self" ]
173+ for file_hit in hit ["files" ]
174+ if (file_hit ["filename" ] == "rdf.yaml" or file_hit ["filename" ].endswith ("bioimageio.yaml" ))
175+ ]
172176 rdf = {}
173177 rdf_source = "unknown"
174178 name = doi
@@ -197,7 +201,7 @@ def update_from_zenodo(
197201 resource_type = rdf .get ("type" )
198202
199203 try :
200- download_count = int (hit ["stats" ]["unique_downloads" ])
204+ download_count = int (hit ["stats" ]["unique_downloads" ]) # todo: update zenodo api
201205 except Exception as e :
202206 warnings .warn (f"Could not determine download count: { e } " )
203207 download_count = 1
@@ -208,7 +212,7 @@ def update_from_zenodo(
208212 new_version = {
209213 "version_id" : version_id ,
210214 "doi" : doi ,
211- "owners" : hit ["owners" ],
215+ "owners" : [ hit ["owner" ] ],
212216 "created" : str (created ),
213217 "status" : "accepted" , # default to accepted
214218 "rdf_source" : rdf_source ,
0 commit comments