mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-24 16:58:51 -05:00
* use String.join()
This commit is contained in:
parent
d8d7b80474
commit
8a885ff1fe
@ -1,7 +1,6 @@
|
|||||||
package net.filebot;
|
package net.filebot;
|
||||||
|
|
||||||
import static net.filebot.util.FileUtilities.*;
|
import static net.filebot.util.FileUtilities.*;
|
||||||
import static net.filebot.util.StringUtilities.*;
|
|
||||||
|
|
||||||
import java.awt.GraphicsEnvironment;
|
import java.awt.GraphicsEnvironment;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -286,14 +285,14 @@ public final class Settings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String getApplicationIdentifier() {
|
public static String getApplicationIdentifier() {
|
||||||
return joinBy(" ", getApplicationName(), getApplicationVersion(), String.format("(r%s)", getApplicationRevisionNumber()));
|
return String.join(" ", getApplicationName(), getApplicationVersion(), String.format("(r%s)", getApplicationRevisionNumber()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getJavaRuntimeIdentifier() {
|
public static String getJavaRuntimeIdentifier() {
|
||||||
String name = System.getProperty("java.runtime.name");
|
String name = System.getProperty("java.runtime.name");
|
||||||
String version = System.getProperty("java.version");
|
String version = System.getProperty("java.version");
|
||||||
String headless = GraphicsEnvironment.isHeadless() ? "(headless)" : null;
|
String headless = GraphicsEnvironment.isHeadless() ? "(headless)" : null;
|
||||||
return joinBy(" ", name, version, headless);
|
return String.join(" ", name, version, headless);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String[] applicationArgumentArray;
|
private static String[] applicationArgumentArray;
|
||||||
|
@ -157,7 +157,7 @@ public class MediaBindingBean {
|
|||||||
for (Episode it : getEpisodes()) {
|
for (Episode it : getEpisodes()) {
|
||||||
title.add(removeTrailingBrackets(it.getTitle()));
|
title.add(removeTrailingBrackets(it.getTitle()));
|
||||||
}
|
}
|
||||||
return truncateText(join(title, " & "), limit);
|
return truncateText(String.join(" & ", title), limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Define("d")
|
@Define("d")
|
||||||
@ -353,7 +353,7 @@ public class MediaBindingBean {
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
// e.g. 1280x720
|
// e.g. 1280x720
|
||||||
return join(dim, "x");
|
return String.join("x", dim.get(0).toString(), dim.get(1).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Define("ws")
|
@Define("ws")
|
||||||
|
@ -59,7 +59,6 @@ import net.filebot.similarity.SeriesNameMatcher;
|
|||||||
import net.filebot.similarity.SimilarityComparator;
|
import net.filebot.similarity.SimilarityComparator;
|
||||||
import net.filebot.similarity.SimilarityMetric;
|
import net.filebot.similarity.SimilarityMetric;
|
||||||
import net.filebot.similarity.StringEqualsMetric;
|
import net.filebot.similarity.StringEqualsMetric;
|
||||||
import net.filebot.util.StringUtilities;
|
|
||||||
import net.filebot.vfs.FileInfo;
|
import net.filebot.vfs.FileInfo;
|
||||||
import net.filebot.web.Episode;
|
import net.filebot.web.Episode;
|
||||||
import net.filebot.web.Movie;
|
import net.filebot.web.Movie;
|
||||||
@ -948,7 +947,7 @@ public class MediaDetection {
|
|||||||
querySet = getUniqueQuerySet(stripBlacklistedTerms(querySet));
|
querySet = getUniqueQuerySet(stripBlacklistedTerms(querySet));
|
||||||
|
|
||||||
// DEBUG
|
// DEBUG
|
||||||
// System.out.format("Query %s: %s%n", queryLookupService.getName(), querySet);
|
System.out.format("Query %s: %s%n", queryLookupService.getName(), querySet);
|
||||||
|
|
||||||
final Map<Movie, Float> probabilityMap = new LinkedHashMap<Movie, Float>();
|
final Map<Movie, Float> probabilityMap = new LinkedHashMap<Movie, Float>();
|
||||||
final SimilarityMetric metric = getMovieMatchMetric();
|
final SimilarityMetric metric = getMovieMatchMetric();
|
||||||
@ -1047,7 +1046,7 @@ public class MediaDetection {
|
|||||||
relativePath.addFirst(it.getName());
|
relativePath.addFirst(it.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
return relativePath.isEmpty() ? null : new File(StringUtilities.join(relativePath, File.separator));
|
return relativePath.isEmpty() ? null : new File(String.join(File.separator, relativePath));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Map<File, List<File>> mapByMediaFolder(Collection<File> files) {
|
public static Map<File, List<File>> mapByMediaFolder(Collection<File> files) {
|
||||||
|
@ -5,7 +5,6 @@ import static java.util.Collections.*;
|
|||||||
import static java.util.regex.Pattern.*;
|
import static java.util.regex.Pattern.*;
|
||||||
import static net.filebot.similarity.Normalization.*;
|
import static net.filebot.similarity.Normalization.*;
|
||||||
import static net.filebot.util.FileUtilities.*;
|
import static net.filebot.util.FileUtilities.*;
|
||||||
import static net.filebot.util.StringUtilities.*;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -431,12 +430,12 @@ public enum EpisodeMetrics implements SimilarityMetric {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// simplify file name if possible and extract numbers
|
// simplify file name if possible and extract numbers
|
||||||
List<Integer> numbers = new ArrayList<Integer>(4);
|
List<String> numbers = new ArrayList<String>(4);
|
||||||
Scanner scanner = new Scanner(normalizeObject(object)).useDelimiter("\\D+");
|
Scanner scanner = new Scanner(normalizeObject(object)).useDelimiter("\\D+");
|
||||||
while (scanner.hasNextInt()) {
|
while (scanner.hasNextInt()) {
|
||||||
numbers.add(scanner.nextInt());
|
numbers.add(String.valueOf(scanner.nextInt()));
|
||||||
}
|
}
|
||||||
return join(numbers, " ");
|
return String.join(" ", numbers);
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@ import static java.util.Collections.*;
|
|||||||
import static java.util.regex.Pattern.*;
|
import static java.util.regex.Pattern.*;
|
||||||
import static net.filebot.similarity.CommonSequenceMatcher.*;
|
import static net.filebot.similarity.CommonSequenceMatcher.*;
|
||||||
import static net.filebot.similarity.Normalization.*;
|
import static net.filebot.similarity.Normalization.*;
|
||||||
import static net.filebot.util.StringUtilities.*;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.text.CollationKey;
|
import java.text.CollationKey;
|
||||||
@ -100,7 +99,7 @@ public class SeriesNameMatcher {
|
|||||||
whitelist.addAll(deepMatchAll(focus, threshold));
|
whitelist.addAll(deepMatchAll(focus, threshold));
|
||||||
|
|
||||||
// 1. use pattern matching
|
// 1. use pattern matching
|
||||||
seriesNames.addAll(flatMatchAll(names, compile(join(whitelist, "|"), CASE_INSENSITIVE | UNICODE_CHARACTER_CLASS), threshold, false));
|
seriesNames.addAll(flatMatchAll(names, compile(String.join("|", whitelist), CASE_INSENSITIVE | UNICODE_CHARACTER_CLASS), threshold, false));
|
||||||
|
|
||||||
// 2. use common word sequences
|
// 2. use common word sequences
|
||||||
seriesNames.addAll(whitelist);
|
seriesNames.addAll(whitelist);
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
|
|
||||||
package net.filebot.subtitle;
|
package net.filebot.subtitle;
|
||||||
|
|
||||||
|
|
||||||
import static net.filebot.util.StringUtilities.*;
|
|
||||||
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -12,13 +8,11 @@ import java.util.Locale;
|
|||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
|
||||||
public class SubRipReader extends SubtitleReader {
|
public class SubRipReader extends SubtitleReader {
|
||||||
|
|
||||||
private final DateFormat timeFormat;
|
private final DateFormat timeFormat;
|
||||||
private final Pattern tag;
|
private final Pattern tag;
|
||||||
|
|
||||||
|
|
||||||
public SubRipReader(Readable source) {
|
public SubRipReader(Readable source) {
|
||||||
super(source);
|
super(source);
|
||||||
|
|
||||||
@ -30,7 +24,6 @@ public class SubRipReader extends SubtitleReader {
|
|||||||
tag = Pattern.compile("</?(b|u|i|font[^<>]*)>", Pattern.CASE_INSENSITIVE);
|
tag = Pattern.compile("</?(b|u|i|font[^<>]*)>", Pattern.CASE_INSENSITIVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected SubtitleElement readNext() throws Exception {
|
protected SubtitleElement readNext() throws Exception {
|
||||||
String number = scanner.nextLine();
|
String number = scanner.nextLine();
|
||||||
@ -55,10 +48,9 @@ public class SubRipReader extends SubtitleReader {
|
|||||||
lines.add(line);
|
lines.add(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new SubtitleElement(t1, t2, resolve(join(lines, "\n")));
|
return new SubtitleElement(t1, t2, resolve(String.join("\n", lines)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected String resolve(String text) {
|
protected String resolve(String text) {
|
||||||
// remove tags
|
// remove tags
|
||||||
return tag.matcher(text).replaceAll("").trim();
|
return tag.matcher(text).replaceAll("").trim();
|
||||||
|
@ -6,7 +6,6 @@ import static net.filebot.Settings.*;
|
|||||||
import static net.filebot.WebServices.*;
|
import static net.filebot.WebServices.*;
|
||||||
import static net.filebot.media.MediaDetection.*;
|
import static net.filebot.media.MediaDetection.*;
|
||||||
import static net.filebot.util.FileUtilities.*;
|
import static net.filebot.util.FileUtilities.*;
|
||||||
import static net.filebot.util.StringUtilities.*;
|
|
||||||
import static net.filebot.util.ui.SwingUI.*;
|
import static net.filebot.util.ui.SwingUI.*;
|
||||||
|
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
@ -286,7 +285,7 @@ class EpisodeListMatcher implements AutoCompleteMatcher {
|
|||||||
if (episodes.isEmpty() && !strict) {
|
if (episodes.isEmpty() && !strict) {
|
||||||
List<String> detectedSeriesNames = detectSeriesNames(files, useSeriesIndex, useAnimeIndex, locale);
|
List<String> detectedSeriesNames = detectSeriesNames(files, useSeriesIndex, useAnimeIndex, locale);
|
||||||
String parentPathHint = normalizePathSeparators(getRelativePathTail(files.get(0).getParentFile(), 2).getPath());
|
String parentPathHint = normalizePathSeparators(getRelativePathTail(files.get(0).getParentFile(), 2).getPath());
|
||||||
String suggestion = detectedSeriesNames.size() > 0 ? join(detectedSeriesNames, "; ") : parentPathHint;
|
String suggestion = detectedSeriesNames.size() > 0 ? String.join("; ", detectedSeriesNames) : parentPathHint;
|
||||||
|
|
||||||
List<String> input;
|
List<String> input;
|
||||||
synchronized (inputMemory) {
|
synchronized (inputMemory) {
|
||||||
|
@ -22,7 +22,6 @@ import java.awt.event.WindowEvent;
|
|||||||
import java.beans.PropertyChangeEvent;
|
import java.beans.PropertyChangeEvent;
|
||||||
import java.beans.PropertyChangeListener;
|
import java.beans.PropertyChangeListener;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.text.Format;
|
import java.text.Format;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
package net.filebot.util;
|
package net.filebot.util;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.io.Reader;
|
||||||
import java.nio.CharBuffer;
|
import java.nio.CharBuffer;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
import com.ibm.icu.text.CharsetDetector;
|
import com.ibm.icu.text.CharsetDetector;
|
||||||
import com.ibm.icu.text.CharsetMatch;
|
|
||||||
|
|
||||||
public class UnicodeReader extends Reader {
|
public class UnicodeReader extends Reader {
|
||||||
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package net.filebot.web;
|
package net.filebot.web;
|
||||||
|
|
||||||
import static net.filebot.util.StringUtilities.*;
|
|
||||||
|
|
||||||
import java.text.FieldPosition;
|
import java.text.FieldPosition;
|
||||||
import java.text.Format;
|
import java.text.Format;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
@ -111,7 +109,7 @@ public class EpisodeFormat extends Format {
|
|||||||
title.add(it.getTitle().replaceAll("[(]([^)]*)[)]$", "").trim());
|
title.add(it.getTitle().replaceAll("[(]([^)]*)[)]$", "").trim());
|
||||||
}
|
}
|
||||||
|
|
||||||
return String.format("%s - %s - %s", join(name, " & "), join(sxe, " & "), join(title, " & "));
|
return String.format("%s - %s - %s", String.join(" & ", name), String.join(" & ", sxe), String.join(" & ", title));
|
||||||
}
|
}
|
||||||
|
|
||||||
public String formatMultiSxE(Iterable<Episode> episodes) {
|
public String formatMultiSxE(Iterable<Episode> episodes) {
|
||||||
|
Loading…
Reference in New Issue
Block a user