Skip to content

Commit

Permalink
Fix wav files not being rewound, such as when they are missing their …
Browse files Browse the repository at this point in the history
…file extension
  • Loading branch information
scouttyg committed Aug 8, 2024
1 parent 7f8190c commit dab3999
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/wahwah/riff_tag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def channel_mode
private

def parse
@file_io.rewind
top_chunk = Riff::Chunk.new(@file_io)
return unless top_chunk.valid?

Expand Down
2 changes: 1 addition & 1 deletion lib/wahwah/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module WahWah
VERSION = "1.6.4"
VERSION = "1.6.5"
end
21 changes: 21 additions & 0 deletions test/wahwah/riff_tag_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,25 @@ def test_tag_that_riff_chunk_without_data_chunk
assert_equal 16, tag.bit_depth
end
end

def test_tag_works_with_file_missing_extension
blob_data = binary_data("test/files/id3v2.wav")

Tempfile.create("temp-audio-file", binmode: true) do |temp_file|
temp_file.write blob_data
tag = WahWah::RiffTag.new(temp_file)

assert_equal "China Girl", tag.title
assert_equal "Iggy Pop", tag.artist
assert_equal "The Idiot", tag.album
assert_equal "1977", tag.year
assert_equal "Rock", tag.genre
assert_equal ["Iggy Pop Rocks"], tag.comments
assert_equal 8.001133947554926, tag.duration
assert_equal 1411, tag.bitrate
assert_equal "Stereo", tag.channel_mode
assert_equal 44100, tag.sample_rate
assert_equal 16, tag.bit_depth
end
end
end

0 comments on commit dab3999

Please sign in to comment.