* xattr 1st class by default if possible

This commit is contained in:
Reinhard Pointner 2014-03-06 14:28:46 +00:00
parent 74341bd123
commit bff47228c0
2 changed files with 17 additions and 3 deletions

View File

@ -237,8 +237,22 @@ def detectSeriesName(files, boolean useSeriesIndex = true, boolean useAnimeIndex
}
def detectMovie(File file, strict = true, queryLookupService = TheMovieDB, hashLookupService = OpenSubtitles, locale = Locale.ENGLISH) {
def movies = MediaDetection.matchMovieName(file.listPath(4, true).findResults{ it.name ?: null }, true, 0) ?: MediaDetection.detectMovie(file, hashLookupService, queryLookupService, locale, strict)
return movies == null || movies.isEmpty() ? null : movies.toList()[0]
// 1. xattr
def m = tryQuietly{ file.metadata.object as Movie }
if (m != null)
return m
// 2. perfect filename match
m = MediaDetection.matchMovieName(file.listPath(4, true).findResults{ it.name ?: null }, true, 0)
if (m != null && m.size() > 0)
return m[0]
// 3. run full-fledged movie detection
m = MediaDetection.detectMovie(file, hashLookupService, queryLookupService, locale, strict)
if (m != null && m.size() > 0)
return m[0]
return null
}
def matchMovie(String filename, strict = true, maxStartIndex = 0) {

View File

@ -521,7 +521,7 @@ public class MediaDetection {
return seriesList;
}
public static Collection<Movie> detectMovie(File movieFile, MovieIdentificationService hashLookupService, MovieIdentificationService queryLookupService, Locale locale, boolean strict) throws Exception {
public static List<Movie> detectMovie(File movieFile, MovieIdentificationService hashLookupService, MovieIdentificationService queryLookupService, Locale locale, boolean strict) throws Exception {
Set<Movie> options = new LinkedHashSet<Movie>();
// try xattr metadata if enabled