mirror of
https://github.com/mitb-archive/filebot
synced 2024-08-13 17:03:45 -04:00
* improved movie detection (e.g. take folder name better into account)
This commit is contained in:
parent
7d1fa79855
commit
5e359d0b11
@ -57,7 +57,6 @@ import net.sourceforge.filebot.format.MediaBindingBean;
|
||||
import net.sourceforge.filebot.hash.HashType;
|
||||
import net.sourceforge.filebot.hash.VerificationFileReader;
|
||||
import net.sourceforge.filebot.hash.VerificationFileWriter;
|
||||
import net.sourceforge.filebot.media.MediaDetection;
|
||||
import net.sourceforge.filebot.similarity.EpisodeMatcher;
|
||||
import net.sourceforge.filebot.similarity.Match;
|
||||
import net.sourceforge.filebot.similarity.NameSimilarityMetric;
|
||||
@ -585,10 +584,12 @@ public class CmdlineOperations implements CmdlineInterface {
|
||||
List<File> mediaFiles = filter(files, VIDEO_FILES, SUBTITLE_FILES);
|
||||
querySet.addAll(detectSeriesNames(mediaFiles, language.toLocale()));
|
||||
|
||||
for (File file : mediaFiles) {
|
||||
Collection<Movie> results = MediaDetection.detectMovie(file, null, null, language.toLocale(), strict);
|
||||
for (Movie movie : results) {
|
||||
querySet.add(movie.getName());
|
||||
// auto-detect movie names
|
||||
for (File f : files) {
|
||||
if (!isEpisode(f.getName(), false)) {
|
||||
for (Movie movie : detectMovie(f, null, null, language.toLocale(), strict)) {
|
||||
querySet.add(movie.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@ -608,13 +609,13 @@ public class CmdlineOperations implements CmdlineInterface {
|
||||
}
|
||||
|
||||
try {
|
||||
CLILogger.fine(format("Searching for %s at [%s]", querySet.toString(), service.getName()));
|
||||
CLILogger.fine(format("Searching for %s at [%s]", querySet, service.getName()));
|
||||
Map<File, SubtitleDescriptor> subtitles = lookupSubtitleByFileName(service, querySet, language, remainingVideos, strict);
|
||||
Map<File, File> downloads = downloadSubtitleBatch(service.getName(), subtitles, outputFormat, outputEncoding);
|
||||
remainingVideos.removeAll(downloads.keySet());
|
||||
subtitleFiles.addAll(downloads.values());
|
||||
} catch (Exception e) {
|
||||
CLILogger.warning(format("Search for [%s] failed: %s", querySet, e.getMessage()));
|
||||
CLILogger.warning(format("Search for %s failed: %s", querySet, e.getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -172,6 +172,10 @@ def isEpisode(path, strict = true) {
|
||||
return MediaDetection.isEpisode(input, strict)
|
||||
}
|
||||
|
||||
def guessMovieFolder(path) {
|
||||
return MediaDetection.guessMovieFolder(path as File)
|
||||
}
|
||||
|
||||
def parseEpisodeNumber(path, strict = true) {
|
||||
def input = path instanceof File ? path.name : path.toString()
|
||||
def sxe = MediaDetection.parseEpisodeNumber(input, strict)
|
||||
|
@ -41,6 +41,7 @@ def groups = input.groupBy{ f ->
|
||||
// DECIDE EPISODE VS MOVIE (IF NOT CLEAR)
|
||||
if (tvs && mov) {
|
||||
def norm = { s -> s.lower().space(' ') }
|
||||
def dn = norm(f.dir.name)
|
||||
def fn = norm(f.nameWithoutExtension)
|
||||
def sn = norm(tvs)
|
||||
def mn = norm(mov.name)
|
||||
@ -49,7 +50,7 @@ def groups = input.groupBy{ f ->
|
||||
if (parseEpisodeNumber(fn, true) || parseDate(fn) || (fn =~ sn && parseEpisodeNumber(fn.after(sn), false)) || fn.after(sn) =~ / - .+/ || f.dir.listFiles{ it.isVideo() && norm(it.name) =~ sn && it.name =~ /\b\d{1,3}\b/}.size() >= 10) {
|
||||
println "Exclude Movie: $mov"
|
||||
mov = null
|
||||
} else if ((detectMovie(f, true) && fn =~ /(19|20)\d{2}/) || (fn =~ mn && !(fn.after(mn) =~ /\b\d{1,3}\b/))) {
|
||||
} else if ((detectMovie(f, true) && [dn, fn].find{ it =~ /(19|20)\d{2}/ }) || [dn, fn].find{ it =~ mn && !(it.after(mn) =~ /\b\d{1,3}\b/) }) {
|
||||
println "Exclude Series: $tvs"
|
||||
tvs = null
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user