posts: automatically tag videos with sound.
Automatically add the `sound` tag if the post has sound. Remove the tag if the post doesn't have sound. A video is considered to have sound if its peak loudness is greater than -70 dB. The current quietest post on Danbooru has a peak loudness of -62 dB (post #3470668), but it's possible to have audible sound at -80 dB or possibly even lower. It's hard to draw a clear line between "silent" and "barely audible".
This commit is contained in:
@@ -1264,6 +1264,24 @@ class PostTest < ActiveSupport::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
context "a silent video with the sound tag" do
|
||||
should "automatically remove the sound tag" do
|
||||
@media_asset = MediaAsset.upload!("test/files/mp4/test-silent-audio.mp4")
|
||||
@post.update!(md5: @media_asset.md5)
|
||||
@post.reload.update!(tag_string: "sound")
|
||||
assert_equal("animated tagme", @post.tag_string)
|
||||
end
|
||||
end
|
||||
|
||||
context "an audible video without the sound tag" do
|
||||
should "automatically add the sound tag" do
|
||||
@media_asset = MediaAsset.upload!("test/files/mp4/test-audio.mp4")
|
||||
@post.update!(md5: @media_asset.md5)
|
||||
@post.reload.update!(tag_string: "tagme")
|
||||
assert_equal("animated sound tagme", @post.tag_string)
|
||||
end
|
||||
end
|
||||
|
||||
context "a post with a non-web source" do
|
||||
should "automatically add the non-web_source tag" do
|
||||
@post.update!(source: "this was once revealed to me in a dream")
|
||||
|
||||
Reference in New Issue
Block a user