From 6451c5f478939aa6ea06e9e712475b9f8450e0f0 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Sat, 9 Mar 2013 14:12:13 +0000 Subject: [PATCH] * support raw multi-part archives (as far passing it through to 7z anyway, native lib my not work though) --- source/net/sourceforge/filebot/archive/Archive.java | 4 ++-- source/net/sourceforge/tuned/FileUtilities.java | 12 +++++++----- website/scripts/amc.groovy | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/source/net/sourceforge/filebot/archive/Archive.java b/source/net/sourceforge/filebot/archive/Archive.java index b8f4f97a..61c7fe7b 100644 --- a/source/net/sourceforge/filebot/archive/Archive.java +++ b/source/net/sourceforge/filebot/archive/Archive.java @@ -144,13 +144,13 @@ public class Archive implements Closeable { public static final FileFilter VOLUME_ONE_FILTER = new FileFilter() { - private Pattern volume = Pattern.compile("[.]r[0-9]+$|[.]part[0-9]+|[.][0-9]+$", Pattern.CASE_INSENSITIVE); + private Pattern volume = Pattern.compile("[.]r[0-9]+$|[.]part[0-9]+[.][0-9a-z]+$|[.][0-9]+$", Pattern.CASE_INSENSITIVE); private FileFilter archives = new ExtensionFileFilter(getArchiveTypes()); @Override public boolean accept(File path) { - if (!archives.accept(path)) + if (!archives.accept(path) && !volume.matcher(path.getName()).find()) return false; Matcher matcher = volume.matcher(path.getName()); diff --git a/source/net/sourceforge/tuned/FileUtilities.java b/source/net/sourceforge/tuned/FileUtilities.java index b9d3362b..1f0f4e0a 100644 --- a/source/net/sourceforge/tuned/FileUtilities.java +++ b/source/net/sourceforge/tuned/FileUtilities.java @@ -226,11 +226,13 @@ public final class FileUtilities { public static boolean hasExtension(String filename, String... extensions) { - String extension = getExtension(filename); - - for (String value : extensions) { - if ((extension == null && value == null) || (extension != null && extension.equalsIgnoreCase(value))) - return true; + for (String it : extensions) { + if (filename.length() - it.length() >= 2 && filename.charAt(filename.length() - it.length() - 1) == '.') { + String tail = filename.substring(filename.length() - it.length(), filename.length()); + if (tail.equalsIgnoreCase(it)) { + return true; + } + } } return false; diff --git a/website/scripts/amc.groovy b/website/scripts/amc.groovy index 9e479226..aa13d628 100644 --- a/website/scripts/amc.groovy +++ b/website/scripts/amc.groovy @@ -83,7 +83,7 @@ if (args.empty) { input = input.flatten() // extract archives (zip, rar, etc) that contain at least one video file -def tempFiles = extract(file: input.findAll{ it.isArchive() }, output: null, conflict: 'override', filter: { it.isVideo() || (music && it.isAudio()) }, forceExtractAll: true) ?: [] +def tempFiles = extract(file: input.findAll{ it.isArchive() || it.extension == '001' }, output: null, conflict: 'override', filter: { it.isVideo() || (music && it.isAudio()) }, forceExtractAll: true) ?: [] input += tempFiles // sanitize input