id3tag 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c2ecfd975b9b73801ccab737a8f7c5490d8673ce
4
- data.tar.gz: 6ffd416cb6120685c30e763bb3f357fe2acbc875
3
+ metadata.gz: 92be9c2e14829993e4b5605e5e223a153ec95553
4
+ data.tar.gz: bc8c97ed113fe62aa18de8731c65c518527790e8
5
5
  SHA512:
6
- metadata.gz: 0bf31e863d6c8084cc9cb8f458b2267eeb8805c7c363346e2458cf11e045e66b389d7283bf7ce686ece25c90feb210641af0b50713eed4f40dd944020045dba9
7
- data.tar.gz: 4664e42acea06a36e1836294d968e1b07ea40d7407f4af256034a1aee6954b3588e2b991471f610f5c472e6bf435bb1e7855571632a04bc88efd155d79d1c685
6
+ metadata.gz: dea74a6d210076823b9705db4a5caadaaef41e78e375918f167ea29a5d6e428fcacb48736450110f022e46869255b1dcc20a97b17ec91dba814876e0a57cebc3
7
+ data.tar.gz: dd001f998fa99acaa2edd9088d9e36c5967625b4bbafeb99201d12edafe0cf1712577aa6ff1b1f33edcb209ca190322e84d54df511a0e7afe24d86d7c0756951
data/Gemfile CHANGED
@@ -1,9 +1,5 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- group :development do
4
- gem "debugger", :require => false, :platforms => :mri
5
- end
6
-
7
3
  group :development, :test do
8
4
  gem "jeweler", "~> 1.8.4"
9
5
  gem "rake"
@@ -3,19 +3,12 @@ GEM
3
3
  specs:
4
4
  addressable (2.3.5)
5
5
  builder (3.2.2)
6
- columnize (0.3.6)
7
6
  coveralls (0.7.0)
8
7
  multi_json (~> 1.3)
9
8
  rest-client
10
9
  simplecov (>= 0.7)
11
10
  term-ansicolor
12
11
  thor
13
- debugger (1.6.2)
14
- columnize (>= 0.3.1)
15
- debugger-linecache (~> 1.2.0)
16
- debugger-ruby_core_source (~> 1.2.3)
17
- debugger-linecache (1.2.0)
18
- debugger-ruby_core_source (1.2.3)
19
12
  diff-lcs (1.2.4)
20
13
  faraday (0.8.8)
21
14
  multipart-post (~> 1.2.0)
@@ -85,7 +78,6 @@ PLATFORMS
85
78
 
86
79
  DEPENDENCIES
87
80
  coveralls
88
- debugger
89
81
  jeweler (~> 1.8.4)
90
82
  rake
91
83
  rdoc (~> 3.12)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.1
1
+ 0.5.2
@@ -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.5.1 ruby lib
5
+ # stub: id3tag 0.5.2 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "id3tag"
9
- s.version = "0.5.1"
9
+ s.version = "0.5.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"]
@@ -112,7 +112,6 @@ Gem::Specification.new do |s|
112
112
  s.specification_version = 4
113
113
 
114
114
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
115
- s.add_development_dependency(%q<debugger>, [">= 0"])
116
115
  s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
117
116
  s.add_development_dependency(%q<rake>, [">= 0"])
118
117
  s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
@@ -120,7 +119,6 @@ Gem::Specification.new do |s|
120
119
  s.add_development_dependency(%q<simplecov>, [">= 0"])
121
120
  s.add_development_dependency(%q<coveralls>, [">= 0"])
122
121
  else
123
- s.add_dependency(%q<debugger>, [">= 0"])
124
122
  s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
125
123
  s.add_dependency(%q<rake>, [">= 0"])
126
124
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
@@ -129,7 +127,6 @@ Gem::Specification.new do |s|
129
127
  s.add_dependency(%q<coveralls>, [">= 0"])
130
128
  end
131
129
  else
132
- s.add_dependency(%q<debugger>, [">= 0"])
133
130
  s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
