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 +4 -4
- data/README.md +13 -7
- data/lib/id3tag/audio_file.rb +3 -3
- data/lib/id3tag/configuration_struct.rb +2 -0
- data/lib/id3tag/encoding_util.rb +1 -1
- data/lib/id3tag/frames/v2/text_frame.rb +4 -2
- data/lib/id3tag/id3_v2_frame_parser.rb +1 -1
- data/lib/id3tag/version.rb +1 -1
- metadata +15 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 525262f63858eb113a587b48909af73be7b1acf8e99e883ec84e3aa82f2eff1f
|
4
|
+
data.tar.gz: db8abc12784aaa9083c99431a68c1029fcb183887369cdec5489fef5c6591625
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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.
|
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
|
data/lib/id3tag/audio_file.rb
CHANGED
@@ -20,14 +20,14 @@ module ID3Tag
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def v2_tag_present?
|
23
|
-
@file.
|
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.
|
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
|
data/lib/id3tag/encoding_util.rb
CHANGED
@@ -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)
|
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
|
data/lib/id3tag/version.rb
CHANGED
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.
|
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:
|
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:
|
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:
|
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:
|
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:
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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
|
-
|
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
|