Don't compress common filetypes which are already compressed

This commit is contained in:
2014-12-19 14:19:26 +01:00
parent 6cfefb0ea1
commit 975a0a5f49
2 changed files with 44 additions and 9 deletions

View File

@@ -91,3 +91,36 @@ def write_json_to_file(path, data):
# optional (pretty)
sort_keys=True, indent=4, separators=(',', ': '),
)
def is_compressed_filetype(filepath):
"""
Use to check if we should compress files in a zip.
"""
# for now, only include files which Blender is likely to reference
import os
assert(isinstance(filepath, bytes))
return os.path.splitext(filepath)[1].lower() in {
# images
b'.exr',
b'.jpg', b'.jpeg',
b'.png',
# audio
b'.aif', b'.aiff',
b'.mp3',
b'.ogg', b'.ogv',
b'.wav',
# video
b'.avi',
b'.mkv',
b'.mov',
b'.mpg', b'.mpeg',
# archives
# '.bz2', '.tbz',
# '.gz', '.tgz',
# '.zip',
}