134
131
  s.add_dependency(%q<rake>, [">= 0"])
135
132
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
@@ -17,7 +17,7 @@ module ID3Tag
17
17
  private
18
18
 
19
19
  def content_split_apart_by_null_byte
20
- usable_content.split(StringUtil::NULL_BYTE, 2)
20
+ StringUtil.split_by_null_byte(usable_content)
21
21
  end
22
22
  end
23
23
  end
@@ -1,6 +1,7 @@
1
1
  module ID3Tag
2
2
  module StringUtil
3
3
  NULL_BYTE = "\x00"
4
+ UTF_8_DIRECTIVE = "U*"
4
5
 
5
6
  def self.blank?(string)
6
7
  string !~ /[^[:space:]]/
@@ -21,5 +22,23 @@ module ID3Tag
21
22
  def self.cut_at_null_byte(string)
22
23
  string.split(NULL_BYTE, 2).first
23
24
  end
25
+
26
+ def self.split_by_null_byte(string)
27
+ null_byte_found = false
28
+ has_skipped = false
29
+ before, after = [], []
30
+ string.each_byte do |byte|
31
+ if byte == 0
32
+ null_byte_found = true
33
+ (has_skipped = true) and next unless has_skipped
34
+ end
35
+ if null_byte_found
36
+ after << byte
37
+ else
38
+ before << byte
39
+ end
40
+ end
41
+ [before.pack(UTF_8_DIRECTIVE), after.pack(UTF_8_DIRECTIVE)]
42
+ end
24
43
  end
25
44
  end
@@ -46,4 +46,21 @@ describe ID3Tag::StringUtil do
46
46
  it { should eq("\xEE\xEE") }
47
47
  end
48
48
  end
49
+
50
+ describe "split_by_null_byte" do
51
+ let(:input) { }
52
+ subject { described_class.split_by_null_byte(input) }
53
+ context "when content have only 1 null byte" do
54
+ let(:input) { "a\u0000b" }
55
+ it { should eq(["a", "b"]) }
56
+ end
57
+ context "when content have multiple null bytes" do
58
+ let(:input) { "a\u0000\u0000b" }
59
+ it { should eq(["a", "\u0000b"]) }
60
+ end
61
+ context "when content have multiple null bytes" do
62
+ let(:input) { "abc" }
63
+ it { should eq(["abc", ""]) }
64
+ end
65
+ end
49
66
  end
data/tags CHANGED
@@ -285,6 +285,7 @@ remove lib/id3tag/unsynchronization.rb /^ def remove$/;" f class:ID3Tag.Unsyn
285
285
  rewind_input lib/id3tag/id3_v2_frame_parser.rb /^ def rewind_input$/;" f class:ID3Tag.ID3V2FrameParser
286
286
  source_encoding lib/id3tag/frames/v1/text_frame.rb /^ def source_encoding$/;" f class:ID3Tag.Frames.V1.TextFrame
287
287
  source_encoding lib/id3tag/frames/v2/text_frame.rb /^ def source_encoding$/;" f class:ID3Tag.Frames.V2.TextFrame
288
+ split_by_null_byte lib/id3tag/string_util.rb /^ def self.split_by_null_byte(string)$/;" F class:ID3Tag.StringUtil
288
289
  status_byte_from_flags lib/id3tag/frames/v2/frame_header_flags.rb /^ def status_byte_from_flags$/;" f class:ID3Tag.Frames.V2.FrameFlags
289
290
  tag_size lib/id3tag/id3_v2_extended_header.rb /^ def tag_size$/;" f class:ID3Tag.ID3v2ExtendedHeader
290
291
  tag_size lib/id3tag/id3_v2_tag_header.rb /^ def tag_size$/;" f class:ID3Tag.ID3v2TagHeader
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: id3tag
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Krists Ozols
@@ -10,20 +10,6 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2013-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: debugger
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - '>='
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - '>='
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: jeweler
29
15
  requirement: !ruby/object:Gem::Requirement