* support raw multi-part archives (as far passing it through to 7z anyway, native lib my not work though)

This commit is contained in:
Reinhard Pointner 2013-03-09 14:12:13 +00:00
parent ffae3be997
commit 6451c5f478
3 changed files with 10 additions and 8 deletions

View File

@ -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());

View File

@ -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;

View File

@ -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