From 2620d18a5b9fec60a8754567eb82bb7062b9df3b Mon Sep 17 00:00:00 2001 From: edshot99 Date: Sat, 18 Jan 2025 15:14:30 -0600 Subject: [PATCH] allow anamorphic videos and automatically tag them --- app/logical/file_methods.rb | 9 +++++++++ app/logical/file_validator.rb | 2 +- app/logical/upload_service/utils.rb | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/logical/file_methods.rb b/app/logical/file_methods.rb index 2b7fc123c..fe3717e08 100644 --- a/app/logical/file_methods.rb +++ b/app/logical/file_methods.rb @@ -121,4 +121,13 @@ module FileMethods rescue true end + + def is_anamorphic?(file_path) + return false if is_image? + + video = FFMPEG::Movie.new(file_path) + return false if video.sar == "1:1" + + true + end end diff --git a/app/logical/file_validator.rb b/app/logical/file_validator.rb index 88bcf3b9e..3b648842f 100644 --- a/app/logical/file_validator.rb +++ b/app/logical/file_validator.rb @@ -17,7 +17,7 @@ class FileValidator validate_container_format(video) validate_duration(video) validate_colorspace(video) - validate_sar(video) + # validate_sar(video) end validate_resolution(max_width, max_height) end diff --git a/app/logical/upload_service/utils.rb b/app/logical/upload_service/utils.rb index 7adeb99bb..f5c691aa0 100644 --- a/app/logical/upload_service/utils.rb +++ b/app/logical/upload_service/utils.rb @@ -75,6 +75,7 @@ class UploadService tags += ["animated_png", "animated"] if upload.is_animated_png?(file.path) # tags += ["animated"] if upload.is_webm? tags += ["ai_generated"] if upload.is_ai_generated?(file.path) + tags += ["anamorphic"] if upload.is_anamorphic?(file.path) tags.join(" ") end