def create_from_json_oembed(link=None, oembed_doc=None, thumbnail_file_path=None):
"""
Ideally this is a link right now. Specificallly a video link.
JSON object, thumbnail_path, and the actual url comes in, a sha1 should be created from the url and the
file_key takes that sha1 value. Then call get_from_file with the type=link
value set along with the thumbnail path in place.
The resulting sourcefile should then have the data field set with the oembed doc.
A source file should be created and returned.
"""
sha1_key = Sourcefile.get_sha1_file_key(file_path=None, file_data=link)
sf = Sourcefile.get_from_file(thumbnail_file_path, sha1_key, type='link')
if sf:
sf.data = json_encode(oembed_doc)
sf.save()
return sf
评论列表
文章目录