* support -DthreadPool=n to override background matcher thread pool size (default is number of cores)
This commit is contained in:
parent
32e40255c8
commit
5145d906dd
|
@ -44,6 +44,20 @@ public final class Settings {
|
|||
}
|
||||
|
||||
|
||||
public static boolean isUnixFS() {
|
||||
return Boolean.parseBoolean(System.getProperty("unixfs"));
|
||||
}
|
||||
|
||||
|
||||
public static int getPreferredThreadPoolSize() {
|
||||
try {
|
||||
return Integer.parseInt(System.getProperty("threadPool"));
|
||||
} catch (Exception e) {
|
||||
return Runtime.getRuntime().availableProcessors();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static String getApplicationDeployment() {
|
||||
String deployment = System.getProperty("application.deployment");
|
||||
if (deployment != null)
|
||||
|
|
|
@ -6,6 +6,7 @@ import static java.lang.String.*;
|
|||
import static java.util.Arrays.*;
|
||||
import static java.util.Collections.*;
|
||||
import static net.sourceforge.filebot.MediaTypes.*;
|
||||
import static net.sourceforge.filebot.Settings.*;
|
||||
import static net.sourceforge.filebot.WebServices.*;
|
||||
import static net.sourceforge.filebot.cli.CLILogging.*;
|
||||
import static net.sourceforge.filebot.hash.VerificationUtilities.*;
|
||||
|
@ -209,7 +210,7 @@ public class CmdlineOperations implements CmdlineInterface {
|
|||
String newName = (format != null) ? format.format(new MediaBindingBean(episode, file)) : validateFileName(EpisodeFormat.SeasonEpisode.format(episode));
|
||||
File newFile = new File(outputDir, newName + "." + getExtension(file));
|
||||
|
||||
if (isInvalidFilePath(newFile) && !Boolean.parseBoolean(System.getProperty("unixfs"))) {
|
||||
if (isInvalidFilePath(newFile) && !isUnixFS()) {
|
||||
CLILogger.config("Stripping invalid characters from new path: " + newName);
|
||||
newFile = validateFilePath(newFile);
|
||||
}
|
||||
|
@ -444,7 +445,7 @@ public class CmdlineOperations implements CmdlineInterface {
|
|||
String newName = (format != null) ? format.format(new MediaBindingBean(movie, file)) : validateFileName(MovieFormat.NameYear.format(movie));
|
||||
File newFile = new File(outputDir, newName + "." + getExtension(file));
|
||||
|
||||
if (isInvalidFilePath(newFile) && !Boolean.parseBoolean(System.getProperty("unixfs"))) {
|
||||
if (isInvalidFilePath(newFile) && !isUnixFS()) {
|
||||
CLILogger.config("Stripping invalid characters from new path: " + newName);
|
||||
newFile = validateFilePath(newFile);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ package net.sourceforge.filebot.ui.rename;
|
|||
|
||||
import static java.util.Collections.*;
|
||||
import static net.sourceforge.filebot.MediaTypes.*;
|
||||
import static net.sourceforge.filebot.Settings.*;
|
||||
import static net.sourceforge.filebot.media.MediaDetection.*;
|
||||
import static net.sourceforge.filebot.similarity.Normalization.*;
|
||||
import static net.sourceforge.tuned.FileUtilities.*;
|
||||
|
@ -212,7 +213,7 @@ class EpisodeListMatcher implements AutoCompleteMatcher {
|
|||
}
|
||||
|
||||
// match folder per folder in parallel
|
||||
ExecutorService executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
|
||||
ExecutorService executor = Executors.newFixedThreadPool(getPreferredThreadPoolSize());
|
||||
|
||||
try {
|
||||
// merge all episodes
|
||||
|
|
|
@ -3,6 +3,7 @@ package net.sourceforge.filebot.ui.rename;
|
|||
|
||||
|
||||
import static net.sourceforge.filebot.MediaTypes.*;
|
||||
import static net.sourceforge.filebot.Settings.*;
|
||||
import static net.sourceforge.filebot.media.MediaDetection.*;
|
||||
import static net.sourceforge.filebot.similarity.Normalization.*;
|
||||
import static net.sourceforge.tuned.FileUtilities.*;
|
||||
|
@ -158,7 +159,7 @@ class MovieHashMatcher implements AutoCompleteMatcher {
|
|||
// map movies to (possibly multiple) files (in natural order)
|
||||
Map<Movie, SortedSet<File>> filesByMovie = new HashMap<Movie, SortedSet<File>>();
|
||||
|
||||
ExecutorService executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
|
||||
ExecutorService executor = Executors.newFixedThreadPool(getPreferredThreadPoolSize());
|
||||
try {
|
||||
for (Future<Entry<File, Movie>> it : executor.invokeAll(grabMovieJobs)) {
|
||||
// check if we managed to lookup the movie descriptor
|
||||
|
|
|
@ -3,6 +3,7 @@ package net.sourceforge.filebot.ui.rename;
|
|||
|
||||
|
||||
import static java.util.Collections.*;
|
||||
import static net.sourceforge.filebot.Settings.*;
|
||||
import static net.sourceforge.tuned.FileUtilities.*;
|
||||
import static net.sourceforge.tuned.ui.TunedUtilities.*;
|
||||
|
||||
|
@ -161,7 +162,7 @@ class ValidateDialog extends JDialog {
|
|||
|
||||
for (int i = 0; i < source.size(); i++) {
|
||||
// invalid file names are also invalid file paths
|
||||
if (isInvalidFilePath(source.get(i)) && !Boolean.parseBoolean(System.getProperty("unixfs"))) {
|
||||
if (isInvalidFilePath(source.get(i)) && !isUnixFS()) {
|
||||
invalidFilePaths.addIndex(i);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue