1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-23 00:08:51 -05:00

Experiment with artwork thumbnail support

This commit is contained in:
Reinhard Pointner 2019-05-01 20:10:11 +07:00
parent aa62be470b
commit a131411003

View File

@ -11,7 +11,11 @@ thumbs.mkdirs()
void ls(f) { void ls(f) {
println "${f} (${byteCountToDisplaySize(f.length())})" if (f.exists()) {
log.info "$f (${byteCountToDisplaySize(f.length())})"
} else {
log.warning "[FILE NOT FOUND] $f"
}
} }
@ -22,34 +26,43 @@ def index = []
tvdbEntries.each{ tvdbEntries.each{
println "[$it.id] $it.name" log.info "[$it.id] $it.name"
def original = originals.resolve "${it.id}.jpg" def original = originals.resolve "${it.id}.jpg"
def thumb = thumbs.resolve "${it.id}.png" def thumb = thumbs.resolve "${it.id}.png"
if (original.exists() && thumb.exists()) { if (thumb.exists()) {
index << it index << it
return return
} }
def artwork = TheTVDB.getArtwork it.id, 'poster', Locale.ENGLISH def artwork = TheTVDB.getArtwork it.id, 'poster', Locale.ENGLISH
if (!artwork) { if (!artwork) {
sleep 1000
return return
} }
if (!original.exists()) { if (!original.exists()) {
sleep 2000 sleep 2000
artwork[0].url.saveAs original artwork.findResult{ a ->
try {
log.fine "Fetch $a"
return a.url.saveAs(original)
} catch (Exception e) {
printException(e)
}
}
ls original ls original
} }
if (!thumb.exists()) { if (original.exists() && !thumb.exists()) {
execute '/usr/local/bin/convert', original, '-strip', '-thumbnail', '48x48>', 'PNG8:' + thumb execute '/usr/local/bin/convert', original, '-strip', '-thumbnail', '48x48>', 'PNG8:' + thumb
ls thumb ls thumb
} }
if (thumb.exists()) {
index << it index << it
return
}
} }