From 3e29ed93de38d3107d44f367c3810a665b5d6a2f Mon Sep 17 00:00:00 2001 From: Daniel Nitsikopoulos Date: Thu, 29 Feb 2024 19:45:41 +1100 Subject: [PATCH] Allow mov files to be uploaded --- slices/micropub/commands/media/upload.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/slices/micropub/commands/media/upload.rb b/slices/micropub/commands/media/upload.rb index fde78d9..595ca70 100644 --- a/slices/micropub/commands/media/upload.rb +++ b/slices/micropub/commands/media/upload.rb @@ -14,7 +14,7 @@ module Micropub include Dry::Monads[:result] IMAGE_TYPES = %w[image/jpeg imag/jpg image/png].freeze - VIDEO_TYPES = %w[image/gif video/mp4].freeze + VIDEO_TYPES = %w[image/gif video/mp4 video/mov].freeze AUDIO_TYPES = %w[audio/mp3 audio/mpeg audio/x-m4a].freeze VALID_UPLOAD_TYPES = IMAGE_TYPES + VIDEO_TYPES + AUDIO_TYPES @@ -60,6 +60,8 @@ module Micropub Open3.popen3("ffmpeg -i #{file[:tempfile].path} -movflags faststart -pix_fmt yuv420p -vf 'scale=trunc(iw/2)*2:trunc(ih/2)*2' #{File.join(dirname, fullsize_filename)}") when "video/mp4" Open3.popen3("ffmpeg -i #{file[:tempfile].path} -vcodec libx264 -crf 28 #{File.join(dirname, fullsize_filename)}") + when "video/mov" + Open3.popen3("ffmpeg -i #{file[:tempfile].path} -vcodec libx264 -crf 28 #{File.join(dirname, fullsize_filename)}") end rescue Errno::ENOENT, NoMethodError => e return Failure(e.message)