id3tag 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/id3tag.gemspec +2 -2
- data/lib/id3tag/frames/v2/comments_frame.rb +1 -1
- data/lib/id3tag/frames/v2/text_frame.rb +5 -1
- data/spec/lib/id3tag/frames/v2/text_frame_spec.rb +7 -0
- data/tags +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30e2c415fd1a952d8239e96cf5b2ece8f3729f23
|
4
|
+
data.tar.gz: 9e064e792b74db5d5d473f04d7caa7865ff789f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c77daedfe027a064210ccd201f78e8834f6fdec4efd8bca7b0b34fe2e2329e9a3bb42fc1a8ae2a5f926cfc636ee3941f61a399d8cd8e48e41922ca8c714e886d
|
7
|
+
data.tar.gz: 11341ffed291bf7aab6441587461eadec753c454bad13d43bf4427212f86c4a8156e5e170635b771f82983e448c0558e4939278a76e96ce3a571fb89462fb70e
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.2
|
data/id3tag.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: id3tag 0.3.
|
5
|
+
# stub: id3tag 0.3.2 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "id3tag"
|
9
|
-
s.version = "0.3.
|
9
|
+
s.version = "0.3.2"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.authors = ["Krists Ozols"]
|
@@ -12,11 +12,15 @@ module ID3Tag
|
|
12
12
|
}
|
13
13
|
|
14
14
|
def content
|
15
|
-
@content ||= content_without_encoding_byte.encode(destination_encoding, source_encoding)
|
15
|
+
@content ||= cut_at_null_byte(content_without_encoding_byte.encode(destination_encoding, source_encoding))
|
16
16
|
end
|
17
17
|
|
18
18
|
alias inspectable_content content
|
19
19
|
|
20
|
+
def cut_at_null_byte(string)
|
21
|
+
string.split(NULL_BYTE, 2).first
|
22
|
+
end
|
23
|
+
|
20
24
|
private
|
21
25
|
|
22
26
|
def source_encoding
|
@@ -20,6 +20,13 @@ describe ID3Tag::Frames::V2::TextFrame do
|
|
20
20
|
describe '#content' do
|
21
21
|
subject { frame.content }
|
22
22
|
|
23
|
+
context "when text's last char is null byte" do
|
24
|
+
let(:target_encoding) { Encoding::UTF_8 }
|
25
|
+
let(:encoding_byte) { "\x03" }
|
26
|
+
let(:text) { "Glāzšķūņrūķīši\x00" }
|
27
|
+
it { should == 'Glāzšķūņrūķīši' }
|
28
|
+
end
|
29
|
+
|
23
30
|
context "when encoding byte is not present" do
|
24
31
|
let(:encoding_byte) { "" }
|
25
32
|
it { expect { subject }.to raise_error(ID3Tag::Frames::V2::TextFrame::UnsupportedTextEncoding) }
|
data/tags
CHANGED
@@ -126,6 +126,7 @@ convert_string_to_32bit_integer lib/id3tag/number_util.rb /^ def self.convert
|
|
126
126
|
current_additional_info_map lib/id3tag/frames/v2/frame_flags.rb /^ def current_additional_info_map$/;" f class:ID3Tag.Frames.V2.FrameFlags
|
127
127
|
current_encoding_map lib/id3tag/frames/v2/text_frame.rb /^ def current_encoding_map$/;" f class:ID3Tag.Frames.V2.TextFrame
|
128
128
|
current_flag_map lib/id3tag/frames/v2/frame_flags.rb /^ def current_flag_map$/;" f class:ID3Tag.Frames.V2.FrameFlags
|
129
|
+
cut_at_null_byte lib/id3tag/frames/v2/text_frame.rb /^ def cut_at_null_byte(string)$/;" f class:ID3Tag.Frames.V2.TextFrame
|
129
130
|
data_length_indicator? lib/id3tag/frames/v2/basic_frame.rb /^ def data_length_indicator?$/;" f class:ID3Tag.Frames.V2.BasicFrame
|
130
131
|
data_length_indicator? lib/id3tag/frames/v2/frame_flags.rb /^ def data_length_indicator?$/;" f class:ID3Tag.Frames.V2.FrameFlags
|
131
132
|
decode lib/id3tag/synchsafe_integer.rb /^ def decode(synchsafe_int)$/;" f class:ID3Tag.SynchsafeInteger.encode
|