uploads: don't autotag sound on videos.

Don't automatically add the sound tag to videos. This was incorrect
nearly 20% of the time because of silent audio tracks. This error rate
is too high.

https://danbooru.donmai.us/posts?tags=exif:Track2:AudioChannels+-sound
https://danbooru.donmai.us/posts?tags=exif:Track1:AudioChannels+-sound
This commit is contained in:
evazion
2021-10-18 05:59:31 -05:00
parent bc506ed1b8
commit 748fdf33d4

View File

@@ -17,17 +17,10 @@ class UploadService
upload.image_height = media_file.height
upload.validate!(:file)
upload.tag_string = "#{upload.tag_string} #{Utils.automatic_tags(media_file)}"
MediaAsset.upload!(media_file)
end
def automatic_tags(media_file)
tags = []
tags << "sound" if media_file.has_audio?
tags.join(" ")
end
def get_file_for_upload(source_url, referer_url, file)
return MediaFile.open(file) if file.present?
raise "No file or source URL provided" if source_url.blank?