id3taginator 0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +13 -0
- data/.idea/.gitignore +8 -0
- data/.idea/ID3Taginator.iml +73 -0
- data/.idea/misc.xml +4 -0
- data/.idea/modules.xml +8 -0
- data/.idea/vcs.xml +6 -0
- data/.rspec +3 -0
- data/.rubocop.yml +26 -0
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/Gemfile +12 -0
- data/LICENSE.txt +21 -0
- data/README.md +408 -0
- data/Rakefile +12 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/id3taginator.gemspec +37 -0
- data/lib/id3taginator/audio_file.rb +136 -0
- data/lib/id3taginator/errors/id3_tag_error.rb +12 -0
- data/lib/id3taginator/extensions/argument_check.rb +88 -0
- data/lib/id3taginator/extensions/comparable.rb +28 -0
- data/lib/id3taginator/extensions/encodable.rb +215 -0
- data/lib/id3taginator/extensions/optionable.rb +73 -0
- data/lib/id3taginator/frames/buffer/entities/buffer.rb +26 -0
- data/lib/id3taginator/frames/buffer/rbuf_recommended_buffer_size_frame.rb +59 -0
- data/lib/id3taginator/frames/buffer_frames.rb +32 -0
- data/lib/id3taginator/frames/comment/comm_comment_frame.rb +56 -0
- data/lib/id3taginator/frames/comment/entities/comment.rb +26 -0
- data/lib/id3taginator/frames/comment_frames.rb +42 -0
- data/lib/id3taginator/frames/count/entities/popularimeter.rb +26 -0
- data/lib/id3taginator/frames/count/pcnt_play_counter_frame.rb +40 -0
- data/lib/id3taginator/frames/count/popm_popularimeter_frame.rb +52 -0
- data/lib/id3taginator/frames/count_frames.rb +51 -0
- data/lib/id3taginator/frames/custom_frame.rb +39 -0
- data/lib/id3taginator/frames/custom_frames.rb +54 -0
- data/lib/id3taginator/frames/encryption/aenc_audio_encryption.rb +54 -0
- data/lib/id3taginator/frames/encryption/encr_encryption_method_frame.rb +49 -0
- data/lib/id3taginator/frames/encryption/entities/audio_encryption.rb +28 -0
- data/lib/id3taginator/frames/encryption/entities/encryption_method.rb +26 -0
- data/lib/id3taginator/frames/encryption_frames.rb +77 -0
- data/lib/id3taginator/frames/frameable.rb +75 -0
- data/lib/id3taginator/frames/geo/entities/encapsulated_object.rb +28 -0
- data/lib/id3taginator/frames/geo/geob_general_encapsulated_object_frame.rb +59 -0
- data/lib/id3taginator/frames/geo_frames.rb +41 -0
- data/lib/id3taginator/frames/grouping/entities/group_identification.rb +26 -0
- data/lib/id3taginator/frames/grouping/grid_group_identification_frame.rb +49 -0
- data/lib/id3taginator/frames/grouping/grp1_grouping_frame.rb +40 -0
- data/lib/id3taginator/frames/grouping_frames.rb +61 -0
- data/lib/id3taginator/frames/has_id.rb +51 -0
- data/lib/id3taginator/frames/id3v23_frame_flags.rb +64 -0
- data/lib/id3taginator/frames/id3v24_frame_flags.rb +80 -0
- data/lib/id3taginator/frames/id3v2_frame.rb +249 -0
- data/lib/id3taginator/frames/id3v2_frame_factory.rb +98 -0
- data/lib/id3taginator/frames/ipl/entities/involved_person.rb +24 -0
- data/lib/id3taginator/frames/ipl/ipls_involved_people_frame.rb +48 -0
- data/lib/id3taginator/frames/ipl_frames.rb +31 -0
- data/lib/id3taginator/frames/lyrics/entities/unsync_lyrics.rb +26 -0
- data/lib/id3taginator/frames/lyrics/uslt_unsync_lyrics_frame.rb +56 -0
- data/lib/id3taginator/frames/lyrics_frames.rb +42 -0
- data/lib/id3taginator/frames/mcdi/mcdi_music_cd_identifier_frame.rb +40 -0
- data/lib/id3taginator/frames/mcdi_frames.rb +28 -0
- data/lib/id3taginator/frames/picture/apic_picture_frame.rb +106 -0
- data/lib/id3taginator/frames/picture/entities/picture.rb +32 -0
- data/lib/id3taginator/frames/picture_frames.rb +51 -0
- data/lib/id3taginator/frames/private/entities/private_frame.rb +24 -0
- data/lib/id3taginator/frames/private/priv_private_frame.rb +45 -0
- data/lib/id3taginator/frames/private_frames.rb +40 -0
- data/lib/id3taginator/frames/text/entities/copyright.rb +24 -0
- data/lib/id3taginator/frames/text/entities/date.rb +24 -0
- data/lib/id3taginator/frames/text/entities/part_of_set.rb +24 -0
- data/lib/id3taginator/frames/text/entities/time.rb +24 -0
- data/lib/id3taginator/frames/text/entities/track_number.rb +24 -0
- data/lib/id3taginator/frames/text/entities/user_info.rb +24 -0
- data/lib/id3taginator/frames/text/talb_album_frame.rb +40 -0
- data/lib/id3taginator/frames/text/tbpm_bpm_frame.rb +40 -0
- data/lib/id3taginator/frames/text/tcom_composer_frame.rb +42 -0
- data/lib/id3taginator/frames/text/tcon_genre_frame.rb +104 -0
- data/lib/id3taginator/frames/text/tcop_copyright_frame.rb +55 -0
- data/lib/id3taginator/frames/text/tdat_date_frame.rb +60 -0
- data/lib/id3taginator/frames/text/tdly_playlist_delay_frame.rb +40 -0
- data/lib/id3taginator/frames/text/tenc_encoded_by_frame.rb +40 -0
- data/lib/id3taginator/frames/text/text_writers_frame.rb +43 -0
- data/lib/id3taginator/frames/text/tflt_file_type_frame.rb +71 -0
- data/lib/id3taginator/frames/text/time_time_frame.rb +60 -0
- data/lib/id3taginator/frames/text/tit1_content_group_description_frame.rb +40 -0
- data/lib/id3taginator/frames/text/tit2_title_frame.rb +40 -0
- data/lib/id3taginator/frames/text/tit3_subtitle_frame.rb +40 -0
- data/lib/id3taginator/frames/text/tkey_initial_key_frame.rb +40 -0
- data/lib/id3taginator/frames/text/tlan_language_frame.rb +48 -0
- data/lib/id3taginator/frames/text/tlen_length_frame.rb +40 -0
- data/lib/id3taginator/frames/text/tmed_media_type_frame.rb +40 -0
- data/lib/id3taginator/frames/text/toal_original_album_frame.rb +40 -0
- data/lib/id3taginator/frames/text/tofn_original_filename_frame.rb +40 -0
- data/lib/id3taginator/frames/text/toly_original_writers_frame.rb +43 -0
- data/lib/id3taginator/frames/text/tope_original_artists_frame.rb +43 -0
- data/lib/id3taginator/frames/text/tory_original_release_year_frame.rb +42 -0
- data/lib/id3taginator/frames/text/town_file_owner_frame.rb +40 -0
- data/lib/id3taginator/frames/text/tpe1_artist_frame.rb +43 -0
- data/lib/id3taginator/frames/text/tpe2_album_artist_frame.rb +40 -0
- data/lib/id3taginator/frames/text/tpe3_conductor_frame.rb +40 -0
- data/lib/id3taginator/frames/text/tpe4_modified_by_frame.rb +40 -0
- data/lib/id3taginator/frames/text/tpos_part_of_set_frame.rb +50 -0
- data/lib/id3taginator/frames/text/tpub_publisher_frame.rb +40 -0
- data/lib/id3taginator/frames/text/trck_track_number_frame.rb +50 -0
- data/lib/id3taginator/frames/text/trda_recording_dates_frame.rb +42 -0
- data/lib/id3taginator/frames/text/trsn_internet_radio_station_frame.rb +40 -0
- data/lib/id3taginator/frames/text/tsiz_size_frame.rb +41 -0
- data/lib/id3taginator/frames/text/tsoa_album_sort_order_frame.rb +40 -0
- data/lib/id3taginator/frames/text/tsop_performer_sort_order_frame.rb +40 -0
- data/lib/id3taginator/frames/text/tsot_title_sort_order_frame.rb +40 -0
- data/lib/id3taginator/frames/text/tsrc_isrc_frame.rb +40 -0
- data/lib/id3taginator/frames/text/tsse_encoder_frame.rb +40 -0
- data/lib/id3taginator/frames/text/txxx_user_text_info_frame.rb +51 -0
- data/lib/id3taginator/frames/text/tyer_year_frame.rb +42 -0
- data/lib/id3taginator/frames/text_frames.rb +840 -0
- data/lib/id3taginator/frames/tos/entities/ownership.rb +26 -0
- data/lib/id3taginator/frames/tos/entities/terms_of_use.rb +24 -0
- data/lib/id3taginator/frames/tos/owne_ownership_frame.rb +53 -0
- data/lib/id3taginator/frames/tos/user_terms_of_use_frame.rb +49 -0
- data/lib/id3taginator/frames/tos_frames.rb +54 -0
- data/lib/id3taginator/frames/ufid/entities/ufid_info.rb +24 -0
- data/lib/id3taginator/frames/ufid/ufid_unique_file_identifier_frame.rb +47 -0
- data/lib/id3taginator/frames/ufid_frames.rb +40 -0
- data/lib/id3taginator/frames/url/entities/user_info.rb +24 -0
- data/lib/id3taginator/frames/url/wcom_commercial_url_frame.rb +40 -0
- data/lib/id3taginator/frames/url/wcop_copyright_url_frame.rb +40 -0
- data/lib/id3taginator/frames/url/woaf_official_file_webpage_frame.rb +40 -0
- data/lib/id3taginator/frames/url/woar_official_artist_webpage_frame.rb +40 -0
- data/lib/id3taginator/frames/url/woas_official_source_webpage_frame.rb +40 -0
- data/lib/id3taginator/frames/url/wors_official_radio_station_homepage_frame.rb +40 -0
- data/lib/id3taginator/frames/url/wpay_payment_url_frame.rb +40 -0
- data/lib/id3taginator/frames/url/wpub_official_publisher_webpage_frame.rb +40 -0
- data/lib/id3taginator/frames/url/wxxx_user_url_link_frame.rb +50 -0
- data/lib/id3taginator/frames/url_frames.rb +195 -0
- data/lib/id3taginator/genres.rb +168 -0
- data/lib/id3taginator/header/id3v23_extended_header.rb +37 -0
- data/lib/id3taginator/header/id3v24_extended_header.rb +100 -0
- data/lib/id3taginator/header/id3v2_flags.rb +64 -0
- data/lib/id3taginator/id3v1_tag.rb +156 -0
- data/lib/id3taginator/id3v22_tag.rb +30 -0
- data/lib/id3taginator/id3v23_tag.rb +63 -0
- data/lib/id3taginator/id3v24_tag.rb +75 -0
- data/lib/id3taginator/id3v2_tag.rb +241 -0
- data/lib/id3taginator/options/options.rb +33 -0
- data/lib/id3taginator/util/compress_util.rb +25 -0
- data/lib/id3taginator/util/math_util.rb +68 -0
- data/lib/id3taginator/util/sync_util.rb +65 -0
- data/lib/id3taginator.rb +449 -0
- metadata +198 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Id3Taginator
|
4
|
+
module Frames
|
5
|
+
module Tos
|
6
|
+
module Entities
|
7
|
+
class Ownership
|
8
|
+
include Extensions::Comparable
|
9
|
+
|
10
|
+
attr_accessor :price_paid, :date_of_purchase, :seller
|
11
|
+
|
12
|
+
# constructor
|
13
|
+
#
|
14
|
+
# @param price_paid [String] the paid price. e.g. $19.99
|
15
|
+
# @param date_of_purchase [String] date of purchase in the format YYYYMMDD
|
16
|
+
# @param seller [String] the seller
|
17
|
+
def initialize(price_paid, date_of_purchase, seller)
|
18
|
+
@price_paid = price_paid
|
19
|
+
@date_of_purchase = date_of_purchase
|
20
|
+
@seller = seller
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Id3Taginator
|
4
|
+
module Frames
|
5
|
+
module Tos
|
6
|
+
module Entities
|
7
|
+
class TermsOfUse
|
8
|
+
include Extensions::Comparable
|
9
|
+
|
10
|
+
attr_accessor :language, :text
|
11
|
+
|
12
|
+
# constructor
|
13
|
+
#
|
14
|
+
# @param language [String] the 3 character language of the terms of use
|
15
|
+
# @param text [String] the terms of use text
|
16
|
+
def initialize(language, text)
|
17
|
+
@language = language
|
18
|
+
@text = text
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Id3Taginator
|
4
|
+
module Frames
|
5
|
+
module Tos
|
6
|
+
class OwnershipFrame < Id3v2Frame
|
7
|
+
include HasId
|
8
|
+
|
9
|
+
frame_info nil, :OWNE, :OWNE
|
10
|
+
|
11
|
+
attr_accessor :price_paid, :date_of_purchase, :seller
|
12
|
+
|
13
|
+
# builds the ownership frame
|
14
|
+
#
|
15
|
+
# @param price_paid [String] the paid price. e.g. $19.99
|
16
|
+
# @param date_of_purchase [String] date of purchase in the format YYYYMMDD
|
17
|
+
# @param seller [String] the seller
|
18
|
+
# @param options [Options::Options] options to use
|
19
|
+
# @param id3_version [Integer] the id3 version to build the frame for
|
20
|
+
#
|
21
|
+
# @return [Id3v2Frame] the resulting id3v2 frame
|
22
|
+
def self.build_frame(price_paid, date_of_purchase, seller, options = nil, id3_version: 3)
|
23
|
+
supported?('OWNE', id3_version, options)
|
24
|
+
|
25
|
+
argument_not_nil(price_paid, 'price_paid')
|
26
|
+
argument_not_nil(date_of_purchase, 'date_of_purchase')
|
27
|
+
argument_exactly_chars(date_of_purchase, 'date_of_purchase', 8)
|
28
|
+
argument_not_nil(seller, 'seller')
|
29
|
+
|
30
|
+
frame = new(frame_id(id3_version, options), 0, build_id3_flags(id3_version), '')
|
31
|
+
frame.price_paid = price_paid
|
32
|
+
frame.date_of_purchase = date_of_purchase
|
33
|
+
frame.seller = seller
|
34
|
+
frame
|
35
|
+
end
|
36
|
+
|
37
|
+
def process_content(content)
|
38
|
+
stream = StringIO.new(content)
|
39
|
+
encoding = find_encoding(stream.readbyte)
|
40
|
+
@price_paid = read_stream_until(stream, ZERO)
|
41
|
+
@date_of_purchase = stream.read(8)
|
42
|
+
encoded_seller = stream.read
|
43
|
+
@seller = decode(encoded_seller, encoding)
|
44
|
+
end
|
45
|
+
|
46
|
+
def content_to_bytes
|
47
|
+
encoded_seller = encode(@seller)
|
48
|
+
merge(default_encoding_destination_byte, @price_paid, "\x00", @date_of_purchase, encoded_seller)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Id3Taginator
|
4
|
+
module Frames
|
5
|
+
module Tos
|
6
|
+
class TermsOfUseFrame < Id3v2Frame
|
7
|
+
include HasId
|
8
|
+
|
9
|
+
frame_info nil, :USER, :USER
|
10
|
+
|
11
|
+
attr_accessor :language, :text
|
12
|
+
|
13
|
+
# builds the terms of use frame
|
14
|
+
#
|
15
|
+
# @param language [String] the 3 character language of the terms of use
|
16
|
+
# @param text [String] the terms of use text
|
17
|
+
# @param options [Options::Options] options to use
|
18
|
+
# @param id3_version [Integer] the id3 version to build the frame for
|
19
|
+
#
|
20
|
+
# @return [Id3v2Frame] the resulting id3v2 frame
|
21
|
+
def self.build_frame(language, text, options = nil, id3_version: 3)
|
22
|
+
supported?('USER', id3_version, options)
|
23
|
+
|
24
|
+
argument_not_nil(language, 'language')
|
25
|
+
argument_exactly_chars(language, 'language', 3)
|
26
|
+
argument_not_nil(text, 'text')
|
27
|
+
|
28
|
+
frame = new(frame_id(id3_version, options), 0, build_id3_flags(id3_version), '')
|
29
|
+
frame.language = language
|
30
|
+
frame.text = text
|
31
|
+
frame
|
32
|
+
end
|
33
|
+
|
34
|
+
def process_content(content)
|
35
|
+
stream = StringIO.new(content)
|
36
|
+
encoding = find_encoding(stream.readbyte)
|
37
|
+
@language = stream.read(3)
|
38
|
+
encoded_text = stream.read
|
39
|
+
@text = decode(encoded_text, encoding)
|
40
|
+
end
|
41
|
+
|
42
|
+
def content_to_bytes
|
43
|
+
encoded_text = encode(@text)
|
44
|
+
merge(default_encoding_destination_byte, @language, encoded_text)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Id3Taginator
|
4
|
+
module Frames
|
5
|
+
module ToSFrames
|
6
|
+
include Frames::Frameable
|
7
|
+
|
8
|
+
# extracts the terms of use frame (USER)
|
9
|
+
#
|
10
|
+
# @return [Frames::Tos::Entities::TermsOfUse, nil] returns the ToU Frame
|
11
|
+
def terms_of_use
|
12
|
+
frame = find_frame(Tos::TermsOfUseFrame.frame_id(@major_version, @options))
|
13
|
+
return nil if frame.nil?
|
14
|
+
|
15
|
+
Frames::Tos::Entities::TermsOfUse.new(frame.language, frame.text)
|
16
|
+
end
|
17
|
+
|
18
|
+
# sets the terms of use frame (USER)
|
19
|
+
#
|
20
|
+
# @param tou [Frames::Tos::Entities::TermsOfUse] the ToU
|
21
|
+
def terms_of_use=(tou)
|
22
|
+
set_frame_fields(Tos::TermsOfUseFrame, %i[@language @text], tou.language, tou.text)
|
23
|
+
end
|
24
|
+
|
25
|
+
# removes the terms of use frame
|
26
|
+
def remove_terms_of_use
|
27
|
+
@frames.delete_if { |f| f.frame_id == Tos::TermsOfUseFrame.frame_id(@major_version, @options) }
|
28
|
+
end
|
29
|
+
|
30
|
+
# extracts the ownership frame (OWNE)
|
31
|
+
#
|
32
|
+
# @return [Frames::Tos::Entities::Ownership, nil] returns the Ownership Frame
|
33
|
+
def ownership
|
34
|
+
frame = find_frame(Tos::OwnershipFrame.frame_id(@major_version, @options))
|
35
|
+
return nil if frame.nil?
|
36
|
+
|
37
|
+
Frames::Tos::Entities::Ownership.new(frame.price_paid, frame.date_of_purchase, frame.seller)
|
38
|
+
end
|
39
|
+
|
40
|
+
# sets the ownership frame (OWNE)
|
41
|
+
#
|
42
|
+
# @param ownership [Frames::Tos::Entities::Ownership] the Ownership
|
43
|
+
def ownership=(ownership)
|
44
|
+
set_frame_fields(Tos::OwnershipFrame, %i[@price_paid @date_of_purchase @seller],
|
45
|
+
ownership.price_paid, ownership.date_of_purchase, ownership.seller)
|
46
|
+
end
|
47
|
+
|
48
|
+
# removes the ownership frame
|
49
|
+
def remove_ownership
|
50
|
+
@frames.delete_if { |f| f.frame_id == Tos::OwnershipFrame.frame_id(@major_version, @options) }
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Id3Taginator
|
4
|
+
module Frames
|
5
|
+
module Ufid
|
6
|
+
module Entities
|
7
|
+
class UfidInfo
|
8
|
+
include Extensions::Comparable
|
9
|
+
|
10
|
+
attr_accessor :owner_id, :identifier
|
11
|
+
|
12
|
+
# constructor
|
13
|
+
#
|
14
|
+
# @param owner_id [String] the owner id
|
15
|
+
# @param identifier [String] the identifier bytes represented as a String (str.bytes)
|
16
|
+
def initialize(owner_id, identifier)
|
17
|
+
@owner_id = owner_id
|
18
|
+
@identifier = identifier
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Id3Taginator
|
4
|
+
module Frames
|
5
|
+
module Ufid
|
6
|
+
class UniqueFileIdentifierFrame < Id3v2Frame
|
7
|
+
include HasId
|
8
|
+
|
9
|
+
frame_info :UFI, :UFID, :UFID
|
10
|
+
|
11
|
+
attr_accessor :owner_id, :identifier
|
12
|
+
|
13
|
+
# builds the unique file identifier frame
|
14
|
+
#
|
15
|
+
# @param owner_id [String] the owner id
|
16
|
+
# @param identifier [String] the identifier bytes represented as a String (str.bytes)
|
17
|
+
# @param options [Options::Options] options to use
|
18
|
+
# @param id3_version [Integer] the id3 version to build the frame for
|
19
|
+
#
|
20
|
+
# @return [Id3v2Frame] the resulting id3v2 frame
|
21
|
+
def self.build_frame(owner_id, identifier, options = nil, id3_version: 3)
|
22
|
+
supported?('UFID', id3_version, options)
|
23
|
+
|
24
|
+
argument_not_nil(owner_id, 'owner_id')
|
25
|
+
argument_not_nil(identifier, 'identifier')
|
26
|
+
|
27
|
+
argument_less_than_chars(identifier, 'identifier', 64)
|
28
|
+
|
29
|
+
frame = new(frame_id(id3_version, options), 0, build_id3_flags(id3_version), '')
|
30
|
+
frame.owner_id = owner_id
|
31
|
+
frame.identifier = identifier
|
32
|
+
frame
|
33
|
+
end
|
34
|
+
|
35
|
+
def process_content(content)
|
36
|
+
stream = StringIO.new(content)
|
37
|
+
@owner_id = read_stream_until(stream, ZERO)
|
38
|
+
@identifier = stream.read
|
39
|
+
end
|
40
|
+
|
41
|
+
def content_to_bytes
|
42
|
+
"#{@owner_id}\x00#{@identifier}"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Id3Taginator
|
4
|
+
module Frames
|
5
|
+
module UfidFrames
|
6
|
+
include Frames::Frameable
|
7
|
+
|
8
|
+
# extracts the unique file identifier (UFID/UFI)
|
9
|
+
#
|
10
|
+
# @return [Array<Frames::Ufid::Entities::UfidInfo>] returns the Unique File Identifier
|
11
|
+
def unique_file_identifiers
|
12
|
+
frame = find_frames(Ufid::UniqueFileIdentifierFrame.frame_id(@major_version, @options))
|
13
|
+
return [] if frame.nil? || frame.empty?
|
14
|
+
|
15
|
+
frame.map { |f| Ufid::Entities::UfidInfo.new(f.owner_id, f.identifier) }
|
16
|
+
end
|
17
|
+
|
18
|
+
# adds a comment (UFID/UFI)
|
19
|
+
# Multiple ones can be added, as long as they have different owner_id
|
20
|
+
#
|
21
|
+
# @param identifier [Frames::Ufid::Entities::UfidInfo] the unique file identifier to add
|
22
|
+
def unique_file_identifiers=(identifier)
|
23
|
+
set_frame_fields_by_selector(Ufid::UniqueFileIdentifierFrame, %i[@owner_id @identifier],
|
24
|
+
->(f) { f.owner_id == identifier.owner_id },
|
25
|
+
identifier.owner_id, identifier.identifier)
|
26
|
+
end
|
27
|
+
|
28
|
+
alias add_unique_file_identifier unique_file_identifiers=
|
29
|
+
|
30
|
+
# removes a unique file identifier for the specific owner_id
|
31
|
+
#
|
32
|
+
# @param owner_id [String] the owner_id
|
33
|
+
def remove_unique_file_identifier(owner_id)
|
34
|
+
@frames.delete_if do |f|
|
35
|
+
f.frame_id == Ufid::UniqueFileIdentifierFrame.frame_id(@major_version, @options) && f.owner_id == owner_id
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Id3Taginator
|
4
|
+
module Frames
|
5
|
+
module Url
|
6
|
+
module Entities
|
7
|
+
class UserInfo
|
8
|
+
include Extensions::Comparable
|
9
|
+
|
10
|
+
attr_accessor :description, :url
|
11
|
+
|
12
|
+
# constructor
|
13
|
+
#
|
14
|
+
# @param description [String] the description
|
15
|
+
# @param url [String] the url
|
16
|
+
def initialize(description, url)
|
17
|
+
@description = description
|
18
|
+
@url = url
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Id3Taginator
|
4
|
+
module Frames
|
5
|
+
module Url
|
6
|
+
class CommercialUrlFrame < Id3v2Frame
|
7
|
+
include HasId
|
8
|
+
|
9
|
+
frame_info :WCM, :WCOM, :WCOM
|
10
|
+
|
11
|
+
attr_accessor :url
|
12
|
+
|
13
|
+
# builds the commercial use frame
|
14
|
+
#
|
15
|
+
# @param url [String] the url
|
16
|
+
# @param options [Options::Options] options to use
|
17
|
+
# @param id3_version [Integer] the id3 version to build the frame for
|
18
|
+
#
|
19
|
+
# @return [Id3v2Frame] the resulting id3v2 frame
|
20
|
+
def self.build_frame(url, options = nil, id3_version: 3)
|
21
|
+
supported?('WCOM', id3_version, options)
|
22
|
+
|
23
|
+
argument_not_nil(url, 'url')
|
24
|
+
|
25
|
+
frame = new(frame_id(id3_version, options), 0, build_id3_flags(id3_version), '')
|
26
|
+
frame.url = url
|
27
|
+
frame
|
28
|
+
end
|
29
|
+
|
30
|
+
def process_content(content)
|
31
|
+
@url = content
|
32
|
+
end
|
33
|
+
|
34
|
+
def content_to_bytes
|
35
|
+
@url
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Id3Taginator
|
4
|
+
module Frames
|
5
|
+
module Url
|
6
|
+
class CopyrightUrlFrame < Id3v2Frame
|
7
|
+
include HasId
|
8
|
+
|
9
|
+
frame_info :WCP, :WCOP, :WCOP
|
10
|
+
|
11
|
+
attr_accessor :url
|
12
|
+
|
13
|
+
# builds the copyright url frame
|
14
|
+
#
|
15
|
+
# @param url [String] the url
|
16
|
+
# @param options [Options::Options] options to use
|
17
|
+
# @param id3_version [Integer] the id3 version to build the frame for
|
18
|
+
#
|
19
|
+
# @return [Id3v2Frame] the resulting id3v2 frame
|
20
|
+
def self.build_frame(url, options = nil, id3_version: 3)
|
21
|
+
supported?('WCOP', id3_version, options)
|
22
|
+
|
23
|
+
argument_not_nil(url, 'url')
|
24
|
+
|
25
|
+
frame = new(frame_id(id3_version, options), 0, build_id3_flags(id3_version), '')
|
26
|
+
frame.url = url
|
27
|
+
frame
|
28
|
+
end
|
29
|
+
|
30
|
+
def process_content(content)
|
31
|
+
@url = content
|
32
|
+
end
|
33
|
+
|
34
|
+
def content_to_bytes
|
35
|
+
@url
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Id3Taginator
|
4
|
+
module Frames
|
5
|
+
module Url
|
6
|
+
class OfficialFileWebpageFrame < Id3v2Frame
|
7
|
+
include HasId
|
8
|
+
|
9
|
+
frame_info :WAF, :WOAF, :WOAF
|
10
|
+
|
11
|
+
attr_accessor :url
|
12
|
+
|
13
|
+
# builds the official file webpage frame
|
14
|
+
#
|
15
|
+
# @param url [String] the url
|
16
|
+
# @param options [Options::Options] options to use
|
17
|
+
# @param id3_version [Integer] the id3 version to build the frame for
|
18
|
+
#
|
19
|
+
# @return [Id3v2Frame] the resulting id3v2 frame
|
20
|
+
def self.build_frame(url, options = nil, id3_version: 3)
|
21
|
+
supported?('WOAF', id3_version, options)
|
22
|
+
|
23
|
+
argument_not_nil(url, 'url')
|
24
|
+
|
25
|
+
frame = new(frame_id(id3_version, options), 0, build_id3_flags(id3_version), '')
|
26
|
+
frame.url = url
|
27
|
+
frame
|
28
|
+
end
|
29
|
+
|
30
|
+
def process_content(content)
|
31
|
+
@url = content
|
32
|
+
end
|
33
|
+
|
34
|
+
def content_to_bytes
|
35
|
+
@url
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Id3Taginator
|
4
|
+
module Frames
|
5
|
+
module Url
|
6
|
+
class OfficialArtistWebpageFrame < Id3v2Frame
|
7
|
+
include HasId
|
8
|
+
|
9
|
+
frame_info :WAR, :WOAR, :WOAR
|
10
|
+
|
11
|
+
attr_accessor :url
|
12
|
+
|
13
|
+
# builds the official artist webpage frame
|
14
|
+
#
|
15
|
+
# @param url [String] the url
|
16
|
+
# @param options [Options::Options] options to use
|
17
|
+
# @param id3_version [Integer] the id3 version to build the frame for
|
18
|
+
#
|
19
|
+
# @return [Id3v2Frame] the resulting id3v2 frame
|
20
|
+
def self.build_frame(url, options = nil, id3_version: 3)
|
21
|
+
supported?('WOAR', id3_version, options)
|
22
|
+
|
23
|
+
argument_not_nil(url, 'url')
|
24
|
+
|
25
|
+
frame = new(frame_id(id3_version, options), 0, build_id3_flags(id3_version), '')
|
26
|
+
frame.url = url
|
27
|
+
frame
|
28
|
+
end
|
29
|
+
|
30
|
+
def process_content(content)
|
31
|
+
@url = content
|
32
|
+
end
|
33
|
+
|
34
|
+
def content_to_bytes
|
35
|
+
@url
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Id3Taginator
|
4
|
+
module Frames
|
5
|
+
module Url
|
6
|
+
class OfficialSourceWebpageFrame < Id3v2Frame
|
7
|
+
include HasId
|
8
|
+
|
9
|
+
frame_info :WAS, :WOAS, :WOAS
|
10
|
+
|
11
|
+
attr_accessor :url
|
12
|
+
|
13
|
+
# builds the official source webpage frame
|
14
|
+
#
|
15
|
+
# @param url [String] the url
|
16
|
+
# @param options [Options::Options] options to use
|
17
|
+
# @param id3_version [Integer] the id3 version to build the frame for
|
18
|
+
#
|
19
|
+
# @return [Id3v2Frame] the resulting id3v2 frame
|
20
|
+
def self.build_frame(url, options = nil, id3_version: 3)
|
21
|
+
supported?('WOAS', id3_version, options)
|
22
|
+
|
23
|
+
argument_not_nil(url, 'url')
|
24
|
+
|
25
|
+
frame = new(frame_id(id3_version, options), 0, build_id3_flags(id3_version), '')
|
26
|
+
frame.url = url
|
27
|
+
frame
|
28
|
+
end
|
29
|
+
|
30
|
+
def process_content(content)
|
31
|
+
@url = content
|
32
|
+
end
|
33
|
+
|
34
|
+
def content_to_bytes
|
35
|
+
@url
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Id3Taginator
|
4
|
+
module Frames
|
5
|
+
module Url
|
6
|
+
class OfficialAudioRadioStationHomepageFrame < Id3v2Frame
|
7
|
+
include HasId
|
8
|
+
|
9
|
+
frame_info nil, :WORS, :WORS
|
10
|
+
|
11
|
+
attr_accessor :url
|
12
|
+
|
13
|
+
# builds the official audio ration station homepage frame
|
14
|
+
#
|
15
|
+
# @param url [String] the url
|
16
|
+
# @param options [Options::Options] options to use
|
17
|
+
# @param id3_version [Integer] the id3 version to build the frame for
|
18
|
+
#
|
19
|
+
# @return [Id3v2Frame] the resulting id3v2 frame
|
20
|
+
def self.build_frame(url, options = nil, id3_version: 3)
|
21
|
+
supported?('WORS', id3_version, options)
|
22
|
+
|
23
|
+
argument_not_nil(url, 'url')
|
24
|
+
|
25
|
+
frame = new(frame_id(id3_version, options), 0, build_id3_flags(id3_version), '')
|
26
|
+
frame.url = url
|
27
|
+
frame
|
28
|
+
end
|
29
|
+
|
30
|
+
def process_content(content)
|
31
|
+
@url = content
|
32
|
+
end
|
33
|
+
|
34
|
+
def content_to_bytes
|
35
|
+
@url
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Id3Taginator
|
4
|
+
module Frames
|
5
|
+
module Url
|
6
|
+
class PaymentUrlFrame < Id3v2Frame
|
7
|
+
include HasId
|
8
|
+
|
9
|
+
frame_info nil, :WPAY, :WPAY
|
10
|
+
|
11
|
+
attr_accessor :url
|
12
|
+
|
13
|
+
# builds the payment url frame
|
14
|
+
#
|
15
|
+
# @param url [String] the url
|
16
|
+
# @param options [Options::Options] options to use
|
17
|
+
# @param id3_version [Integer] the id3 version to build the frame for
|
18
|
+
#
|
19
|
+
# @return [Id3v2Frame] the resulting id3v2 frame
|
20
|
+
def self.build_frame(url, options = nil, id3_version: 3)
|
21
|
+
supported?('WPAY', id3_version, options)
|
22
|
+
|
23
|
+
argument_not_nil(url, 'url')
|
24
|
+
|
25
|
+
frame = new(frame_id(id3_version, options), 0, build_id3_flags(id3_version), '')
|
26
|
+
frame.url = url
|
27
|
+
frame
|
28
|
+
end
|
29
|
+
|
30
|
+
def process_content(content)
|
31
|
+
@url = content
|
32
|
+
end
|
33
|
+
|
34
|
+
def content_to_bytes
|
35
|
+
@url
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Id3Taginator
|
4
|
+
module Frames
|
5
|
+
module Url
|
6
|
+
class OfficialPublisherWebpageFrame < Id3v2Frame
|
7
|
+
include HasId
|
8
|
+
|
9
|
+
frame_info :WPB, :WPUB, :WPUB
|
10
|
+
|
11
|
+
attr_accessor :url
|
12
|
+
|
13
|
+
# builds the official publisher webpage frame
|
14
|
+
#
|
15
|
+
# @param url [String] the url
|
16
|
+
# @param options [Options::Options] options to use
|
17
|
+
# @param id3_version [Integer] the id3 version to build the frame for
|
18
|
+
#
|
19
|
+
# @return [Id3v2Frame] the resulting id3v2 frame
|
20
|
+
def self.build_frame(url, options = nil, id3_version: 3)
|
21
|
+
supported?('WPUB', id3_version, options)
|
22
|
+
|
23
|
+
argument_not_nil(url, 'url')
|
24
|
+
|
25
|
+
frame = new(frame_id(id3_version, options), 0, build_id3_flags(id3_version), '')
|
26
|
+
frame.url = url
|
27
|
+
frame
|
28
|
+
end
|
29
|
+
|
30
|
+
def process_content(content)
|
31
|
+
@url = content
|
32
|
+
end
|
33
|
+
|
34
|
+
def content_to_bytes
|
35
|
+
@url
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|