1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-11-16 06:15:02 -05:00

* ignore sample files

* if rename() fails just keep on going
This commit is contained in:
Reinhard Pointner 2012-05-31 12:10:50 +00:00
parent 19b6dd47d2
commit c40c53c53c

View File

@ -16,6 +16,9 @@ input += extract(file:input, output:".", conflict:"override")
// process only media files // process only media files
input = input.findAll{ it.isVideo() || it.isSubtitle() } input = input.findAll{ it.isVideo() || it.isSubtitle() }
// ignore clutter files
input = input.findAll{ !(it.name =~ /(?i:sample)/) }
// print input fileset // print input fileset
input.each{ println "Input: $it" } input.each{ println "Input: $it" }
@ -49,28 +52,30 @@ groups.each{ group, files ->
// EPISODE MODE // EPISODE MODE
if (group.tvs && !group.mov) { if (group.tvs && !group.mov) {
def dest = rename(file:files, format:'TV Shows/{n}/{episode.special ? "Special" : "Season "+s}/{n} - {episode.special ? "S00E"+special.pad(2) : s00e00} - {t}', db:'TheTVDB') def dest = rename(file:files, format:'TV Shows/{n}/{episode.special ? "Special" : "Season "+s}/{n} - {episode.special ? "S00E"+special.pad(2) : s00e00} - {t}', db:'TheTVDB')
if (dest) {
dest.mapByFolder().keySet().each{ dir -> dest.mapByFolder().keySet().each{ dir ->
println "Fetching artwork for $dir from TheTVDB" println "Fetching artwork for $dir from TheTVDB"
def query = group.tvs def query = group.tvs
def sxe = dest.findResult{ parseEpisodeNumber(it) } def sxe = dest.findResult{ parseEpisodeNumber(it) }
def options = TheTVDB.search(query) def options = TheTVDB.search(query)
if (options.isEmpty()) { if (options.isEmpty()) {
println "TV Series not found: $query" println "TV Series not found: $query"
return return
}
options = options.sortBySimilarity(query, { it.name })
fetchSeriesArtworkAndNfo(dir.dir, dir, options[0], sxe && sxe.season > 0 ? sxe.season : 1)
} }
options = options.sortBySimilarity(query, { it.name })
fetchSeriesArtworkAndNfo(dir.dir, dir, options[0], sxe && sxe.season > 0 ? sxe.season : 1)
} }
} }
// MOVIE MODE // MOVIE MODE
if (group.mov && !group.tvs) { if (group.mov && !group.tvs) {
def dest = rename(file:files, format:'Movies/{n} ({y})/{n} ({y}){" CD$pi"}', db:'TheMovieDB') def dest = rename(file:files, format:'Movies/{n} ({y})/{n} ({y}){" CD$pi"}', db:'TheMovieDB')
if (dest) {
dest.mapByFolder().keySet().each{ dir -> dest.mapByFolder().keySet().each{ dir ->
println "Fetching artwork for $dir from TheMovieDB" println "Fetching artwork for $dir from TheMovieDB"
fetchMovieArtworkAndNfo(dir, group.mov) fetchMovieArtworkAndNfo(dir, group.mov)
}
} }
} }
} }