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:
@@ -17,17 +17,10 @@ class UploadService
|
|||||||
upload.image_height = media_file.height
|
upload.image_height = media_file.height
|
||||||
|
|
||||||
upload.validate!(:file)
|
upload.validate!(:file)
|
||||||
upload.tag_string = "#{upload.tag_string} #{Utils.automatic_tags(media_file)}"
|
|
||||||
|
|
||||||
MediaAsset.upload!(media_file)
|
MediaAsset.upload!(media_file)
|
||||||
end
|
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)
|
def get_file_for_upload(source_url, referer_url, file)
|
||||||
return MediaFile.open(file) if file.present?
|
return MediaFile.open(file) if file.present?
|
||||||
raise "No file or source URL provided" if source_url.blank?
|
raise "No file or source URL provided" if source_url.blank?
|
||||||
|
|||||||
Reference in New Issue
Block a user