diff --git a/src/config.cr b/src/config.cr index 606c120..77740f3 100644 --- a/src/config.cr +++ b/src/config.cr @@ -85,5 +85,12 @@ class Config puts "Config: fileameLength cannot be #{config.fileameLength}" exit(1) end + + if config.files.ends_with?('/') + config.files = config.files.chomp('/') + end + if config.thumbnails.ends_with?('/') + config.thumbnails = config.thumbnails.chomp('/') + end end end diff --git a/src/utils.cr b/src/utils.cr index 499c651..083146e 100644 --- a/src/utils.cr +++ b/src/utils.cr @@ -115,6 +115,12 @@ module Utils end def generate_thumbnail(filename, extension) + exts = [".jpg", ".jpeg", ".png", ".gif", ".bmp", ".tiff", ".webp", ".heic", ".jxl", ".avif", ".crw", ".dng", + ".mp4", ".mkv", ".webm", ".avi", ".wmv", ".flv", "m4v", ".mov", ".amv", ".3gp", ".mpg", ".mpeg", ".yuv"] + # To prevent thumbnail generation on non image extensions + return if exts.none? do |ext| + extension.downcase.includes?(ext) + end # Disable generation if false return if !CONFIG.generateThumbnails || !CONFIG.thumbnails LOGGER.debug "Generating thumbnail for #{filename + extension} in background"