mirror of https://github.com/thumbsup/thumbsup
feat(core): add support for static and animated GIFs
GraphicsMagick can’t process animated GIFs well unless all frames are coalesced, which creates very large files. This means there is a new dependency on Gifsicle which is very good at working with animated GIFs. - Thumbnails are still processed through GraphicsMagick (more options, e.g. centre-crop) - Large previews of animated GIFs go through Gifsicle The startup checks are updated to check for the Gifsicle binary. Fixes #96.pull/107/head
parent
e1517d2fbd
commit
0adef54dc8
@ -1,31 +0,0 @@
|
||||
const chalk = require('chalk')
|
||||
const commandExists = require('command-exists')
|
||||
|
||||
const COMMANDS = {
|
||||
'gm': 'http://www.graphicsmagick.org',
|
||||
'exiftool': 'https://www.sno.phy.queensu.ca/~phil/exiftool',
|
||||
'ffmpeg': 'https://www.ffmpeg.org'
|
||||
}
|
||||
|
||||
exports.verify = function () {
|
||||
const missing = Object.keys(COMMANDS).reduce(addToArrayIfMissing, [])
|
||||
if (missing.length > 0) {
|
||||
const list = missing.map(nameAndURL).join('\n')
|
||||
return `The following programs are required to run thumbsup:\n
|
||||
${list}\n
|
||||
Please make sure they are installed and available in the system path.`
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
function addToArrayIfMissing (acc, cmd) {
|
||||
if (!commandExists.sync(cmd)) {
|
||||
acc.push(cmd)
|
||||
}
|
||||
return acc
|
||||
}
|
||||
|
||||
function nameAndURL (cmd) {
|
||||
const url = chalk.green(COMMANDS[cmd])
|
||||
return `- ${cmd} (${url})`
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
const chalk = require('chalk')
|
||||
const commandExists = require('command-exists')
|
||||
const warn = require('debug')('thumbsup:warn')
|
||||
const messages = require('./messages')
|
||||
|
||||
const BINARIES = [
|
||||
{
|
||||
// required to build the database
|
||||
mandatory: true,
|
||||
cmd: 'exiftool',
|
||||
url: 'https://www.sno.phy.queensu.ca/~phil/exiftool',
|
||||
msg: ''
|
||||
},
|
||||
{
|
||||
// required to build thumbnails, even if we're only processing videos
|
||||
mandatory: true,
|
||||
cmd: 'gm',
|
||||
url: 'http://www.graphicsmagick.org',
|
||||
msg: ''
|
||||
},
|
||||
{
|
||||
// optional to process videos
|
||||
mandatory: false,
|
||||
cmd: 'ffmpeg',
|
||||
url: 'https://www.ffmpeg.org',
|
||||
msg: 'You will not be able to process videos.'
|
||||
},
|
||||
{
|
||||
// optional to process animated GIFs
|
||||
mandatory: false,
|
||||
cmd: 'gifsicle2',
|
||||
url: 'http://www.lcdf.org/gifsicle',
|
||||
msg: 'You will not be able to process animated GIFs.'
|
||||
}
|
||||
]
|
||||
|
||||
exports.checkRequired = () => {
|
||||
const missing = BINARIES.filter(bin => bin.mandatory).reduce(addToArrayIfMissing, [])
|
||||
if (missing.length > 0) {
|
||||
const list = missing.map(bin => `- ${bin.cmd} (${chalk.green(bin.url)})`)
|
||||
return messages.BINARIES_REQUIRED(list)
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
exports.checkOptional = () => {
|
||||
const missing = BINARIES.filter(bin => !bin.mandatory).reduce(addToArrayIfMissing, [])
|
||||
if (missing.length > 0) {
|
||||
missing.forEach(bin => {
|
||||
warn(`${bin.cmd} (${bin.url}) is not installed. ${bin.msg}`)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function addToArrayIfMissing (acc, binary) {
|
||||
if (!commandExists.sync(binary.cmd)) {
|
||||
acc.push(binary)
|
||||
}
|
||||
return acc
|
||||
}
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue