"""Get product metadata.""" from video.constants import job_io_fields from video.logic.activity_task_logger import activity_task_logger from video.models import ows_video @activity_task_logger([ job_io_fields.PRODUCT_ID, ]) def get_product_metadata(inputs): """Get product metadata. Args: inputs (dict): Inputs. Returns: dict: Product metadata. """ product_id = inputs[job_io_fields.PRODUCT_ID] metadata_response = ows_video.get_product_metadata(product_id) thumbnail_path = metadata_response['thumbnail_path'] custom_thumbnail_path = metadata_response['custom_thumbnail_path'] upc = metadata_response['upc'] return { job_io_fields.THUMBNAIL_S3_KEY: ( 'thumbnails/original-size/{}'.format(thumbnail_path)), job_io_fields.CUSTOM_THUMBNAIL_S3_KEY: ( 'thumbnails/custom/{}'.format(custom_thumbnail_path) if custom_thumbnail_path else None ), job_io_fields.UPC: upc }