id3tag 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/id3tag/frames/v2/chapter_frame.rb +48 -0
- data/lib/id3tag/frames/v2/frame_fabricator.rb +8 -0
- data/lib/id3tag/frames/v2/picture_frame.rb +1 -1
- data/lib/id3tag/frames/v2/table_of_contents_frame.rb +59 -0
- data/lib/id3tag/frames/v2/url_frame.rb +14 -0
- data/lib/id3tag/frames/v2/user_url_frame.rb +24 -0
- data/lib/id3tag/version.rb +1 -1
- data/lib/id3tag.rb +4 -0
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 071d390948742ea6e37aabbe14326029cf1f61e7e783a282df493ff82d444d05
|
4
|
+
data.tar.gz: 74e9674570cb0eecfef7d47f8307f30bdaf9ecbf07563b6e8755009519af53c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22f0aac5137628fcc381f88307d449a3d0870ba8a9fe2ce8acf4101ab367674afbdf3133b5d200669c71c33f2cee86cb7b8dd002b631ca34f9dca894c014f75b
|
7
|
+
data.tar.gz: 350be9a1f12bb7098f99a7924bd247e5a41a5f3f42e0a2684f7bb9e2a0342c1ce381b764325197435bb07cbe5c8362de3b3ba6f31b37a0b7a6f61d7f835b13d9
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module ID3Tag
|
2
|
+
module Frames
|
3
|
+
module V2
|
4
|
+
class ChapterFrame < BasicFrame
|
5
|
+
def element_id
|
6
|
+
unpacked[:element_id]
|
7
|
+
end
|
8
|
+
|
9
|
+
def start_time
|
10
|
+
unpacked[:start_time]
|
11
|
+
end
|
12
|
+
|
13
|
+
def end_time
|
14
|
+
unpacked[:end_time]
|
15
|
+
end
|
16
|
+
|
17
|
+
def start_offset
|
18
|
+
unpacked[:start_offset]
|
19
|
+
end
|
20
|
+
|
21
|
+
def end_offset
|
22
|
+
unpacked[:end_offset]
|
23
|
+
end
|
24
|
+
|
25
|
+
def subframes
|
26
|
+
unpacked[:subframes]
|
27
|
+
end
|
28
|
+
|
29
|
+
alias_method :inspectable_content, :element_id
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def unpacked
|
34
|
+
return @unpacked if defined?(@unpacked)
|
35
|
+
@unpacked = {}
|
36
|
+
raw_content_io.rewind
|
37
|
+
@unpacked[:element_id] = IOUtil.read_until_terminator(raw_content_io, 1)
|
38
|
+
@unpacked[:start_time] = raw_content_io.read(4).unpack1("N")
|
39
|
+
@unpacked[:end_time] = raw_content_io.read(4).unpack1("N")
|
40
|
+
@unpacked[:start_offset] = raw_content_io.read(4).unpack1("N")
|
41
|
+
@unpacked[:end_offset] = raw_content_io.read(4).unpack1("N")
|
42
|
+
@unpacked[:subframes] = ID3V2FrameParser.new(raw_content_io.read, @major_version_number).frames
|
43
|
+
@unpacked
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -24,6 +24,10 @@ module ID3Tag
|
|
24
24
|
UserTextFrame
|
25
25
|
when /^T/
|
26
26
|
TextFrame
|
27
|
+
when /^WXXX$/
|
28
|
+
UserUrlFrame
|
29
|
+
when /^W/
|
30
|
+
UrlFrame
|
27
31
|
when /^(COM|COMM)$/
|
28
32
|
CommentsFrame
|
29
33
|
when /^(ULT|USLT)$/
|
@@ -36,6 +40,10 @@ module ID3Tag
|
|
36
40
|
PictureFrame
|
37
41
|
when /^PRIV$/
|
38
42
|
PrivateFrame
|
43
|
+
when /^CHAP$/
|
44
|
+
ChapterFrame
|
45
|
+
when /^CTOC$/
|
46
|
+
TableOfContentsFrame
|
39
47
|
else
|
40
48
|
BasicFrame
|
41
49
|
end
|
@@ -11,7 +11,7 @@ module ID3Tag
|
|
11
11
|
0x03 => :cover_front, # Cover (front)
|
12
12
|
0x04 => :cover_back, # Cover (back)
|
13
13
|
0x05 => :leaflet_page, # Leaflet page
|
14
|
-
0x06 => :media, # Media (e.g.
|
14
|
+
0x06 => :media, # Media (e.g. label side of CD)
|
15
15
|
0x07 => :lead_artist, # Lead artist/lead performer/soloist
|
16
16
|
0x08 => :artist, # Artist/performer
|
17
17
|
0x09 => :conductor, # Conductor
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module ID3Tag
|
2
|
+
module Frames
|
3
|
+
module V2
|
4
|
+
class TableOfContentsFrame < BasicFrame
|
5
|
+
FLAG_A_TOP_LEVEL_BIT = "00000001".to_i(2)
|
6
|
+
FLAG_B_ORDERED_BIT = "00000010".to_i(2)
|
7
|
+
|
8
|
+
def element_id
|
9
|
+
unpacked[:element_id]
|
10
|
+
end
|
11
|
+
|
12
|
+
def top_level?
|
13
|
+
unpacked[:flags] & FLAG_A_TOP_LEVEL_BIT > 0
|
14
|
+
end
|
15
|
+
|
16
|
+
def ordered?
|
17
|
+
unpacked[:flags] & FLAG_B_ORDERED_BIT > 0
|
18
|
+
end
|
19
|
+
|
20
|
+
def entry_count
|
21
|
+
unpacked[:entry_count]
|
22
|
+
end
|
23
|
+
|
24
|
+
def child_element_ids
|
25
|
+
unpacked[:child_element_ids]
|
26
|
+
end
|
27
|
+
|
28
|
+
alias_method :content, :child_element_ids
|
29
|
+
alias_method :inspectable_content, :content
|
30
|
+
|
31
|
+
def subframes
|
32
|
+
unpacked[:subframes]
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def unpacked
|
38
|
+
return @unpacked if defined?(@unpacked)
|
39
|
+
@unpacked = {}
|
40
|
+
raw_content_io.rewind
|
41
|
+
@unpacked[:element_id] = IOUtil.read_until_terminator(raw_content_io, 1)
|
42
|
+
@unpacked[:flags] = raw_content_io.read(1).unpack1("C")
|
43
|
+
@unpacked[:entry_count] = raw_content_io.read(1).unpack1("C")
|
44
|
+
|
45
|
+
@unpacked[:child_element_ids] = []
|
46
|
+
current_entry = 0
|
47
|
+
while current_entry < @unpacked[:entry_count]
|
48
|
+
@unpacked[:child_element_ids].push(IOUtil.read_until_terminator(raw_content_io, 1))
|
49
|
+
current_entry += 1
|
50
|
+
end
|
51
|
+
|
52
|
+
@unpacked[:subframes] = ID3V2FrameParser.new(raw_content_io.read, @major_version_number).frames
|
53
|
+
|
54
|
+
@unpacked
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module ID3Tag
|
2
|
+
module Frames
|
3
|
+
module V2
|
4
|
+
class UserUrlFrame < TextFrame
|
5
|
+
def description
|
6
|
+
@description ||= parts.first
|
7
|
+
end
|
8
|
+
|
9
|
+
def url
|
10
|
+
@url ||= parts.last
|
11
|
+
end
|
12
|
+
|
13
|
+
alias_method :content, :url
|
14
|
+
alias_method :inspectable_content, :content
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def parts
|
19
|
+
@parts ||= encoded_content.split(StringUtil::NULL_BYTE, 2)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/id3tag/version.rb
CHANGED
data/lib/id3tag.rb
CHANGED
@@ -23,6 +23,8 @@ require "id3tag/frames/v1/track_nr_frame"
|
|
23
23
|
require "id3tag/frames/v2/basic_frame"
|
24
24
|
require "id3tag/frames/v2/text_frame"
|
25
25
|
require "id3tag/frames/v2/user_text_frame"
|
26
|
+
require "id3tag/frames/v2/url_frame"
|
27
|
+
require "id3tag/frames/v2/user_url_frame"
|
26
28
|
require "id3tag/frames/v2/involved_people_list_frame"
|
27
29
|
require "id3tag/frames/v2/unique_file_id_frame"
|
28
30
|
require "id3tag/frames/v2/private_frame"
|
@@ -30,6 +32,8 @@ require "id3tag/frames/v2/comments_frame"
|
|
30
32
|
require "id3tag/frames/v2/unsychronized_transcription_frame"
|
31
33
|
require "id3tag/frames/v2/picture_frame"
|
32
34
|
require "id3tag/frames/v2/genre_frame"
|
35
|
+
require "id3tag/frames/v2/chapter_frame"
|
36
|
+
require "id3tag/frames/v2/table_of_contents_frame"
|
33
37
|
require "id3tag/frames/v2/genre_frame/genre_parser"
|
34
38
|
require "id3tag/frames/v2/genre_frame/genre_parser_pre_24"
|
35
39
|
require "id3tag/frames/v2/genre_frame/genre_parser_24"
|
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: 1.
|
4
|
+
version: 1.1.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: 2023-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -131,6 +131,7 @@ files:
|
|
131
131
|
- lib/id3tag/frames/v1/text_frame.rb
|
132
132
|
- lib/id3tag/frames/v1/track_nr_frame.rb
|
133
133
|
- lib/id3tag/frames/v2/basic_frame.rb
|
134
|
+
- lib/id3tag/frames/v2/chapter_frame.rb
|
134
135
|
- lib/id3tag/frames/v2/comments_frame.rb
|
135
136
|
- lib/id3tag/frames/v2/frame_fabricator.rb
|
136
137
|
- lib/id3tag/frames/v2/frame_flags.rb
|
@@ -141,10 +142,13 @@ files:
|
|
141
142
|
- lib/id3tag/frames/v2/involved_people_list_frame.rb
|
142
143
|
- lib/id3tag/frames/v2/picture_frame.rb
|
143
144
|
- lib/id3tag/frames/v2/private_frame.rb
|
145
|
+
- lib/id3tag/frames/v2/table_of_contents_frame.rb
|
144
146
|
- lib/id3tag/frames/v2/text_frame.rb
|
145
147
|
- lib/id3tag/frames/v2/unique_file_id_frame.rb
|
146
148
|
- lib/id3tag/frames/v2/unsychronized_transcription_frame.rb
|
149
|
+
- lib/id3tag/frames/v2/url_frame.rb
|
147
150
|
- lib/id3tag/frames/v2/user_text_frame.rb
|
151
|
+
- lib/id3tag/frames/v2/user_url_frame.rb
|
148
152
|
- lib/id3tag/id3_v1_frame_parser.rb
|
149
153
|
- lib/id3tag/id3_v2_frame_parser.rb
|
150
154
|
- lib/id3tag/id3_v2_tag_header.rb
|
@@ -175,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
175
179
|
- !ruby/object:Gem::Version
|
176
180
|
version: '0'
|
177
181
|
requirements: []
|
178
|
-
rubygems_version: 3.3.
|
182
|
+
rubygems_version: 3.3.3
|
179
183
|
signing_key:
|
180
184
|
specification_version: 4
|
181
185
|
summary: Native Ruby ID3 tag reader that aims for 100% coverage of ID3v2.x and ID3v1.x
|