mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-03-01 05:29:41 +00:00
feat: implement server-side cover dimension detection and update badge thresholds
This commit is contained in:
parent
5bf60d5ae3
commit
d0c09d04f1
16 changed files with 353 additions and 10 deletions
|
|
@ -96,6 +96,24 @@ async function resizeImage(filePath, outputPath, width, height) {
|
|||
}
|
||||
module.exports.resizeImage = resizeImage
|
||||
|
||||
async function getImageDimensions(filePath) {
|
||||
return new Promise((resolve) => {
|
||||
Ffmpeg.ffprobe(filePath, (err, metadata) => {
|
||||
if (err) {
|
||||
Logger.error(`[FfmpegHelpers] ffprobe Error ${err}`)
|
||||
return resolve(null)
|
||||
}
|
||||
const stream = metadata?.streams?.find((s) => s.codec_type === 'video')
|
||||
if (stream) {
|
||||
resolve({ width: stream.width, height: stream.height })
|
||||
} else {
|
||||
resolve(null)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
module.exports.getImageDimensions = getImageDimensions
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {import('../objects/PodcastEpisodeDownload')} podcastEpisodeDownload
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue