* fix tvdb season artwork logic

This commit is contained in:
Reinhard Pointner 2012-07-27 06:29:28 +00:00
parent bfb375228c
commit 4e610cfbcf
1 changed files with 5 additions and 7 deletions

View File

@ -66,8 +66,7 @@ def groups = input.groupBy{ f ->
groups.each{ group, files -> groups.each{ group, files ->
// fetch subtitles // fetch subtitles
def subs = getMissingSubtitles(file:files, output:"srt", encoding:"utf-8") files += getMissingSubtitles(file:files, output:"srt", encoding:"utf-8")
if (subs) files += subs
// EPISODE MODE // EPISODE MODE
if (group.tvs && !group.mov) { if (group.tvs && !group.mov) {
@ -75,14 +74,13 @@ groups.each{ group, files ->
if (dest || failOnError) { if (dest || failOnError) {
dest.mapByFolder().each{ dir, fs -> dest.mapByFolder().each{ dir, fs ->
println "Fetching artwork for $dir from TheTVDB" println "Fetching artwork for $dir from TheTVDB"
def query = group.tvs def sxe = fs.findResult{ eps -> parseEpisodeNumber(eps) }
def sxe = dest.findResult{ parseEpisodeNumber(it) } def options = TheTVDB.search(group.tvs)
def options = TheTVDB.search(query)
if (options.isEmpty()) { if (options.isEmpty()) {
println "TV Series not found: $query" println "TV Series not found: $group.tvs"
return return
} }
options = options.sortBySimilarity(query, { it.name }) options = options.sortBySimilarity(group.tvs, { opt -> opt.name })
fetchSeriesArtworkAndNfo(dir.dir, dir, options[0], sxe && sxe.season > 0 ? sxe.season : 1) fetchSeriesArtworkAndNfo(dir.dir, dir, options[0], sxe && sxe.season > 0 ? sxe.season : 1)
} }
} }