diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-06-18 17:50:41 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-06-18 17:50:41 -0700 |
commit | 44e9dcf1c85be50f8d41b7a64586a3641069f594 (patch) | |
tree | df6a72652eea50b00aad5913a3e9605f4a9c4703 /tools/file_packager.py | |
parent | b4bc33518b838321fc5349b6464352248da5453d (diff) |
hint at crunch format
Diffstat (limited to 'tools/file_packager.py')
-rw-r--r-- | tools/file_packager.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/tools/file_packager.py b/tools/file_packager.py index c81e8b9f..812def9b 100644 --- a/tools/file_packager.py +++ b/tools/file_packager.py @@ -168,7 +168,18 @@ if crunch: except: pass # if one of them does not exist, continue on - Popen([CRUNCH, '-file', file_['name'], '-quality', crunch], stdout=sys.stderr).communicate() + # guess at format. this lets us tell crunch to not try to be clever and use odd formats like DXT5_AGBR + try: + format = Popen(['file', file_['name']], stdout=PIPE).communicate()[0] + if 'DXT5' in format: + format = ['-dxt5'] + elif 'DXT1' in format: + format = ['-dxt1'] + else: + raise Exception('unknown format') + except: + format = [] + Popen([CRUNCH, '-file', file_['name'], '-quality', crunch] + format, stdout=sys.stderr).communicate() shutil.move(os.path.basename(crunch_name), crunch_name) # crunch places files in the current dir # prepend the dds header crunched = open(crunch_name, 'rb').read() |