Feat: extract exr preview file to be displayed on GUI
This commit is contained in:
committed by
Sheepit Renderfarm
parent
3cb7b5fc5f
commit
690ad36adb
@@ -41,11 +41,21 @@ import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.TimeZone;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class Utils {
|
||||
|
||||
private static Map<String, String> mimeTypes = new HashMap<>();
|
||||
|
||||
static {
|
||||
mimeTypes.put(".tga", "image/tga");
|
||||
mimeTypes.put(".exr", "image/x-exr");
|
||||
}
|
||||
|
||||
public static int unzipFileIntoDirectory(String zipFileName_, String destinationDirectory, char[] password, Log log) {
|
||||
try {
|
||||
ZipFile zipFile = new ZipFile(zipFileName_);
|
||||
@@ -227,12 +237,14 @@ public class Utils {
|
||||
mimeType = URLConnection.guessContentTypeFromName(file);
|
||||
}
|
||||
|
||||
if (mimeType == null && file.endsWith(".tga")) { // fallback for TGA
|
||||
mimeType = "image/tga";
|
||||
}
|
||||
|
||||
if (mimeType == null && file.endsWith(".exr")) { // fallback for EXR
|
||||
mimeType = "image/x-exr";
|
||||
if (mimeType == null || (mimeType.equals("image/aces") && file.toLowerCase().endsWith(".exr"))) {
|
||||
try {
|
||||
String extension = file.substring(file.lastIndexOf('.'));
|
||||
mimeType = mimeTypes.get(extension);
|
||||
}
|
||||
catch (IndexOutOfBoundsException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return mimeType;
|
||||
|
||||
Reference in New Issue
Block a user