id3tag 0.12.1 → 0.13.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: 19488a0e5c2d7354946f8c02f9190134580fde95820eb2ab3e35b559e4c85819
4
- data.tar.gz: 5b25ad975028445328117b0aaa443e4b781ca86bed14101366baa8fbf57915d0
3
+ metadata.gz: 525262f63858eb113a587b48909af73be7b1acf8e99e883ec84e3aa82f2eff1f
4
+ data.tar.gz: db8abc12784aaa9083c99431a68c1029fcb183887369cdec5489fef5c6591625
5
5
  SHA512:
6
- metadata.gz: 7d717cde84a8bcad1bcfb93c8f024e64fa315933bccd199f68a748c7b54c5ef57f7b184f926da63627eec14af1eeb769380e73dbe5f6cd5cefe657a1ef1782ff
7
- data.tar.gz: 4a80fd637e147b07f2ba2c35f5cbee826c430a778e86d3bec69bdf2e581f87e5c9794ea6542e60697f12826e51060f7f87b11cecb6c3fa507b815a7c85c1d548
6
+ metadata.gz: 4b2630fb570762b4f5d9da031bf5900b7d5649e29b99fdb32929b21e8d021ebde82a5c3e4da2f26cc52999bd4bbf1b7abcaff53ed8ee4bafb02e497b46fc7ca9
7
+ data.tar.gz: 922932d0dc2838926d2c0a78c31a43954aa2037a338d07f171faa52d7f0f7d69142433a2d98f49f06ce7f01eaa0fb6b824d4d56ac279ec2a94d6e2dbe4681d92
data/README.md CHANGED
@@ -12,7 +12,7 @@ gem install id3tag
12
12
 
13
13
  Or add the gem to your Gemfile:
14
14
  ```
15
- gem 'id3tag', '~> 0.11.0'
15
+ gem 'id3tag', '~> 0.13.0'
16
16
  ```
17
17
 
18
18
  ## How to use
@@ -67,14 +67,20 @@ ID3Tag.configuration do |c|
67
67
 
68
68
  # This way you can avoid Encoding::InvalidByteSequenceError when tag contains invalid data.
69
69
  # Currently only for String#encode which is used in TextFrames.
70
- # default: {}
70
+ # default: {}
71
71
  c.string_encode_options = { :invalid => :replace, :undef => :replace }
72
-
72
+
73
73
  # You might want to set v2.x tag read limit in bytes to avoid reading too much data into memory
74
74
  # v2 tags will be extracted until end of tag or limit is reached.
75
- # default: 0 (There are no limit)
75
+ # default: 0 (There are no limit)
76
76
  c.v2_tag_read_limit = 1048576 # 1 megabyte
77
-
77
+
78
+ # In some situations, it's not possible to recognize what is the encoding of a
79
+ # text frame. The default behavior is to raise UnsupportedTextEncoding, but
80
+ # it's possible to set a fallback to avoid it.
81
+ # default: nil
82
+ c.source_encoding_fallback = Encoding::UTF_8
83
+
78
84
  end
79
85
 
80
86
  ID3Tag.configuration.v2_tag_read_limit # 1048576
@@ -91,7 +97,7 @@ ID3Tag.local_configuration do
91
97
  ID3Tag.configuration.v2_tag_read_limit # 1024
92
98
  ID3Tag.configuration.v2_tag_read_limit = 9999
93
99
  # ...
94
- ID3Tag.configuration.v2_tag_read_limit # 9999
100
+ ID3Tag.configuration.v2_tag_read_limit # 9999
95
101
  end
96
102
 
97
103
  ID3Tag.configuration.v2_tag_read_limit # 1024
@@ -119,7 +125,7 @@ ID3Tag.configuration.v2_tag_read_limit # 0
119
125
  * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
120
126
 
121
127
  ## Code Status
