|
|
@ -329,16 +329,18 @@ ${res.locals.numFiles > 0 ? req.files.file.map(f => f.name+'|'+(f.phash || '')). |
|
|
|
const numFrames = videoStreams[0].nb_frames; |
|
|
|
const numFrames = videoStreams[0].nb_frames; |
|
|
|
if (numFrames === 'N/A' && subtype === 'webm') { |
|
|
|
if (numFrames === 'N/A' && subtype === 'webm') { |
|
|
|
await videoThumbnail(processedFile, processedFile.geometry, videoThumbPercentage+'%'); |
|
|
|
await videoThumbnail(processedFile, processedFile.geometry, videoThumbPercentage+'%'); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
await videoThumbnail(processedFile, processedFile.geometry, ((numFrames === 'N/A' || numFrames <= 1) ? 0 : videoThumbPercentage+'%')); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//check and fix bad thumbnails in all cases, helps prevent complaints from child molesters who want improper encoding handled better
|
|
|
|
let videoThumbStat = null; |
|
|
|
let videoThumbStat = null; |
|
|
|
try { |
|
|
|
try { |
|
|
|
videoThumbStat = await fsStat(`${uploadDirectory}/file/thumb/${processedFile.hash}${processedFile.thumbextension}`); |
|
|
|
videoThumbStat = await fsStat(`${uploadDirectory}/file/thumb/${processedFile.hash}${processedFile.thumbextension}`); |
|
|
|
} catch (err) { /*ENOENT, the thumb failed to create. No need to handle this.*/ } |
|
|
|
} catch (err) { /*ENOENT probably, ignore*/} |
|
|
|
if (!videoThumbStat || videoThumbStat.size === 0) { |
|
|
|
if (!videoThumbStat || videoThumbStat.code === 'ENOENT' || videoThumbStat.size === 0) { |
|
|
|
|
|
|
|
//create thumb again at 0 timestamp and lets hope it exists this time
|
|
|
|
await videoThumbnail(processedFile, processedFile.geometry, 0); |
|
|
|
await videoThumbnail(processedFile, processedFile.geometry, 0); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
|
|
|
|
await videoThumbnail(processedFile, processedFile.geometry, ((numFrames === 'N/A' || numFrames <= 1) ? 0 : videoThumbPercentage+'%')); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
//audio file, or video with only audio streams
|
|
|
|
//audio file, or video with only audio streams
|
|
|
|