id3tag 0.14.0 → 1.0.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 667971eff7efb32a7d5b35c40bf93f66cf435c7aca6e24a6ca6c8d02cd90e783
4
- data.tar.gz: ae499c107a5cf5f75b1906a6259552061e9143e4f302cfbbadd4f3e4e62436b2
3
+ metadata.gz: 011333bf23567c8f51e7229c2c821acda9666e31c40d5b39a93ad2c5a226134d
4
+ data.tar.gz: 077f4efc53c1fca9760a893b1b70bf94a157ce1b20e6079d5be743e9576abbaf
5
5
  SHA512:
6
- metadata.gz: 93641cd6c5d2ef1febf87859bed72ec3f2aa92b79ed250f2e51dbf37373043c6bc39f07cb280e2ae171d25f6b1add950fc571706edce5bf35561d46dac5ab851
7
- data.tar.gz: bb9cb24084969d9b1e3b986f2b872e534ee67cfbf72599705fac60a931952c6765be3c95dffa08619763eb013740a6a2c5e8a6a799bb373a1c9c2e4a255fcf66
6
+ metadata.gz: 5b8d016a28c5e7e1b1438b64db2e615071bb107ee4b163b8d96002d11081e45dc47d2119d2aad30d66eb9c06d6649a61f951c271766ce17513aefa7c136e60cd
7
+ data.tar.gz: 5551c6c5bf45487f82489781dc6ff287bcbb73a248e95a81a1f8886bcdf8c51bf71fe6ee6fb870639508fa77c834a4e26736293a7c6c0cd1aa7386cc64342f2e
@@ -45,6 +45,7 @@ module ID3Tag
45
45
  if v2_tag_size > 0
46
46
  @file.seek(v2_tag_frame_and_padding_position)
47
47
  bytes_to_read = v2_tag_frame_and_padding_size
48
+ return BLANK_STRING if bytes_to_read < 0
48
49
  limit = ID3Tag.configuration.v2_tag_read_limit
49
50
  if (limit > 0) && (bytes_to_read > limit)
50
51
  bytes_to_read = limit
@@ -20,6 +20,7 @@ module ID3Tag
20
20
  :comments => :COM,
21
21
  :genre => :TCO,
22
22
  :track_nr => :TRK,
23
+ :disc_nr => :TPA,
23
24
  :unsychronized_transcription => :ULT,
24
25
  :image => :PIC
25
26
  },
@@ -31,6 +32,7 @@ module ID3Tag
31
32
  :comments => :COMM,
32
33
  :genre => :TCON,
33
34
  :track_nr => :TRCK,
35
+ :disc_nr => :TPOS,
34
36
  :unsychronized_transcription => :USLT,
35
37
  :image => :APIC
36
38
  },
@@ -42,6 +44,7 @@ module ID3Tag
42
44
  :comments => :COMM,
43
45
  :genre => :TCON,
44
46
  :track_nr => :TRCK,
47
+ :disc_nr => :TPOS,
45
48
  :unsychronized_transcription => :USLT,
46
49
  :image => :APIC
47
50
  }
@@ -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.0"
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.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Krists Ozols
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-18 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
@@ -42,30 +42,30 @@ dependencies:
42
42
  name: rdoc
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 6.2.1
47
+ version: 6.3.1
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 6.2.1
54
+ version: 6.3.1
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 3.9.0
61
+ version: 3.10.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 3.9.0
68
+ version: 3.10.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: simplecov
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -98,16 +98,16 @@ dependencies:
98
98
  name: pry
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: 0.13.1
103
+ version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: 0.13.1
110
+ version: '0'
111
111
  description: Native Ruby ID3 tag reader that aims for 100% coverage of ID3v2.x and
112
112
  ID3v1.x standards
113
113
  email: krists.ozols@gmail.com
@@ -160,7 +160,7 @@ homepage: https://github.com/krists/id3tag
160
160
  licenses:
161
161
  - MIT
162
162
  metadata: {}
163
- post_install_message:
163
+ post_install_message:
164
164
  rdoc_options: []
165
165
  require_paths:
166
166
  - lib
@@ -175,8 +175,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
175
175
  - !ruby/object:Gem::Version
176
176
  version: '0'
177
177
  requirements: []
178
- rubygems_version: 3.0.3
179
- signing_key:
178
+ rubygems_version: 3.3.5
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
182
182
  standards