From d3f3d9054dc6b19cd76d97023e1c5e84f29472f3 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Tue, 7 Jan 2014 13:19:56 +0000 Subject: [PATCH] * defensive programming --- source/net/sourceforge/filebot/cli/ScriptShell.lib.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/net/sourceforge/filebot/cli/ScriptShell.lib.groovy b/source/net/sourceforge/filebot/cli/ScriptShell.lib.groovy index b04d8a93..c34cdc0d 100644 --- a/source/net/sourceforge/filebot/cli/ScriptShell.lib.groovy +++ b/source/net/sourceforge/filebot/cli/ScriptShell.lib.groovy @@ -235,7 +235,7 @@ def detectSeriesName(files, locale = Locale.ENGLISH) { } def detectMovie(File file, strict = true, queryLookupService = TheMovieDB, hashLookupService = OpenSubtitles, locale = Locale.ENGLISH) { - def movies = MediaDetection.matchMovieName(file.listPath(3, true)*.name, true, 0) ?: MediaDetection.detectMovie(file, hashLookupService, queryLookupService, locale, strict) + 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] }