mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-24 16:58:51 -05:00
* added special handling for disk folders
This commit is contained in:
parent
4063f57e54
commit
0840791140
@ -194,8 +194,8 @@ def isEpisode(path, strict = true) {
|
|||||||
return MediaDetection.isEpisode(input, strict)
|
return MediaDetection.isEpisode(input, strict)
|
||||||
}
|
}
|
||||||
|
|
||||||
def guessMovieFolder(path) {
|
def guessMovieFolder(File path) {
|
||||||
return MediaDetection.guessMovieFolder(path as File)
|
return MediaDetection.guessMovieFolder(path)
|
||||||
}
|
}
|
||||||
|
|
||||||
def parseEpisodeNumber(path, strict = true) {
|
def parseEpisodeNumber(path, strict = true) {
|
||||||
@ -214,7 +214,7 @@ def detectSeriesName(files, locale = Locale.ENGLISH) {
|
|||||||
return names == null || names.isEmpty() ? null : names.toList()[0]
|
return names == null || names.isEmpty() ? null : names.toList()[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
def detectMovie(movieFile, strict = true, queryLookupService = TheMovieDB, hashLookupService = OpenSubtitles, locale = Locale.ENGLISH) {
|
def detectMovie(File movieFile, strict = true, queryLookupService = TheMovieDB, hashLookupService = OpenSubtitles, locale = Locale.ENGLISH) {
|
||||||
def movies = MediaDetection.detectMovie(movieFile, hashLookupService, queryLookupService, locale, strict)
|
def movies = MediaDetection.detectMovie(movieFile, hashLookupService, queryLookupService, locale, strict)
|
||||||
return movies == null || movies.isEmpty() ? null : movies.toList()[0]
|
return movies == null || movies.isEmpty() ? null : movies.toList()[0]
|
||||||
}
|
}
|
||||||
|
@ -44,20 +44,31 @@ def forceIgnore(f) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// specify how to resolve input folders, e.g. grab files from all folders except disk folders
|
||||||
|
def resolveInput(f) {
|
||||||
|
if (f.isDirectory() && !f.isDisk())
|
||||||
|
return f.listFiles().toList().findResults{ resolveInput(it) }
|
||||||
|
else
|
||||||
|
return f
|
||||||
|
}
|
||||||
|
|
||||||
// collect input fileset as specified by the given --def parameters
|
// collect input fileset as specified by the given --def parameters
|
||||||
if (args.empty) {
|
if (args.empty) {
|
||||||
// assume we're called with utorrent parameters
|
// assume we're called with utorrent parameters
|
||||||
if (ut_kind == 'single') {
|
if (ut_kind == 'single') {
|
||||||
input += new File(ut_dir, ut_file) // single-file torrent
|
input += new File(ut_dir, ut_file) // single-file torrent
|
||||||
} else {
|
} else {
|
||||||
input += new File(ut_dir).getFiles() // multi-file torrent
|
input += resolveInput(ut_dir as File) // multi-file torrent
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// assume we're called normally with arguments
|
// assume we're called normally with arguments
|
||||||
input += args.getFiles()
|
input += args.findResults{ resolveInput(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// flatten nested file structure
|
||||||
|
input = input.flatten()
|
||||||
|
|
||||||
// extract archives (zip, rar, etc) that contain at least one video file
|
// extract archives (zip, rar, etc) that contain at least one video file
|
||||||
input += extract(file: input.findAll{ it.isArchive() }, output: null, conflict: 'override', filter: { it.isVideo() }, forceExtractAll: true)
|
input += extract(file: input.findAll{ it.isArchive() }, output: null, conflict: 'override', filter: { it.isVideo() }, forceExtractAll: true)
|
||||||
|
|
||||||
@ -65,7 +76,7 @@ input += extract(file: input.findAll{ it.isArchive() }, output: null, conflict:
|
|||||||
input = input.findAll{ it?.exists() }.collect{ it.canonicalFile }.unique()
|
input = input.findAll{ it?.exists() }.collect{ it.canonicalFile }.unique()
|
||||||
|
|
||||||
// process only media files
|
// process only media files
|
||||||
input = input.findAll{ it.isVideo() || it.isSubtitle() }
|
input = input.findAll{ it.isVideo() || it.isSubtitle() || it.isDisk() }
|
||||||
|
|
||||||
// ignore clutter files
|
// ignore clutter files
|
||||||
input = input.findAll{ !(it.path =~ /\b(?i:sample|trailer|extras|deleted.scenes|music.video|scrapbook)\b/) }
|
input = input.findAll{ !(it.path =~ /\b(?i:sample|trailer|extras|deleted.scenes|music.video|scrapbook)\b/) }
|
||||||
|
Loading…
Reference in New Issue
Block a user