Skip to content

Commit

Permalink
Do not generate incomplete data with dwca (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
jclombar committed Aug 23, 2021
1 parent 4b931bd commit 54376f7
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions gbif_dl/generators/dwca.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,23 @@ def dwca_generator(
else:
output_label = row.data

media_data = {
"url": url,
"basename": hashed_url,
"label": output_label,
}
if license_info:
media_data["publisher"] = selected_img.get(mmqualname + "publisher", None)
media_data["license"] = selected_img.get(mmqualname + "license", None)
media_data["rightsHolder"] = selected_img.get(
mmqualname + "rightsHolder",
selected_img.get(mmqualname + "creator", None),
)

yield media_data
if output_label and len(output_label) and url and len(url):
media_data = {
"url": url,
"basename": hashed_url,
"label": output_label,
}
if license_info:
media_data["publisher"] = selected_img.get(
mmqualname + "publisher", None
)
media_data["license"] = selected_img.get(mmqualname + "license", None)
media_data["rightsHolder"] = selected_img.get(
mmqualname + "rightsHolder",
selected_img.get(mmqualname + "creator", None),
)

yield media_data

if delete:
os.remove(dwca_path)
Expand Down

0 comments on commit 54376f7

Please sign in to comment.