122
- [![Code Climate](https://codeclimate.com/github/krists/id3tag.png)](https://codeclimate.com/github/krists/id3tag) [![Build Status](https://travis-ci.org/krists/id3tag.png?branch=master)](https://travis-ci.org/krists/id3tag) [![Coverage Status](https://coveralls.io/repos/krists/id3tag/badge.png?branch=master)](https://coveralls.io/r/krists/id3tag) [![Gem Version](https://badge.fury.io/rb/id3tag.png)](http://badge.fury.io/rb/id3tag)
128
+ [![Code Climate](https://codeclimate.com/github/krists/id3tag.svg)](https://codeclimate.com/github/krists/id3tag) [![Build Status](https://travis-ci.org/krists/id3tag.svg?branch=master)](https://travis-ci.org/krists/id3tag) [![Coverage Status](https://coveralls.io/repos/krists/id3tag/badge.svg?branch=master)](https://coveralls.io/r/krists/id3tag) [![Gem Version](https://badge.fury.io/rb/id3tag.svg)](http://badge.fury.io/rb/id3tag)
123
129
  ## Copyright
124
130
 
125
131
  Copyright (c) 2018 Krists Ozols. See LICENSE.txt for
@@ -20,14 +20,14 @@ module ID3Tag
20
20
  end
21
21
 
22
22
  def v2_tag_present?
23
- @file.rewind
23
+ @file.seek(0)
24
24
  @file.read(3) == IDV2_TAG_IDENTIFIER
25
25
  end
26
26
 
27
27
  def v1_tag_body
28
28
  if v1_tag_present?
29
29
  @file.seek(-v1_tag_size, IO::SEEK_END)
30
- @file.read
30
+ @file.read(v1_tag_size)
31
31
  else
32
32
  nil
33
33
  end
@@ -111,7 +111,7 @@ module ID3Tag
111
111
  end
112
112
 
113
113
  def get_v2_tag_header
114
- @file.rewind
114
+ @file.seek(0)
115
115
  ID3v2TagHeader.new(@file.read(ID3V2_TAG_HEADER_SIZE))
116
116
  end
117
117
  end
@@ -3,9 +3,11 @@ module ID3Tag
3
3
  def initialize
4
4
  @string_encode_options = {}
5
5
  @v2_tag_read_limit = 0
6
+ @source_encoding_fallback = nil
6
7
  end
7
8
 
8
9
  attr_accessor :string_encode_options
9
10
  attr_accessor :v2_tag_read_limit
11
+ attr_accessor :source_encoding_fallback
10
12
  end
11
13
  end
@@ -27,7 +27,7 @@ module ID3Tag
27
27
  end
28
28
 
29
29
  def self.encode(text, source_encoding)
30
- text.encode(DESTINATION_ENCODING, source_encoding, ID3Tag.configuration.string_encode_options)
30
+ text.encode(DESTINATION_ENCODING, source_encoding, **ID3Tag.configuration.string_encode_options)
31
31
  end
32
32
  end
33
33
  end
@@ -21,11 +21,13 @@ module ID3Tag
21
21
  private
22
22
 
23
23
  def encoded_content
24
- content_without_encoding_byte.encode(destination_encoding, source_encoding, ID3Tag.configuration.string_encode_options)
24
+ content_without_encoding_byte.encode(destination_encoding, source_encoding, **ID3Tag.configuration.string_encode_options)
25
25
  end
26
26
 
27
27
  def source_encoding
28
- ENCODING_MAP.fetch(get_encoding_byte) { raise UnsupportedTextEncoding }.to_s
28
+ ENCODING_MAP.fetch(get_encoding_byte) do
29
+ ID3Tag.configuration.source_encoding_fallback || raise(UnsupportedTextEncoding)
30
+ end.to_s
29
31
  end
30
32
 
31
33
  def destination_encoding
@@ -60,7 +60,7 @@ module ID3Tag
60
60
  end
61
61
 
62
62
  def rewind_input
63
- @input.rewind
63
+ @input.seek(0)
64
64
  end
65
65
 
66
66
  def padding_or_eof_reached?
@@ -1,3 +1,3 @@
1
1
  module ID3Tag
2
- VERSION = "0.12.1"
2
+ VERSION = "0.13.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.12.1
4
+ version: 0.13.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: 2018-06-16 00:00:00.000000000 Z
11
+ date: 2020-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -30,84 +30,84 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 12.1.0
33
+ version: 13.0.1
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 12.1.0
40
+ version: 13.0.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rdoc
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 5.1.0
47
+ version: 6.2.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: 5.1.0
54
+ version: 6.2.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.6.0
61
+ version: 3.9.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.6.0
68
+ version: 3.9.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: simplecov
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 0.14.1
75
+ version: 0.16.1
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 0.14.1
82
+ version: 0.16.1
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: coveralls
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 0.8.21
89
+ version: 0.8.23
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 0.8.21
96
+ version: 0.8.23
97
97
  - !ruby/object:Gem::Dependency
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.11.1
103
+ version: 0.13.1
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.11.1
110
+ version: 0.13.1
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
@@ -175,8 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
175
175
  - !ruby/object:Gem::Version
176
176
  version: '0'
177
177
  requirements: []
178
- rubyforge_project:
179
- rubygems_version: 2.7.3
178
+ rubygems_version: 3.0.3
180
179
  signing_key:
181
180
  specification_version: 4
182
181
  summary: Native Ruby ID3 tag reader that aims for 100% coverage of ID3v2.x and ID3v1.x