* added support for batch downloading all movie backdrops
This commit is contained in:
parent
9944693316
commit
8052c400cd
|
@ -1482,6 +1482,7 @@ UNTOUCHED
|
||||||
UNVEiL
|
UNVEiL
|
||||||
USELESS
|
USELESS
|
||||||
UTOPiA
|
UTOPiA
|
||||||
|
UTW-Mazui
|
||||||
UVall
|
UVall
|
||||||
VaAr3
|
VaAr3
|
||||||
VALiOMEDiA
|
VALiOMEDiA
|
||||||
|
@ -1527,6 +1528,7 @@ WANKAZ
|
||||||
WASABi
|
WASABi
|
||||||
WASTE
|
WASTE
|
||||||
WastedTime
|
WastedTime
|
||||||
|
Wasurenai
|
||||||
WAT
|
WAT
|
||||||
WATBATH
|
WATBATH
|
||||||
WATCHABLE
|
WATCHABLE
|
||||||
|
|
|
@ -38,7 +38,7 @@ args.eachMediaFolder { dir ->
|
||||||
|
|
||||||
println "$dir => $movie"
|
println "$dir => $movie"
|
||||||
try {
|
try {
|
||||||
fetchMovieArtworkAndNfo(dir, movie, dir.getFiles{ it.isVideo() }.sort{ it.length() }.reverse().findResult{ it } )
|
fetchMovieArtworkAndNfo(dir, movie, dir.getFiles{ it.isVideo() }.sort{ it.length() }.reverse().findResult{ it }, true)
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
println "${e.class.simpleName}: ${e.message}"
|
println "${e.class.simpleName}: ${e.message}"
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,6 +130,21 @@ def fetchMovieArtwork(outputFile, movieInfo, category, language) {
|
||||||
return selection.url.saveAs(outputFile)
|
return selection.url.saveAs(outputFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def fetchAllMovieArtwork(outputFolder, movieInfo, category, language) {
|
||||||
|
// select and fetch artwork
|
||||||
|
def artwork = TheMovieDB.getArtwork(movieInfo.id as String)
|
||||||
|
def selection = [language, 'en', null].findResults{ l -> artwork.findAll{ (l == it.language || l == null) && it.category == category } }.flatten().unique()
|
||||||
|
if (selection == null) {
|
||||||
|
println "Artwork not found: $outputFolder"
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
selection.eachWithIndex{ s, i ->
|
||||||
|
def outputFile = new File(outputFolder, "$category-${(i+1).pad(2)}.jpg")
|
||||||
|
println "Fetching $outputFile => $s"
|
||||||
|
s.url.saveAs(outputFile)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
def fetchMovieFanart(outputFile, movieInfo, type, diskType, locale) {
|
def fetchMovieFanart(outputFile, movieInfo, type, diskType, locale) {
|
||||||
def fanart = [locale, null].findResult{ lang -> FanartTV.getMovieArtwork(movieInfo.id).find{ type == it.type && (diskType == null || diskType == it.diskType) && (lang == null || lang == it.language) }}
|
def fanart = [locale, null].findResult{ lang -> FanartTV.getMovieArtwork(movieInfo.id).find{ type == it.type && (diskType == null || diskType == it.diskType) && (lang == null || lang == it.language) }}
|
||||||
if (fanart == null) {
|
if (fanart == null) {
|
||||||
|
@ -209,7 +224,7 @@ def fetchMovieNfo(outputFile, movieInfo, movieFile) {
|
||||||
.saveAs(outputFile)
|
.saveAs(outputFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
def fetchMovieArtworkAndNfo(movieDir, movie, movieFile = null, locale = _args.locale) {
|
def fetchMovieArtworkAndNfo(movieDir, movie, movieFile = null, fetchAll = false, locale = _args.locale) {
|
||||||
_guarded {
|
_guarded {
|
||||||
def movieInfo = TheMovieDB.getMovieInfo(movie, locale)
|
def movieInfo = TheMovieDB.getMovieInfo(movie, locale)
|
||||||
|
|
||||||
|
@ -223,5 +238,9 @@ def fetchMovieArtworkAndNfo(movieDir, movie, movieFile = null, locale = _args.lo
|
||||||
fetchMovieFanart(movieDir['clearart.png'], movieInfo, 'movieart', null, locale)
|
fetchMovieFanart(movieDir['clearart.png'], movieInfo, 'movieart', null, locale)
|
||||||
fetchMovieFanart(movieDir['logo.png'], movieInfo, 'movielogo', null, locale)
|
fetchMovieFanart(movieDir['logo.png'], movieInfo, 'movielogo', null, locale)
|
||||||
['bluray', 'dvd', null].findResult { diskType -> fetchMovieFanart(movieDir['disc.png'], movieInfo, 'moviedisc', diskType, locale) }
|
['bluray', 'dvd', null].findResult { diskType -> fetchMovieFanart(movieDir['disc.png'], movieInfo, 'moviedisc', diskType, locale) }
|
||||||
|
|
||||||
|
if (fetchAll) {
|
||||||
|
fetchAllMovieArtwork(movieDir['backdrops'], movieInfo, 'backdrops', locale.language)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ if (tryQuietly{ ut_state != ut_state_allow }) {
|
||||||
// enable/disable features as specified via --def parameters
|
// enable/disable features as specified via --def parameters
|
||||||
def subtitles = tryQuietly{ subtitles.toBoolean() }
|
def subtitles = tryQuietly{ subtitles.toBoolean() }
|
||||||
def artwork = tryQuietly{ artwork.toBoolean() }
|
def artwork = tryQuietly{ artwork.toBoolean() }
|
||||||
|
def backdrops = tryQuietly{ backdrops.toBoolean() }
|
||||||
|
|
||||||
// array of xbmc/plex hosts
|
// array of xbmc/plex hosts
|
||||||
def xbmc = tryQuietly{ xbmc.split(/[ ,|]+/) }
|
def xbmc = tryQuietly{ xbmc.split(/[ ,|]+/) }
|
||||||
|
@ -176,7 +177,7 @@ groups.each{ group, files ->
|
||||||
if (dest && artwork) {
|
if (dest && artwork) {
|
||||||
dest.mapByFolder().each{ dir, fs ->
|
dest.mapByFolder().each{ dir, fs ->
|
||||||
println "Fetching artwork for $dir from TheMovieDB"
|
println "Fetching artwork for $dir from TheMovieDB"
|
||||||
fetchMovieArtworkAndNfo(dir, group.mov, fs.findAll{ it.isVideo() }.sort{ it.length() }.reverse().findResult{ it })
|
fetchMovieArtworkAndNfo(dir, group.mov, fs.findAll{ it.isVideo() }.sort{ it.length() }.reverse().findResult{ it }, backdrops)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dest == null && failOnError) {
|
if (dest == null && failOnError) {
|
||||||
|
|
Loading…
Reference in New Issue