def import_screenshot(production_id, janeway_id, url, suffix): blob = fetch_origin_url(url) sha1 = blob.sha1 img = PILConvertibleImage(blob.as_io_buffer(), name_hint=blob.filename) basename = sha1[0:2] + '/' + sha1[2:4] + '/' + sha1[4:8] + '.jw' + str( janeway_id) + suffix + '.' screenshot = Screenshot(production_id=production_id, data_source='janeway', janeway_id=janeway_id, janeway_suffix=suffix) upload_original(img, screenshot, basename, reduced_redundancy=False) upload_standard(img, screenshot, basename) upload_thumb(img, screenshot, basename) screenshot.save()
def import_screenshot(production_id, janeway_id, url, suffix): blob = fetch_origin_url(url) sha1 = blob.sha1 img = PILConvertibleImage(blob.as_io_buffer(), name_hint=blob.filename) basename = sha1[0:2] + '/' + sha1[2:4] + '/' + sha1[4:8] + '.jw' + str( janeway_id) + suffix + '.' screenshot = Screenshot(production_id=production_id, data_source='janeway', janeway_id=janeway_id, janeway_suffix=suffix) upload_standard(img, screenshot, basename) upload_thumb(img, screenshot, basename) # leave upload_original until last to prevent things screwing up if the storage # closes the original file handle upload_original(img, screenshot, basename) screenshot.save()