* better logic for path-separator clean-up for expression bindings
* new ant-task to automatically deploy fatjat/webstart-jars
This commit is contained in:
parent
193c53273b
commit
911cc24ba5
31
build.xml
31
build.xml
@ -2,7 +2,7 @@
|
|||||||
<project name="FileBot" default="jar">
|
<project name="FileBot" default="jar">
|
||||||
|
|
||||||
<property name="title" value="${ant.project.name}" />
|
<property name="title" value="${ant.project.name}" />
|
||||||
<property name="version" value="1.9" />
|
<property name="version" value="r420" />
|
||||||
|
|
||||||
<tstamp>
|
<tstamp>
|
||||||
<format property="today" pattern="yyyy-MM-dd" />
|
<format property="today" pattern="yyyy-MM-dd" />
|
||||||
@ -249,4 +249,33 @@
|
|||||||
<java jar="${dir.dist}/fatjar/FileBot_${version}.jar" fork="true" />
|
<java jar="${dir.dist}/fatjar/FileBot_${version}.jar" fork="true" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
<target name="deploy">
|
||||||
|
<!-- ask for sourceforge password -->
|
||||||
|
<input message="Please enter password:" addproperty="sf.password" />
|
||||||
|
|
||||||
|
<!-- create fatjar release folder -->
|
||||||
|
<mkdir dir="${dir.dist}/release" />
|
||||||
|
|
||||||
|
<!-- copy fatjar and source -->
|
||||||
|
<copy todir="${dir.dist}/release/FileBot_${version}">
|
||||||
|
<fileset dir="${dir.dist}" includes="*-src.zip" />
|
||||||
|
<fileset dir="${dir.dist}/fatjar" includes="*.jar" />
|
||||||
|
</copy>
|
||||||
|
|
||||||
|
<!-- deploy source zip first-->
|
||||||
|
<scp todir="rednoah,filebot:${sf.password}@web.sourceforge.net:/home/frs/project/f/fi/filebot/filebot" trust="yes">
|
||||||
|
<fileset dir="${dir.dist}/release" includes="**/*-src.zip" />
|
||||||
|
</scp>
|
||||||
|
|
||||||
|
<!-- deploy fatjar afterwards so it will be the latest file release -->
|
||||||
|
<scp todir="rednoah,filebot:${sf.password}@web.sourceforge.net:/home/frs/project/f/fi/filebot/filebot" trust="yes">
|
||||||
|
<fileset dir="${dir.dist}/release" includes="**/*.jar"/>
|
||||||
|
</scp>
|
||||||
|
|
||||||
|
<!-- deploy webstart jars -->
|
||||||
|
<scp todir="rednoah,filebot:${sf.password}@web.sourceforge.net:htdocs/webstart" trust="yes">
|
||||||
|
<fileset dir="${dir.dist}/webstart" />
|
||||||
|
</scp>
|
||||||
|
</target>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
@ -5,7 +5,6 @@ package net.sourceforge.filebot.format;
|
|||||||
import static net.sourceforge.filebot.MediaTypes.*;
|
import static net.sourceforge.filebot.MediaTypes.*;
|
||||||
import static net.sourceforge.filebot.format.Define.*;
|
import static net.sourceforge.filebot.format.Define.*;
|
||||||
import static net.sourceforge.filebot.hash.VerificationUtilities.*;
|
import static net.sourceforge.filebot.hash.VerificationUtilities.*;
|
||||||
import static net.sourceforge.tuned.FileUtilities.*;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
@ -48,8 +47,7 @@ public class EpisodeBindingBean {
|
|||||||
|
|
||||||
@Define("n")
|
@Define("n")
|
||||||
public String getSeriesName() {
|
public String getSeriesName() {
|
||||||
// clean up series name just in case there are any path separators like / or \
|
return episode.getSeriesName();
|
||||||
return removePathSeparators(episode.getSeriesName());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -67,8 +65,7 @@ public class EpisodeBindingBean {
|
|||||||
|
|
||||||
@Define("t")
|
@Define("t")
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
// clean up episode title just in case there are any path separators like / or \
|
return episode.getTitle();
|
||||||
return removePathSeparators(episode.getTitle());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,11 +2,15 @@
|
|||||||
package net.sourceforge.filebot.ui.panel.rename;
|
package net.sourceforge.filebot.ui.panel.rename;
|
||||||
|
|
||||||
|
|
||||||
|
import static net.sourceforge.tuned.FileUtilities.*;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
|
import javax.script.Bindings;
|
||||||
import javax.script.ScriptException;
|
import javax.script.ScriptException;
|
||||||
|
|
||||||
import net.sourceforge.filebot.format.EpisodeBindingBean;
|
import net.sourceforge.filebot.format.EpisodeBindingBean;
|
||||||
|
import net.sourceforge.filebot.format.ExpressionBindings;
|
||||||
import net.sourceforge.filebot.format.ExpressionFormat;
|
import net.sourceforge.filebot.format.ExpressionFormat;
|
||||||
import net.sourceforge.filebot.similarity.Match;
|
import net.sourceforge.filebot.similarity.Match;
|
||||||
import net.sourceforge.filebot.web.Episode;
|
import net.sourceforge.filebot.web.Episode;
|
||||||
@ -48,9 +52,30 @@ class EpisodeExpressionFormatter implements MatchFormatter {
|
|||||||
|
|
||||||
// lazy initialize script engine
|
// lazy initialize script engine
|
||||||
if (format == null) {
|
if (format == null) {
|
||||||
format = new ExpressionFormat(expression);
|
format = new ExpressionFormat(expression) {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Bindings getBindings(Object value) {
|
||||||
|
return new ExpressionBindings(value) {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object get(Object key) {
|
||||||
|
Object value = super.get(key);
|
||||||
|
|
||||||
|
// if the binding value is a String, remove illegal characters
|
||||||
|
if (value instanceof CharSequence) {
|
||||||
|
return removePathSeparators(value.toString()).trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
// if the binding value is an Object, just leave it
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// evaluate the expression using the given bindings
|
||||||
String result = format.format(new EpisodeBindingBean(episode, mediaFile)).trim();
|
String result = format.format(new EpisodeBindingBean(episode, mediaFile)).trim();
|
||||||
|
|
||||||
// if result is empty, check for script exceptions
|
// if result is empty, check for script exceptions
|
||||||
|
Loading…
Reference in New Issue
Block a user