diff --git a/installer/msi/filebot.l4j.ini b/installer/msi/filebot.l4j.ini index 1fcd2b0c..f6072797 100644 --- a/installer/msi/filebot.l4j.ini +++ b/installer/msi/filebot.l4j.ini @@ -15,6 +15,7 @@ # use NTFS extended attributes for storing metadata -DuseExtendedFileAttributes=true +-DuseCreationDate=true # look for native libs here -Djna.library.path="%EXEDIR%" diff --git a/installer/msi/filebot.launcher.l4j.ini b/installer/msi/filebot.launcher.l4j.ini index 59c67834..95383e74 100644 --- a/installer/msi/filebot.launcher.l4j.ini +++ b/installer/msi/filebot.launcher.l4j.ini @@ -19,6 +19,7 @@ # use NTFS extended attributes for storing metadata -DuseExtendedFileAttributes=true +-DuseCreationDate=true # look for native libs here -Djna.library.path="%EXEDIR%" diff --git a/installer/msi/filebot.platform.launcher.l4j.ini b/installer/msi/filebot.platform.launcher.l4j.ini index ab2f0511..4abe43e8 100644 --- a/installer/msi/filebot.platform.launcher.l4j.ini +++ b/installer/msi/filebot.platform.launcher.l4j.ini @@ -23,6 +23,7 @@ # do not use NTFS extended attributes for storing metadata -DuseExtendedFileAttributes=false +-DuseCreationDate=false # look for native libs here -Djna.library.path="%EXEDIR%" diff --git a/installer/portable/FileBot.l4j.ini b/installer/portable/FileBot.l4j.ini index 3458760b..a9a5f2d4 100644 --- a/installer/portable/FileBot.l4j.ini +++ b/installer/portable/FileBot.l4j.ini @@ -17,6 +17,7 @@ # do not use NTFS extended attributes for storing metadata -DuseExtendedFileAttributes=false +-DuseCreationDate=false # put all temporary files here -Djava.io.tmpdir="%EXEDIR%\temp" diff --git a/source/net/sourceforge/filebot/Main.java b/source/net/sourceforge/filebot/Main.java index ba22087a..be66a2dc 100644 --- a/source/net/sourceforge/filebot/Main.java +++ b/source/net/sourceforge/filebot/Main.java @@ -156,6 +156,7 @@ public class Main { } if (args.disableExtendedAttributes) { System.setProperty("useExtendedFileAttributes", "false"); + System.setProperty("useCreationDate", "false"); } if (args.action.equalsIgnoreCase("test")) { System.setProperty("useExtendedFileAttributes", "false"); diff --git a/source/net/sourceforge/filebot/Settings.java b/source/net/sourceforge/filebot/Settings.java index d94e86fb..97babbff 100644 --- a/source/net/sourceforge/filebot/Settings.java +++ b/source/net/sourceforge/filebot/Settings.java @@ -1,7 +1,5 @@ - package net.sourceforge.filebot; - import static net.sourceforge.tuned.StringUtilities.*; import java.awt.GraphicsEnvironment; @@ -17,19 +15,16 @@ import net.sourceforge.tuned.PreferencesMap; import net.sourceforge.tuned.PreferencesMap.PreferencesEntry; import net.sourceforge.tuned.PreferencesMap.StringAdapter; - public final class Settings { - + public static String getApplicationName() { return getApplicationProperty("application.name"); } - - + public static String getApplicationVersion() { return getApplicationProperty("application.version"); } - - + public static int getApplicationRevisionNumber() { try { return Integer.parseInt(getApplicationProperty("application.revision")); @@ -37,33 +32,31 @@ public final class Settings { return 0; } } - - + public static String getApplicationProperty(String key) { return ResourceBundle.getBundle(Settings.class.getName(), Locale.ROOT).getString(key); } - - + public static boolean isUnixFS() { return Boolean.parseBoolean(System.getProperty("unixfs")); } - - + public static boolean useNativeShell() { return Boolean.parseBoolean(System.getProperty("useNativeShell")); } - - + public static boolean useGVFS() { return Boolean.parseBoolean(System.getProperty("useGVFS")); } - - + public static boolean useExtendedFileAttributes() { return Boolean.parseBoolean(System.getProperty("useExtendedFileAttributes")); } - - + + public static boolean useCreationDate() { + return Boolean.parseBoolean(System.getProperty("useCreationDate")); + } + public static boolean useDonationReminder() { String deployment = getApplicationDeployment(); for (String it : new String[] { "ppa", "appstore" }) { @@ -73,8 +66,7 @@ public final class Settings { } return true; } - - + public static int getPreferredThreadPoolSize() { try { return Integer.parseInt(System.getProperty("threadPool")); @@ -82,24 +74,22 @@ public final class Settings { return Runtime.getRuntime().availableProcessors(); } } - - + public static String getApplicationDeployment() { String deployment = System.getProperty("application.deployment"); if (deployment != null) return deployment; - + if (System.getProperty("javawebstart.version") != null) return "webstart"; - + return null; } - - + public static File getApplicationFolder() { String applicationDirPath = System.getProperty("application.dir"); File applicationFolder = null; - + if (applicationDirPath != null && applicationDirPath.length() > 0) { // use given path applicationFolder = new File(applicationDirPath); @@ -107,43 +97,37 @@ public final class Settings { // create folder in user home (can't use working directory for web start applications) applicationFolder = new File(System.getProperty("user.home"), ".filebot"); } - + // create folder if necessary if (!applicationFolder.exists()) { applicationFolder.mkdirs(); } - + return applicationFolder; } - - + public static Settings forPackage(Class type) { return new Settings(Preferences.userNodeForPackage(type)); } - + private final Preferences prefs; - - + private Settings(Preferences prefs) { this.prefs = prefs; } - - + public Settings node(String nodeName) { return new Settings(prefs.node(nodeName)); } - - + public String get(String key) { return get(key, null); } - - + public String get(String key, String def) { return prefs.get(key, def); } - - + public void put(String key, String value) { if (value != null) { prefs.put(key, value); @@ -151,53 +135,46 @@ public final class Settings { remove(key); } } - - + public void remove(String key) { prefs.remove(key); } - - + public PreferencesEntry entry(String key) { return new PreferencesEntry(prefs, key, new StringAdapter()); } - - + public PreferencesMap asMap() { return PreferencesMap.map(prefs); } - - + public PreferencesList asList() { return PreferencesList.map(prefs); } - - + public void clear() { try { // remove child nodes for (String nodeName : prefs.childrenNames()) { prefs.node(nodeName).removeNode(); } - + // remove entries prefs.clear(); } catch (BackingStoreException e) { throw ExceptionUtilities.asRuntimeException(e); } } - - + public static String getApplicationIdentifier() { return joinBy(" ", getApplicationName(), getApplicationVersion(), String.format("(r%s)", getApplicationRevisionNumber())); } - - + public static String getJavaRuntimeIdentifier() { String name = System.getProperty("java.runtime.name"); String version = System.getProperty("java.version"); String headless = GraphicsEnvironment.isHeadless() ? "(headless)" : null; return joinBy(" ", name, version, headless); } - + } diff --git a/source/net/sourceforge/filebot/cli/CmdlineOperations.java b/source/net/sourceforge/filebot/cli/CmdlineOperations.java index c09cab73..97a246e5 100644 --- a/source/net/sourceforge/filebot/cli/CmdlineOperations.java +++ b/source/net/sourceforge/filebot/cli/CmdlineOperations.java @@ -609,7 +609,7 @@ public class CmdlineOperations implements CmdlineInterface { } // write metadata into xattr if xattr is enabled - if (matches != null && useExtendedFileAttributes()) { + if (matches != null && (useExtendedFileAttributes() || useCreationDate())) { try { for (Match match : matches) { File file = match.getValue(); @@ -617,7 +617,7 @@ public class CmdlineOperations implements CmdlineInterface { if (renameMap.containsKey(file) && meta != null) { File destination = resolveDestination(file, renameMap.get(file), false); if (destination.isFile()) { - MediaDetection.storeMetaInfo(destination, meta, file.getName()); + MediaDetection.storeMetaInfo(destination, meta, file.getName(), useExtendedFileAttributes(), useCreationDate()); } } } diff --git a/source/net/sourceforge/filebot/format/MediaBindingBean.java b/source/net/sourceforge/filebot/format/MediaBindingBean.java index 9294e2d2..0752b5f4 100644 --- a/source/net/sourceforge/filebot/format/MediaBindingBean.java +++ b/source/net/sourceforge/filebot/format/MediaBindingBean.java @@ -3,7 +3,6 @@ package net.sourceforge.filebot.format; import static java.util.Arrays.*; import static java.util.Collections.*; import static net.sourceforge.filebot.MediaTypes.*; -import static net.sourceforge.filebot.Settings.*; import static net.sourceforge.filebot.format.Define.*; import static net.sourceforge.filebot.hash.VerificationUtilities.*; import static net.sourceforge.filebot.media.MediaDetection.*; @@ -358,13 +357,13 @@ public class MediaBindingBean { } @Define("original") - public String getOriginalFileName() { + public String getOriginalFileName() throws Exception { return getOriginalFileName(mediaFile); } @Define("xattr") - public Object getMetaAttributesObject() { - return getMetaAttributesObject(mediaFile); + public Object getMetaAttributesObject() throws Exception { + return new MetaAttributes(mediaFile).getObject(); } @Define("crc32") @@ -860,25 +859,11 @@ public class MediaBindingBean { } private String getOriginalFileName(File file) { - if (useExtendedFileAttributes()) { - try { - return new MetaAttributes(file).getOriginalName(); - } catch (Throwable e) { - // ignore - } + try { + return new MetaAttributes(file).getOriginalName(); + } catch (Throwable e) { + return null; } - return null; - } - - private Object getMetaAttributesObject(File file) { - if (useExtendedFileAttributes()) { - try { - return new MetaAttributes(file).getObject(); - } catch (Throwable e) { - // ignore - } - } - return null; } } diff --git a/source/net/sourceforge/filebot/media/MediaDetection.java b/source/net/sourceforge/filebot/media/MediaDetection.java index 2c5001c3..8d5052eb 100644 --- a/source/net/sourceforge/filebot/media/MediaDetection.java +++ b/source/net/sourceforge/filebot/media/MediaDetection.java @@ -1312,37 +1312,41 @@ public class MediaDetection { } }; - public static void storeMetaInfo(File file, Object model, String original) { + public static void storeMetaInfo(File file, Object model, String original, boolean useExtendedFileAttributes, boolean useCreationDate) { // only for Episode / Movie objects - if ((model instanceof Episode || model instanceof Movie) && file.exists()) { + if ((useExtendedFileAttributes || useCreationDate) && (model instanceof Episode || model instanceof Movie) && file.isFile()) { try { MetaAttributes xattr = new MetaAttributes(file); // set creation date to episode / movie release date - try { - if (model instanceof Episode) { - Episode episode = (Episode) model; - if (episode.getAirdate() != null) { - xattr.setCreationDate(episode.getAirdate().getTimeStamp()); - } - } else if (model instanceof Movie) { - Movie movie = (Movie) model; - if (movie.getYear() > 0) { - xattr.setCreationDate(new Date(movie.getYear(), 1, 1).getTimeStamp()); + if (useCreationDate) { + try { + if (model instanceof Episode) { + Episode episode = (Episode) model; + if (episode.getAirdate() != null) { + xattr.setCreationDate(episode.getAirdate().getTimeStamp()); + } + } else if (model instanceof Movie) { + Movie movie = (Movie) model; + if (movie.getYear() > 0) { + xattr.setCreationDate(new Date(movie.getYear(), 1, 1).getTimeStamp()); + } } + } catch (Exception e) { + Logger.getLogger(MediaDetection.class.getClass().getName()).warning("Failed to set creation date: " + e.getMessage()); } - } catch (Exception e) { - Logger.getLogger(MediaDetection.class.getClass().getName()).warning("Failed to set creation date: " + e.getMessage()); } // store original name and model as xattr - try { - xattr.setObject(model); - if (xattr.getOriginalName() == null && original != null) { - xattr.setOriginalName(original); + if (useExtendedFileAttributes) { + try { + xattr.setObject(model); + if (xattr.getOriginalName() == null && original != null) { + xattr.setOriginalName(original); + } + } catch (Exception e) { + Logger.getLogger(MediaDetection.class.getClass().getName()).warning("Failed to set xattr: " + e.getMessage()); } - } catch (Exception e) { - Logger.getLogger(MediaDetection.class.getClass().getName()).warning("Failed to set xattr: " + e.getMessage()); } } catch (Throwable t) { Logger.getLogger(MediaDetection.class.getClass().getName()).warning(t.toString()); diff --git a/source/net/sourceforge/filebot/ui/rename/RenameAction.java b/source/net/sourceforge/filebot/ui/rename/RenameAction.java index 10eee95c..db5992a8 100644 --- a/source/net/sourceforge/filebot/ui/rename/RenameAction.java +++ b/source/net/sourceforge/filebot/ui/rename/RenameAction.java @@ -115,7 +115,7 @@ class RenameAction extends AbstractAction { } // write metadata into xattr if xattr is enabled - if (useExtendedFileAttributes()) { + if (useExtendedFileAttributes() || useCreationDate()) { try { for (Match match : matches) { File file = match.getCandidate(); @@ -123,7 +123,7 @@ class RenameAction extends AbstractAction { if (renameMap.containsKey(file) && meta != null) { File destination = resolveDestination(file, renameMap.get(file), false); if (destination.isFile()) { - MediaDetection.storeMetaInfo(destination, meta, file.getName()); + MediaDetection.storeMetaInfo(destination, meta, file.getName(), useExtendedFileAttributes(), useCreationDate()); } } } diff --git a/website/data/release-groups.txt b/website/data/release-groups.txt index 2a7c7e80..c6e97967 100644 --- a/website/data/release-groups.txt +++ b/website/data/release-groups.txt @@ -1284,6 +1284,7 @@ LeON LEVERAGE LEViTY LF +LFF LGLuX Lightmaker lilwoodenboy @@ -2338,6 +2339,7 @@ x4subs XanaX xander XC +Xell XF XiA XII