Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove obsolete check_file_attributes method #647

Merged
merged 1 commit into from
Oct 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions app/models/audio_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,6 @@ def check_self
false
end

def check_file_attributes
return unless check_self

tag = WahWah.open(full_path)
update(length: tag.duration, bitrate: tag.bitrate || 0, sample_rate: tag.sample_rate || 0, bit_depth: tag.bit_depth || 0)
end

def convert(codec_conversion)
parameters = codec_conversion.ffmpeg_params.split
stdin, stdout, = Open3.popen2(
Expand Down
10 changes: 0 additions & 10 deletions test/models/audio_file_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,6 @@ def setup
@audio_file = AudioFile.create(bitrate: 0, filename: 'base.flac', length: 100, codec:, location:, sample_rate: 0, bit_depth: 0)
end

test 'check_file should add sample_rate and bit_depth' do
@audio_file.check_file_attributes
@audio_file.reload

assert_equal 48_000, @audio_file.sample_rate
assert_equal 16, @audio_file.bit_depth
assert_equal 768, @audio_file.bitrate
assert_equal 0, @audio_file.length
end

test 'convert should not crash' do
stdin = StringIO.new
stdout = StringIO.new Rails.root.join('test/files/base.flac').read
Expand Down