in gnm_deliverables/views/deliverables_dash_views.py [0:0]
def find_smallest_poster(atom_info):
"""
finds the smallest posterImage or returns None if there were not any
:param atom_info: dictionary of atom info. It's expected that this will have a "posterImage" key,
which will in turn have an "assets" key which is an array
:return:
"""
current_size = 9999999
current_url = None
try:
for entry in atom_info["data"]["media"]["posterImage"]["assets"]:
if "dimensions" in entry and "width" in entry["dimensions"]:
if entry["dimensions"]["width"] < current_size:
current_size = entry["dimensions"]["width"]
current_url = entry["file"]
except KeyError:
return None
return current_url