Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #all the imports
- file = load_image_file() # load file into memory
- file_type, hash, size = analyze_image() #analyze the image including e.g virus scans, other malicious data content
- meta_data = None #this will be metadata specific to the filetype
- if is_animated(file_type):
- meta_data = get_video_meta_data(file) # returns a VideoMetaData model object
- elif is_image(file_type):
- meta_data = get_image_meta_data(file) # returns a ImageMetaData model object
- else:
- meta_data = get_generic_meta_data(file) #returns a generic MetaData object, which the other metadata objects inherit from
- meta_data.save()
- file_obj = File(
- hash_sha1=hash,
- file_size=size,
- file_meta=meta_data
- )
- file_obj.save()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement