* allow dropping in files by dropping in a text files containing paths
This commit is contained in:
parent
4deb39c84d
commit
332e4d1f93
|
@ -92,4 +92,5 @@ public class MediaTypes {
|
||||||
public static final ExtensionFileFilter VIDEO_FILES = getDefaultFilter("video");
|
public static final ExtensionFileFilter VIDEO_FILES = getDefaultFilter("video");
|
||||||
public static final ExtensionFileFilter SUBTITLE_FILES = getDefaultFilter("subtitle");
|
public static final ExtensionFileFilter SUBTITLE_FILES = getDefaultFilter("subtitle");
|
||||||
public static final ExtensionFileFilter NFO_FILES = getDefaultFilter("application/nfo");
|
public static final ExtensionFileFilter NFO_FILES = getDefaultFilter("application/nfo");
|
||||||
|
public static final ExtensionFileFilter LIST_FILES = getDefaultFilter("application/list");
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,13 +3,18 @@ package net.sourceforge.filebot.ui.rename;
|
||||||
|
|
||||||
|
|
||||||
import static java.util.Arrays.*;
|
import static java.util.Arrays.*;
|
||||||
|
import static net.sourceforge.filebot.MediaTypes.*;
|
||||||
import static net.sourceforge.filebot.ui.transfer.FileTransferable.*;
|
import static net.sourceforge.filebot.ui.transfer.FileTransferable.*;
|
||||||
|
import static net.sourceforge.tuned.FileUtilities.*;
|
||||||
|
|
||||||
import java.awt.datatransfer.Transferable;
|
import java.awt.datatransfer.Transferable;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Scanner;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import net.sourceforge.filebot.media.MediaDetection;
|
import net.sourceforge.filebot.media.MediaDetection;
|
||||||
import net.sourceforge.filebot.ui.transfer.FileTransferablePolicy;
|
import net.sourceforge.filebot.ui.transfer.FileTransferablePolicy;
|
||||||
|
@ -67,7 +72,24 @@ class FilesListTransferablePolicy extends FileTransferablePolicy {
|
||||||
if (f.isHidden())
|
if (f.isHidden())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!recursive || f.isFile() || MediaDetection.isDiskFolder(f)) {
|
if (recursive && LIST_FILES.accept(f)) {
|
||||||
|
// don't use new Scanner(File) because of BUG 6368019 (http://bugs.sun.com/view_bug.do?bug_id=6368019)
|
||||||
|
try {
|
||||||
|
Scanner scanner = new Scanner(createTextReader(f));
|
||||||
|
while (scanner.hasNextLine()) {
|
||||||
|
String line = scanner.nextLine().trim();
|
||||||
|
if (line.length() > 0) {
|
||||||
|
File path = new File(line);
|
||||||
|
if (path.isAbsolute() && path.exists()) {
|
||||||
|
queue.add(0, path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
scanner.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
Logger.getLogger(FilesListTransferablePolicy.class.getName()).log(Level.WARNING, e.getMessage());
|
||||||
|
}
|
||||||
|
} else if (!recursive || f.isFile() || MediaDetection.isDiskFolder(f)) {
|
||||||
entries.add(f);
|
entries.add(f);
|
||||||
} else {
|
} else {
|
||||||
queue.addAll(0, asList(f.listFiles()));
|
queue.addAll(0, asList(f.listFiles()));
|
||||||
|
|
Loading…
Reference in New Issue