Skip to content

Commit

Permalink
Remove obsolete check_file_attributes method (#647)
Browse files Browse the repository at this point in the history
This was only used in a migration, and new deployments will not actually need it.
  • Loading branch information
chvp authored Oct 6, 2024
1 parent bcb6d17 commit 89cf023
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 17 deletions.
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

0 comments on commit 89cf023

Please sign in to comment.