1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-11-15 13:55:03 -05:00

* 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"> <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="application.deployment" value="app" />
<javaproperty name="unixfs" value="false" /> <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.defaultConnectTimeout" value="10000" />
<javaproperty name="sun.net.client.defaultReadTimeout" value="60000" /> <javaproperty name="sun.net.client.defaultReadTimeout" value="60000" />
</jarbundler> </jarbundler>

View File

@ -4,4 +4,4 @@ while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
dir_bin="$( cd -P "$( dirname "$SOURCE" )" && pwd )" dir_bin="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
dir_app=$dir_bin/../Resources/Java 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 #!/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 { try {
MediaDetection.storeMetaInfo(file, episode); MediaDetection.storeMetaInfo(file, episode);
} catch (Throwable e) { } 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 { try {
MediaDetection.storeMetaInfo(file, movie); MediaDetection.storeMetaInfo(file, movie);
} catch (Throwable e) { } 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 // Template Engine helpers
import groovy.text.XmlTemplateEngine import groovy.text.XmlTemplateEngine
import groovy.text.GStringTemplateEngine import groovy.text.GStringTemplateEngine

View File

@ -237,14 +237,19 @@ public class MediaDetection {
// try xattr metadata if enabled // try xattr metadata if enabled
if (useExtendedFileAttributes()) { if (useExtendedFileAttributes()) {
for (File it : files) {
try { try {
Episode episode = (Episode) new MetaAttributes(it).getMetaData(); for (File it : files) {
MetaAttributes xattr = new MetaAttributes(it);
try {
Episode episode = (Episode) xattr.getMetaData();
names.add(episode.getSeriesName()); names.add(episode.getSeriesName());
} catch (Throwable e) { } catch (Exception e) {
// ignore // can't read meta attributes => ignore
} }
} }
} catch (Throwable e) {
Logger.getLogger(MediaDetection.class.getClass().getName()).warning("Failed to read xattr: " + e.getMessage());
}
} }
// try to detect series name via nfo files // try to detect series name via nfo files
@ -363,12 +368,17 @@ public class MediaDetection {
// try xattr metadata if enabled // try xattr metadata if enabled
if (useExtendedFileAttributes()) { if (useExtendedFileAttributes()) {
try { try {
Movie movie = (Movie) new MetaAttributes(movieFile).getMetaData(); MetaAttributes xattr = new MetaAttributes(movieFile);
try {
Movie movie = (Movie) xattr.getMetaData();
if (movie != null) { if (movie != null) {
options.add(movie); options.add(movie);
} }
} catch (Exception e) {
// can't read meta attributes => ignore
}
} catch (Throwable e) { } 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 // set creation date to episode / movie release date
if (model instanceof Episode) { 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) { } 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 { try {
fileAttributeView.setTimes(null, null, FileTime.fromMillis(millis)); fileAttributeView.setTimes(null, null, FileTime.fromMillis(millis));
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new IllegalStateException(e);
} }
} }

View File

@ -88,7 +88,7 @@ class RenameAction extends AbstractAction {
try { try {
MediaDetection.storeMetaInfo(match.getCandidate(), match.getValue()); MediaDetection.storeMetaInfo(match.getCandidate(), match.getValue());
} catch (Throwable e) { } 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());
} }
} }
} }