active_brainz 0.1.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 +7 -0
- data/Gemfile +9 -0
- data/LICENSE.md +21 -0
- data/README.md +83 -0
- data/config/inflections.rb +9 -0
- data/lib/active_brainz.rb +36 -0
- data/lib/active_brainz/models/area/area.rb +123 -0
- data/lib/active_brainz/models/area/area_type.rb +37 -0
- data/lib/active_brainz/models/artist/artist.rb +150 -0
- data/lib/active_brainz/models/artist/artist_alias.rb +62 -0
- data/lib/active_brainz/models/artist/artist_alias_type.rb +37 -0
- data/lib/active_brainz/models/artist/artist_credit.rb +60 -0
- data/lib/active_brainz/models/artist/artist_credit_name.rb +46 -0
- data/lib/active_brainz/models/artist/artist_type.rb +37 -0
- data/lib/active_brainz/models/base.rb +16 -0
- data/lib/active_brainz/models/concerns/has_begin_end_date.rb +27 -0
- data/lib/active_brainz/models/concerns/has_gid.rb +15 -0
- data/lib/active_brainz/models/concerns/has_parent_children.rb +20 -0
- data/lib/active_brainz/models/gender/gender.rb +41 -0
- data/lib/active_brainz/models/genre/genre.rb +36 -0
- data/lib/active_brainz/models/genre/genre_alias.rb +42 -0
- data/lib/active_brainz/models/label/label.rb +121 -0
- data/lib/active_brainz/models/label/label_alias.rb +62 -0
- data/lib/active_brainz/models/label/label_alias_type.rb +37 -0
- data/lib/active_brainz/models/label/label_type.rb +37 -0
- data/lib/active_brainz/models/medium/medium.rb +68 -0
- data/lib/active_brainz/models/place/place.rb +97 -0
- data/lib/active_brainz/models/place/place_alias.rb +62 -0
- data/lib/active_brainz/models/place/place_alias_type.rb +37 -0
- data/lib/active_brainz/models/place/place_type.rb +37 -0
- data/lib/active_brainz/models/recording/recording.rb +101 -0
- data/lib/active_brainz/models/release/release.rb +150 -0
- data/lib/active_brainz/models/release/release_group.rb +100 -0
- data/lib/active_brainz/models/track/track.rb +72 -0
- data/lib/active_brainz/version.rb +24 -0
- metadata +372 -0
@@ -0,0 +1,121 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActiveBrainz
|
4
|
+
class Label < Base
|
5
|
+
self.table_name = "label"
|
6
|
+
|
7
|
+
include HasGID
|
8
|
+
include HasBeginEndDate
|
9
|
+
|
10
|
+
belongs_to :label_area,
|
11
|
+
class_name: "Area",
|
12
|
+
foreign_key: "area",
|
13
|
+
optional: true
|
14
|
+
|
15
|
+
belongs_to :label_type,
|
16
|
+
class_name: "LabelType",
|
17
|
+
foreign_key: "type",
|
18
|
+
optional: true
|
19
|
+
|
20
|
+
# has_many :edit_labels,
|
21
|
+
# class_name: "EditLabel",
|
22
|
+
# foreign_key: "label"
|
23
|
+
|
24
|
+
# has_many :editor_collection_labels,
|
25
|
+
# class_name: "EditorCollectionLabel",
|
26
|
+
# foreign_key: "label"
|
27
|
+
|
28
|
+
# has_many :editor_subscribe_labels,
|
29
|
+
# class_name: "EditorSubscribeLabel",
|
30
|
+
# foreign_key: "label"
|
31
|
+
|
32
|
+
has_many :label_aliases,
|
33
|
+
class_name: "LabelAlias",
|
34
|
+
foreign_key: "label"
|
35
|
+
|
36
|
+
# has_many :label_annotations,
|
37
|
+
# class_name: "LabelAnnotation",
|
38
|
+
# foreign_key: "label"
|
39
|
+
|
40
|
+
# has_many :label_attributes,
|
41
|
+
# class_name: "LabelAttribute",
|
42
|
+
# foreign_key: "label"
|
43
|
+
|
44
|
+
# has_many :label_gid_redirects,
|
45
|
+
# class_name: "LabelGIDRedirect",
|
46
|
+
# foreign_key: "new_id"
|
47
|
+
|
48
|
+
# has_many :label_ipis,
|
49
|
+
# class_name: "LabelIPI",
|
50
|
+
# foreign_key: "label"
|
51
|
+
|
52
|
+
# has_many :label_isnis,
|
53
|
+
# class_name: "LabelISNI",
|
54
|
+
# foreign_key: "label"
|
55
|
+
|
56
|
+
# has_many :label_meta,
|
57
|
+
# class_name: "LabelMeta",
|
58
|
+
# foreign_key: "id"
|
59
|
+
|
60
|
+
# has_many :label_rating_raws,
|
61
|
+
# class_name: "LabelRatingRaw",
|
62
|
+
# foreign_key: "label"
|
63
|
+
|
64
|
+
# has_many :label_tag_raws,
|
65
|
+
# class_name: "LabelTagRaw",
|
66
|
+
# foreign_key: "label"
|
67
|
+
|
68
|
+
# has_many :label_tags,
|
69
|
+
# class_name: "LabelTag",
|
70
|
+
# foreign_key: "label"
|
71
|
+
|
72
|
+
# has_many :release_labels,
|
73
|
+
# class_name: "ReleaseLabel",
|
74
|
+
# foreign_key: "label"
|
75
|
+
|
76
|
+
attribute :name
|
77
|
+
attribute :comment
|
78
|
+
attribute :label_code, :integer
|
79
|
+
|
80
|
+
attribute :edits_pending, :integer
|
81
|
+
attribute :last_updated, :datetime
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
# == Schema Information
|
86
|
+
#
|
87
|
+
# Table name: label
|
88
|
+
#
|
89
|
+
# id :integer not null, primary key
|
90
|
+
# area :integer
|
91
|
+
# begin_date_day :integer
|
92
|
+
# begin_date_month :integer
|
93
|
+
# begin_date_year :integer
|
94
|
+
# comment :string(255) default(""), not null
|
95
|
+
# edits_pending :integer default(0), not null
|
96
|
+
# end_date_day :integer
|
97
|
+
# end_date_month :integer
|
98
|
+
# end_date_year :integer
|
99
|
+
# ended :boolean default(FALSE), not null
|
100
|
+
# gid :uuid not null
|
101
|
+
# label_code :integer
|
102
|
+
# last_updated :datetime
|
103
|
+
# name :string not null
|
104
|
+
# type :integer
|
105
|
+
#
|
106
|
+
# Indexes
|
107
|
+
#
|
108
|
+
# label_idx_area (area)
|
109
|
+
# label_idx_gid (gid) UNIQUE
|
110
|
+
# label_idx_lower_name (lower((name)::text))
|
111
|
+
# label_idx_musicbrainz_collate (name)
|
112
|
+
# label_idx_name (name)
|
113
|
+
# label_idx_null_comment (name) UNIQUE WHERE (comment IS NULL)
|
114
|
+
# label_idx_txt (mb_simple_tsvector((name)::text)) USING gin
|
115
|
+
# label_idx_uniq_name_comment (name,comment) UNIQUE WHERE (comment IS NOT NULL)
|
116
|
+
#
|
117
|
+
# Foreign Keys
|
118
|
+
#
|
119
|
+
# label_fk_area (area => area.id)
|
120
|
+
# label_fk_type (type => label_type.id)
|
121
|
+
#
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActiveBrainz
|
4
|
+
class LabelAlias < Base
|
5
|
+
self.table_name = "label_alias"
|
6
|
+
|
7
|
+
include HasBeginEndDate
|
8
|
+
|
9
|
+
belongs_to :label_alias_label,
|
10
|
+
class_name: "Label",
|
11
|
+
foreign_key: "label",
|
12
|
+
optional: true
|
13
|
+
|
14
|
+
belongs_to :label_alias_type,
|
15
|
+
class_name: "LabelAliasType",
|
16
|
+
foreign_key: "type",
|
17
|
+
optional: true
|
18
|
+
|
19
|
+
attribute :name
|
20
|
+
attribute :sort_name
|
21
|
+
|
22
|
+
attribute :locale
|
23
|
+
attribute :primary_for_locale, :boolean
|
24
|
+
|
25
|
+
attribute :edits_pending, :integer
|
26
|
+
attribute :last_updated, :datetime
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
# == Schema Information
|
31
|
+
#
|
32
|
+
# Table name: label_alias
|
33
|
+
#
|
34
|
+
# id :integer not null, primary key
|
35
|
+
# begin_date_day :integer
|
36
|
+
# begin_date_month :integer
|
37
|
+
# begin_date_year :integer
|
38
|
+
# edits_pending :integer default(0), not null
|
39
|
+
# end_date_day :integer
|
40
|
+
# end_date_month :integer
|
41
|
+
# end_date_year :integer
|
42
|
+
# ended :boolean default(FALSE), not null
|
43
|
+
# label :integer not null
|
44
|
+
# last_updated :datetime
|
45
|
+
# locale :text
|
46
|
+
# name :string not null
|
47
|
+
# primary_for_locale :boolean default(FALSE), not null
|
48
|
+
# sort_name :string not null
|
49
|
+
# type :integer
|
50
|
+
#
|
51
|
+
# Indexes
|
52
|
+
#
|
53
|
+
# label_alias_idx_label (label)
|
54
|
+
# label_alias_idx_primary (label,locale) UNIQUE WHERE ((primary_for_locale = true) AND (locale IS NOT NULL))
|
55
|
+
# label_alias_idx_txt (mb_simple_tsvector((name)::text)) USING gin
|
56
|
+
# label_alias_idx_txt_sort (mb_simple_tsvector((sort_name)::text)) USING gin
|
57
|
+
#
|
58
|
+
# Foreign Keys
|
59
|
+
#
|
60
|
+
# label_alias_fk_label (label => label.id)
|
61
|
+
# label_alias_fk_type (type => label_alias_type.id)
|
62
|
+
#
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActiveBrainz
|
4
|
+
class LabelAliasType < Base
|
5
|
+
self.table_name = "label_alias_type"
|
6
|
+
|
7
|
+
include HasGID
|
8
|
+
include HasParentChildren
|
9
|
+
|
10
|
+
has_many :label_aliases,
|
11
|
+
class_name: "LabelAlias",
|
12
|
+
foreign_key: "type"
|
13
|
+
|
14
|
+
attribute :name
|
15
|
+
attribute :description
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# == Schema Information
|
20
|
+
#
|
21
|
+
# Table name: label_alias_type
|
22
|
+
#
|
23
|
+
# id :integer not null, primary key
|
24
|
+
# child_order :integer default(0), not null
|
25
|
+
# description :text
|
26
|
+
# gid :uuid not null
|
27
|
+
# name :text not null
|
28
|
+
# parent :integer
|
29
|
+
#
|
30
|
+
# Indexes
|
31
|
+
#
|
32
|
+
# label_alias_type_idx_gid (gid) UNIQUE
|
33
|
+
#
|
34
|
+
# Foreign Keys
|
35
|
+
#
|
36
|
+
# label_alias_type_fk_parent (parent => label_alias_type.id)
|
37
|
+
#
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActiveBrainz
|
4
|
+
class LabelType < Base
|
5
|
+
self.table_name = "label_type"
|
6
|
+
|
7
|
+
include HasGID
|
8
|
+
include HasParentChildren
|
9
|
+
|
10
|
+
has_many :labels,
|
11
|
+
class_name: "Label",
|
12
|
+
foreign_key: "type"
|
13
|
+
|
14
|
+
attribute :name
|
15
|
+
attribute :description
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# == Schema Information
|
20
|
+
#
|
21
|
+
# Table name: label_type
|
22
|
+
#
|
23
|
+
# id :integer not null, primary key
|
24
|
+
# child_order :integer default(0), not null
|
25
|
+
# description :text
|
26
|
+
# gid :uuid not null
|
27
|
+
# name :string(255) not null
|
28
|
+
# parent :integer
|
29
|
+
#
|
30
|
+
# Indexes
|
31
|
+
#
|
32
|
+
# label_type_idx_gid (gid) UNIQUE
|
33
|
+
#
|
34
|
+
# Foreign Keys
|
35
|
+
#
|
36
|
+
# label_type_fk_parent (parent => label_type.id)
|
37
|
+
#
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActiveBrainz
|
4
|
+
class Medium < Base
|
5
|
+
self.table_name = "medium"
|
6
|
+
|
7
|
+
# belongs_to :medium_format,
|
8
|
+
# class_name: "MediumFormat",
|
9
|
+
# foreign_key: "format",
|
10
|
+
# optional: true
|
11
|
+
|
12
|
+
belongs_to :medium_release,
|
13
|
+
class_name: "Release",
|
14
|
+
foreign_key: "release",
|
15
|
+
optional: true
|
16
|
+
|
17
|
+
# has_many :alternative_media,
|
18
|
+
# class_name: "AlternativeMedium",
|
19
|
+
# foreign_key: "medium"
|
20
|
+
|
21
|
+
# has_many :medium_attributes,
|
22
|
+
# class_name: "MediumAttribute",
|
23
|
+
# foreign_key: "medium"
|
24
|
+
|
25
|
+
# has_many :medium_cdtocs,
|
26
|
+
# class_name: "MediumCdtoc",
|
27
|
+
# foreign_key: "medium"
|
28
|
+
|
29
|
+
# has_many :medium_indices,
|
30
|
+
# class_name: "MediumIndex",
|
31
|
+
# foreign_key: "medium"
|
32
|
+
|
33
|
+
has_many :tracks,
|
34
|
+
class_name: "Track",
|
35
|
+
foreign_key: "medium"
|
36
|
+
|
37
|
+
attribute :name
|
38
|
+
attribute :position, :integer
|
39
|
+
attribute :track_count, :integer
|
40
|
+
|
41
|
+
attribute :edits_pending, :integer
|
42
|
+
attribute :last_updated, :datetime
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# == Schema Information
|
47
|
+
#
|
48
|
+
# Table name: medium
|
49
|
+
#
|
50
|
+
# id :integer not null, primary key
|
51
|
+
# edits_pending :integer default(0), not null
|
52
|
+
# format :integer
|
53
|
+
# last_updated :datetime
|
54
|
+
# name :string default(""), not null
|
55
|
+
# position :integer not null
|
56
|
+
# release :integer not null
|
57
|
+
# track_count :integer default(0), not null
|
58
|
+
#
|
59
|
+
# Indexes
|
60
|
+
#
|
61
|
+
# medium_idx_release_position (release,position)
|
62
|
+
# medium_idx_track_count (track_count)
|
63
|
+
#
|
64
|
+
# Foreign Keys
|
65
|
+
#
|
66
|
+
# medium_fk_format (format => medium_format.id)
|
67
|
+
# medium_fk_release (release => release.id)
|
68
|
+
#
|
@@ -0,0 +1,97 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActiveBrainz
|
4
|
+
class Place < Base
|
5
|
+
self.table_name = "place"
|
6
|
+
|
7
|
+
include HasGID
|
8
|
+
include HasBeginEndDate
|
9
|
+
|
10
|
+
# has_many :edit_places,
|
11
|
+
# class_name: "EditPlace",
|
12
|
+
# foreign_key: "place"
|
13
|
+
|
14
|
+
# has_many :editor_collection_places,
|
15
|
+
# class_name: "EditorCollectionPlace",
|
16
|
+
# foreign_key: "place"
|
17
|
+
|
18
|
+
has_many :place_aliases,
|
19
|
+
class_name: "PlaceAlias",
|
20
|
+
foreign_key: "place"
|
21
|
+
|
22
|
+
# has_many :place_annotations,
|
23
|
+
# class_name: "PlaceAnnotation",
|
24
|
+
# foreign_key: "place"
|
25
|
+
|
26
|
+
belongs_to :place_area,
|
27
|
+
class_name: "Area",
|
28
|
+
foreign_key: "area",
|
29
|
+
optional: true
|
30
|
+
|
31
|
+
# has_many :place_attributes,
|
32
|
+
# class_name: "PlaceAttribute",
|
33
|
+
# foreign_key: "place"
|
34
|
+
|
35
|
+
# has_many :place_gid_redirects,
|
36
|
+
# class_name: "PlaceGIDRedirect",
|
37
|
+
# foreign_key: "new_id"
|
38
|
+
|
39
|
+
# has_many :place_tag_raws,
|
40
|
+
# class_name: "PlaceTagRaw",
|
41
|
+
# foreign_key: "place"
|
42
|
+
|
43
|
+
# has_many :place_tags,
|
44
|
+
# class_name: "PlaceTag",
|
45
|
+
# foreign_key: "place"
|
46
|
+
|
47
|
+
belongs_to :place_type,
|
48
|
+
class_name: "PlaceType",
|
49
|
+
foreign_key: "type",
|
50
|
+
optional: true
|
51
|
+
|
52
|
+
attribute :name
|
53
|
+
attribute :comment
|
54
|
+
|
55
|
+
attribute :coordinates, :point
|
56
|
+
attribute :address
|
57
|
+
|
58
|
+
attribute :edits_pending, :integer
|
59
|
+
attribute :last_updated, :datetime
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
# == Schema Information
|
64
|
+
#
|
65
|
+
# Table name: place
|
66
|
+
#
|
67
|
+
# id :integer not null, primary key
|
68
|
+
# address :string default(""), not null
|
69
|
+
# area :integer
|
70
|
+
# begin_date_day :integer
|
71
|
+
# begin_date_month :integer
|
72
|
+
# begin_date_year :integer
|
73
|
+
# comment :string(255) default(""), not null
|
74
|
+
# coordinates :point
|
75
|
+
# edits_pending :integer default(0), not null
|
76
|
+
# end_date_day :integer
|
77
|
+
# end_date_month :integer
|
78
|
+
# end_date_year :integer
|
79
|
+
# ended :boolean default(FALSE), not null
|
80
|
+
# gid :uuid not null
|
81
|
+
# last_updated :datetime
|
82
|
+
# name :string not null
|
83
|
+
# type :integer
|
84
|
+
#
|
85
|
+
# Indexes
|
86
|
+
#
|
87
|
+
# place_idx_area (area)
|
88
|
+
# place_idx_geo (ll_to_earth(coordinates[0], coordinates[1])) WHERE (coordinates IS NOT NULL) USING gist
|
89
|
+
# place_idx_gid (gid) UNIQUE
|
90
|
+
# place_idx_name (name)
|
91
|
+
# place_idx_name_txt (mb_simple_tsvector((name)::text)) USING gin
|
92
|
+
#
|
93
|
+
# Foreign Keys
|
94
|
+
#
|
95
|
+
# place_fk_area (area => area.id)
|
96
|
+
# place_fk_type (type => place_type.id)
|
97
|
+
#
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActiveBrainz
|
4
|
+
class PlaceAlias < Base
|
5
|
+
self.table_name = "place_alias"
|
6
|
+
|
7
|
+
include HasBeginEndDate
|
8
|
+
|
9
|
+
belongs_to :place_alias_place,
|
10
|
+
class_name: "Place",
|
11
|
+
foreign_key: "place",
|
12
|
+
optional: true
|
13
|
+
|
14
|
+
belongs_to :place_alias_type,
|
15
|
+
class_name: "PlaceAliasType",
|
16
|
+
foreign_key: "type",
|
17
|
+
optional: true
|
18
|
+
|
19
|
+
attribute :name
|
20
|
+
attribute :sort_name
|
21
|
+
|
22
|
+
attribute :locale
|
23
|
+
attribute :primary_for_locale, :boolean
|
24
|
+
|
25
|
+
attribute :edits_pending, :integer
|
26
|
+
attribute :last_updated, :datetime
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
# == Schema Information
|
31
|
+
#
|
32
|
+
# Table name: place_alias
|
33
|
+
#
|
34
|
+
# id :integer not null, primary key
|
35
|
+
# begin_date_day :integer
|
36
|
+
# begin_date_month :integer
|
37
|
+
# begin_date_year :integer
|
38
|
+
# edits_pending :integer default(0), not null
|
39
|
+
# end_date_day :integer
|
40
|
+
# end_date_month :integer
|
41
|
+
# end_date_year :integer
|
42
|
+
# ended :boolean default(FALSE), not null
|
43
|
+
# last_updated :datetime
|
44
|
+
# locale :text
|
45
|
+
# name :string not null
|
46
|
+
# place :integer not null
|
47
|
+
# primary_for_locale :boolean default(FALSE), not null
|
48
|
+
# sort_name :string not null
|
49
|
+
# type :integer
|
50
|
+
#
|
51
|
+
# Indexes
|
52
|
+
#
|
53
|
+
# place_alias_idx_place (place)
|
54
|
+
# place_alias_idx_primary (place,locale) UNIQUE WHERE ((primary_for_locale = true) AND (locale IS NOT NULL))
|
55
|
+
# place_alias_idx_txt (mb_simple_tsvector((name)::text)) USING gin
|
56
|
+
# place_alias_idx_txt_sort (mb_simple_tsvector((sort_name)::text)) USING gin
|
57
|
+
#
|
58
|
+
# Foreign Keys
|
59
|
+
#
|
60
|
+
# place_alias_fk_place (place => place.id)
|
61
|
+
# place_alias_fk_type (type => place_alias_type.id)
|
62
|
+
#
|