id3tag 0.14.2 → 1.0.0

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
  SHA256:
3
- metadata.gz: 8ee2f5e34526388ad61267ade1af0773b4bd85c723b252cc7848a4a692d99281
4
- data.tar.gz: 984577caccfa629dc79ad4b0c49d52a2b7ce08598400084b199e2b4fc1909d8f
3
+ metadata.gz: 011333bf23567c8f51e7229c2c821acda9666e31c40d5b39a93ad2c5a226134d
4
+ data.tar.gz: 077f4efc53c1fca9760a893b1b70bf94a157ce1b20e6079d5be743e9576abbaf
5
5
  SHA512:
6
- metadata.gz: 22617752ac7e06ae319cf97d034c2d358b926252a76957e87899acdace5d130fd9051f43cf769e59e9a3c9d99c52bb417c475c24bcd1c7506a0196d1768d2fb6
7
- data.tar.gz: 6eea548143a08b68522d860ed3f0c8da2ed64590dfd87c7a3a4c7b182799542dfc9396eb8c9578b5686659b5bc013f63eb12b04a928ef771dbf892188051e3ff
6
+ metadata.gz: 5b8d016a28c5e7e1b1438b64db2e615071bb107ee4b163b8d96002d11081e45dc47d2119d2aad30d66eb9c06d6649a61f951c271766ce17513aefa7c136e60cd
7
+ data.tar.gz: 5551c6c5bf45487f82489781dc6ff287bcbb73a248e95a81a1f8886bcdf8c51bf71fe6ee6fb870639508fa77c834a4e26736293a7c6c0cd1aa7386cc64342f2e
@@ -11,7 +11,15 @@ module ID3Tag
11
11
  }
12
12
 
13
13
  def content
14
- @content ||= StringUtil.cut_at_null_byte(encoded_content)
14
+ @content ||= if @major_version_number >= 4
15
+ StringUtil.chomp_null_byte(encoded_content)
16
+ else
17
+ StringUtil.cut_at_null_byte(encoded_content)
18
+ end
19
+ end
20
+
21
+ def contents
22
+ @contents ||= StringUtil.split_by_null_bytes(content)
15
23
  end
16
24
 
17
25
  def inspectable_content
@@ -40,5 +40,13 @@ module ID3Tag
40
40
  end
41
41
  [before.pack(UTF_8_DIRECTIVE), after.pack(UTF_8_DIRECTIVE)]
42
42
  end
43
+
44
+ def self.split_by_null_bytes(string)
45
+ string.split(NULL_BYTE)
46
+ end
47
+
48
+ def self.chomp_null_byte(string)
49
+ string.chomp(NULL_BYTE)
50
+ end
43
51
  end
44
52
  end
@@ -10,7 +10,7 @@ module ID3Tag
10
10
  current_byte = input_bytes.next
11
11
  output_bytes << current_byte
12
12
  next_byte = input_bytes.peek
13
- if (current_byte == 255) && (next_byte > 224)
13
+ if (current_byte == 255) && ((next_byte >= 224) || (next_byte == 0))
14
14
  output_bytes << 0
15
15
  end
16
16
  end
@@ -20,8 +20,8 @@ module ID3Tag
20
20
  prev_byte = nil
21
21
  loop do
22
22
  current_byte = input_bytes.next
23
- next_byte = input_bytes.peek rescue 0
24
- unless (prev_byte == 255) && (current_byte == 0) && (next_byte > 224)
23
+ next_byte = input_bytes.peek rescue nil
24
+ unless (prev_byte == 255) && (current_byte == 0) && (next_byte != nil) && ((next_byte >= 224) || (next_byte == 0))
25
25
  output_bytes << current_byte
26
26
  end
27
27
  prev_byte = current_byte
@@ -1,3 +1,3 @@
1
1
  module ID3Tag
2
- VERSION = "0.14.2"
2
+ VERSION = "1.0.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: id3tag
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.2
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Krists Ozols
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-07 00:00:00.000000000 Z
11
+ date: 2022-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -175,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
175
175
  - !ruby/object:Gem::Version
176
176
  version: '0'
177
177
  requirements: []
178
- rubygems_version: 3.3.3
178
+ rubygems_version: 3.3.5
179
179
  signing_key:
180
180
  specification_version: 4
181
181
  summary: Native Ruby ID3 tag reader that aims for 100% coverage of ID3v2.x and ID3v1.x