1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-11-16 06:15:02 -05:00

* added format binding for file extension

This commit is contained in:
Reinhard Pointner 2009-04-07 18:33:05 +00:00
parent 2793e1d454
commit 2a3f3c7ae8
3 changed files with 15 additions and 1 deletions

View File

@ -35,7 +35,7 @@ class AssociativeScriptObject implements Scriptable {
protected String definingKey(String s) { protected String definingKey(String s) {
// letters and digits are defining, everything else will be ignored // letters and digits are defining, everything else will be ignored
return s.replaceAll("[^\\p{Alnum}]", "").toLowerCase(); return s.replaceAll("\\p{Punct}", "").toLowerCase();
} }

View File

@ -17,6 +17,7 @@ import net.sourceforge.filebot.FileBotUtilities;
import net.sourceforge.filebot.mediainfo.MediaInfo; import net.sourceforge.filebot.mediainfo.MediaInfo;
import net.sourceforge.filebot.mediainfo.MediaInfo.StreamKind; import net.sourceforge.filebot.mediainfo.MediaInfo.StreamKind;
import net.sourceforge.filebot.web.Episode; import net.sourceforge.filebot.web.Episode;
import net.sourceforge.tuned.FileUtilities;
public class EpisodeFormatBindingBean { public class EpisodeFormatBindingBean {
@ -121,6 +122,16 @@ public class EpisodeFormatBindingBean {
} }
@Define("ext")
public String getExtension() {
if (mediaFile != null) {
return FileUtilities.getExtension(mediaFile);
}
return null;
}
@Define("general") @Define("general")
public Object getGeneralMediaInfo() { public Object getGeneralMediaInfo() {
return new AssociativeScriptObject(getMediaInfo().snapshot(StreamKind.General, 0)); return new AssociativeScriptObject(getMediaInfo().snapshot(StreamKind.General, 0));

View File

@ -29,6 +29,9 @@ public final class FileUtilities {
public static String getExtension(File file) { public static String getExtension(File file) {
if (file.isDirectory())
return null;
return getExtension(file.getName()); return getExtension(file.getName());
} }