* fine-tune xattr related logging and standard settings

This commit is contained in:
Reinhard Pointner 2012-10-24 10:10:03 +00:00
parent 2d3b6cf3a4
commit 2d9242a13b
8 changed files with 43 additions and 19 deletions

View File

@ -208,7 +208,7 @@
<jarbundler dir="${dir.dist}" name="${title}" version="${version}" build="${svn.revision}" icon="${dir.installer}/appbundle/icon.icns" bundleid="net.sourceforge.filebot" jar="${dir.dist}/appbundle/FileBot.jar" stubfile="${dir.installer}/appbundle/JavaApplicationStub" workingdirectory="$APP_PACKAGE/Contents/Resources/Java" mainclass="net.sourceforge.filebot.Main" jvmversion="1.6+" vmoptions="-Xmx256m">
<javaproperty name="application.deployment" value="app" />
<javaproperty name="unixfs" value="false" />
<javaproperty name="useExtendedFileAttributes" value="true" />
<javaproperty name="useExtendedFileAttributes" value="false" />
<javaproperty name="sun.net.client.defaultConnectTimeout" value="10000" />
<javaproperty name="sun.net.client.defaultReadTimeout" value="60000" />
</jarbundler>

View File

@ -4,4 +4,4 @@ while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
dir_bin="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
dir_app=$dir_bin/../Resources/Java
java -Xmx256m -Djava.awt.headless=true -Dunixfs=false -DuseExtendedFileAttributes=true -Dapplication.deployment=app "-Djna.library.path=$dir_app" "-Djava.library.path=$dir_app" -Dsun.net.client.defaultConnectTimeout=5000 -Dsun.net.client.defaultReadTimeout=25000 -jar "$dir_app/FileBot.jar" "$@"
java -Xmx256m -Djava.awt.headless=true -Dunixfs=false -DuseExtendedFileAttributes=false -Dapplication.deployment=app "-Djna.library.path=$dir_app" "-Djava.library.path=$dir_app" -Dsun.net.client.defaultConnectTimeout=5000 -Dsun.net.client.defaultReadTimeout=25000 -jar "$dir_app/FileBot.jar" "$@"

View File

@ -1,2 +1,2 @@
#!/bin/sh
java -Dunixfs=false -DuseExtendedFileAttributes=false -Dapplication.deployment=ipkg -Dapplication.dir=$HOME/.filebot -Djava.io.tmpdir=$HOME/.filebot/temp -Djna.library.path=/usr/share/filebot -Djava.library.path=/usr/share/filebot -Dsun.net.client.defaultConnectTimeout=10000 -Dsun.net.client.defaultReadTimeout=60000 -jar /usr/share/filebot/FileBot.jar "$@"
java -Dunixfs=false -DuseExtendedFileAttributes=true -Dapplication.deployment=ipkg -Dapplication.dir=$HOME/.filebot -Djava.io.tmpdir=$HOME/.filebot/temp -Djna.library.path=/usr/share/filebot -Djava.library.path=/usr/share/filebot -Dsun.net.client.defaultConnectTimeout=10000 -Dsun.net.client.defaultReadTimeout=60000 -jar /usr/share/filebot/FileBot.jar "$@"

View File

@ -212,7 +212,7 @@ public class CmdlineOperations implements CmdlineInterface {
try {
MediaDetection.storeMetaInfo(file, episode);
} catch (Throwable e) {
CLILogger.warning(e.getMessage());
CLILogger.warning("Failed to write xattr: " + e.getMessage());
}
}
@ -481,7 +481,7 @@ public class CmdlineOperations implements CmdlineInterface {
try {
MediaDetection.storeMetaInfo(file, movie);
} catch (Throwable e) {
CLILogger.warning(e.getMessage());
CLILogger.warning("Failed to write xattr: " + e.getMessage());
}
}

View File

@ -98,6 +98,14 @@ def telnet(host, int port, csn = 'utf-8', Closure handler) {
}
// json-io helpers
import com.cedarsoftware.util.io.*
Object.metaClass.objectToJson = { pretty = true -> JsonWriter.objectToJson(delegate, pretty) }
String.metaClass.jsonToObject = { JsonReader.jsonToJava(delegate) }
String.metaClass.jsonToMap = { JsonReader.jsonToMaps(delegate) }
// Template Engine helpers
import groovy.text.XmlTemplateEngine
import groovy.text.GStringTemplateEngine

View File

@ -237,13 +237,18 @@ public class MediaDetection {
// try xattr metadata if enabled
if (useExtendedFileAttributes()) {
for (File it : files) {
try {
Episode episode = (Episode) new MetaAttributes(it).getMetaData();
names.add(episode.getSeriesName());
} catch (Throwable e) {
// ignore
try {
for (File it : files) {
MetaAttributes xattr = new MetaAttributes(it);
try {
Episode episode = (Episode) xattr.getMetaData();
names.add(episode.getSeriesName());
} catch (Exception e) {
// can't read meta attributes => ignore
}
}
} catch (Throwable e) {
Logger.getLogger(MediaDetection.class.getClass().getName()).warning("Failed to read xattr: " + e.getMessage());
}
}
@ -363,12 +368,17 @@ public class MediaDetection {
// try xattr metadata if enabled
if (useExtendedFileAttributes()) {
try {
Movie movie = (Movie) new MetaAttributes(movieFile).getMetaData();
if (movie != null) {
options.add(movie);
MetaAttributes xattr = new MetaAttributes(movieFile);
try {
Movie movie = (Movie) xattr.getMetaData();
if (movie != null) {
options.add(movie);
}
} catch (Exception e) {
// can't read meta attributes => ignore
}
} catch (Throwable e) {
// ignore
Logger.getLogger(MediaDetection.class.getClass().getName()).warning("Failed to read xattr: " + e.getMessage());
}
}
@ -781,9 +791,15 @@ public class MediaDetection {
// set creation date to episode / movie release date
if (model instanceof Episode) {
metadata.setCreationDate(((Episode) model).airdate().getTimeStamp());
Episode episode = (Episode) model;
if (episode.airdate() != null) {
metadata.setCreationDate(episode.airdate().getTimeStamp());
}
} else if (model instanceof Movie) {
metadata.setCreationDate(new Date(((Movie) model).getYear(), 1, 1).getTimeStamp());
Movie movie = (Movie) model;
if (movie.getYear() > 0) {
metadata.setCreationDate(new Date(movie.getYear(), 1, 1).getTimeStamp());
}
}
}

View File

@ -33,7 +33,7 @@ public class MetaAttributes {
try {
fileAttributeView.setTimes(null, null, FileTime.fromMillis(millis));
} catch (IOException e) {
throw new RuntimeException(e);
throw new IllegalStateException(e);
}
}

View File

@ -88,7 +88,7 @@ class RenameAction extends AbstractAction {
try {
MediaDetection.storeMetaInfo(match.getCandidate(), match.getValue());
} catch (Throwable e) {
Logger.getLogger(RenameAction.class.getName()).log(Level.WARNING, e.getMessage());
Logger.getLogger(RenameAction.class.getName()).warning("Failed to write xattr: " + e.getMessage());
}
}
}