You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When an mp3 file has a tag with unsupported text encoding (e.g.: artist), it raises an error as follows:
$ exe/format_parser_inspect file.mp3
Traceback (most recent call last):
33: from exe/format_parser_inspect:22:in `<main>' 32: from exe/format_parser_inspect:22:in `map' 31: from exe/format_parser_inspect:24:in `block in<main>' 30: from exe/format_parser_inspect:24:in `public_send'
29: from /Users/fabioperrella/projects/format_parser/lib/format_parser.rb:104:in `parse_file_at' 28: from /Users/fabioperrella/projects/format_parser/lib/format_parser.rb:104:in `open' 27: from /Users/fabioperrella/projects/format_parser/lib/format_parser.rb:105:in `block in parse_file_at' 26: from /Users/fabioperrella/projects/format_parser/lib/format_parser.rb:173:in `parse'
25: from /Users/fabioperrella/projects/format_parser/lib/format_parser.rb:173:in `to_a' 24: from /Users/fabioperrella/projects/format_parser/lib/format_parser.rb:173:in `each' 23: from /Users/fabioperrella/projects/format_parser/lib/format_parser.rb:173:in `each' 22: from /Users/fabioperrella/projects/format_parser/lib/format_parser.rb:173:in `each'
21: from /Users/fabioperrella/projects/format_parser/lib/format_parser.rb:173:in `each' 20: from /Users/fabioperrella/projects/format_parser/lib/format_parser.rb:169:in `block in parse' 19: from /Users/fabioperrella/projects/format_parser/lib/format_parser.rb:201:in `execute_parser_and_capture_expected_exceptions' 18: from /Users/fabioperrella/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/measurometer-1.1.1/lib/measurometer.rb:48:in `instrument'
17: from /Users/fabioperrella/projects/format_parser/lib/format_parser.rb:202:in `block in execute_parser_and_capture_expected_exceptions' 16: from /Users/fabioperrella/projects/format_parser/lib/parsers/mp3_parser.rb:84:in `call' 15: from /Users/fabioperrella/projects/format_parser/lib/parsers/mp3_parser.rb:281:in `blend_id3_tags_into_hash' 14: from /Users/fabioperrella/projects/format_parser/lib/parsers/mp3_parser.rb:281:in `each_with_object'
13: from /Users/fabioperrella/projects/format_parser/lib/parsers/mp3_parser.rb:281:in `each' 12: from /Users/fabioperrella/projects/format_parser/lib/parsers/mp3_parser.rb:282:in `block in blend_id3_tags_into_hash' 11: from /Users/fabioperrella/projects/format_parser/lib/parsers/mp3_parser.rb:45:in `to_h' 10: from /Users/fabioperrella/projects/format_parser/lib/parsers/mp3_parser.rb:45:in `each_with_object'
9: from /Users/fabioperrella/projects/format_parser/lib/parsers/mp3_parser.rb:45:in `each' 8: from /Users/fabioperrella/projects/format_parser/lib/parsers/mp3_parser.rb:46:in `block in to_h' 7: from /Users/fabioperrella/projects/format_parser/lib/parsers/mp3_parser.rb:46:in `public_send' 6: from /Users/fabioperrella/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/id3tag-0.12.1/lib/id3tag/tag.rb:19:in `block (2 levels) in <class:Tag>'
5: from /Users/fabioperrella/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/id3tag-0.12.1/lib/id3tag/tag.rb:25:in `content_of_first_frame' 4: from /Users/fabioperrella/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/id3tag-0.12.1/lib/id3tag/frames/v2/text_frame.rb:14:in `content' 3: from /Users/fabioperrella/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/id3tag-0.12.1/lib/id3tag/frames/v2/text_frame.rb:24:in `encoded_content' 2: from /Users/fabioperrella/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/id3tag-0.12.1/lib/id3tag/frames/v2/text_frame.rb:28:in `source_encoding'
1: from /Users/fabioperrella/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/id3tag-0.12.1/lib/id3tag/frames/v2/text_frame.rb:28:in `fetch'/Users/fabioperrella/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/id3tag-0.12.1/lib/id3tag/frames/v2/text_frame.rb:28:in `block in source_encoding': ID3Tag::Frames::V2::TextFrame::UnsupportedTextEncoding (ID3Tag::Frames::V2::TextFrame::UnsupportedTextEncoding)
The text was updated successfully, but these errors were encountered:
… encoding (#161)
We found a file which raises an error when calling the method tag.album (in id3v2), so I added a loop to call the member methods in the tag inside attempt_id3_v2_extraction. If some of them raise an error, it will consider the tag as invalid and return nil.
Since quite a few files have this problem we added a fallback encoding to the id3tag gem, and we configure it in format_parser when parsing a file. This should substantially reduce the number of errors and allow us to recover more data from MP3s (and most importantly - from more MP3 files).
Closes#160
When an mp3 file has a tag with unsupported text encoding (e.g.: artist), it raises an error as follows:
The text was updated successfully, but these errors were encountered: