active_brainz 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/LICENSE.md +21 -0
  4. data/README.md +83 -0
  5. data/config/inflections.rb +9 -0
  6. data/lib/active_brainz.rb +36 -0
  7. data/lib/active_brainz/models/area/area.rb +123 -0
  8. data/lib/active_brainz/models/area/area_type.rb +37 -0
  9. data/lib/active_brainz/models/artist/artist.rb +150 -0
  10. data/lib/active_brainz/models/artist/artist_alias.rb +62 -0
  11. data/lib/active_brainz/models/artist/artist_alias_type.rb +37 -0
  12. data/lib/active_brainz/models/artist/artist_credit.rb +60 -0
  13. data/lib/active_brainz/models/artist/artist_credit_name.rb +46 -0
  14. data/lib/active_brainz/models/artist/artist_type.rb +37 -0
  15. data/lib/active_brainz/models/base.rb +16 -0
  16. data/lib/active_brainz/models/concerns/has_begin_end_date.rb +27 -0
  17. data/lib/active_brainz/models/concerns/has_gid.rb +15 -0
  18. data/lib/active_brainz/models/concerns/has_parent_children.rb +20 -0
  19. data/lib/active_brainz/models/gender/gender.rb +41 -0
  20. data/lib/active_brainz/models/genre/genre.rb +36 -0
  21. data/lib/active_brainz/models/genre/genre_alias.rb +42 -0
  22. data/lib/active_brainz/models/label/label.rb +121 -0
  23. data/lib/active_brainz/models/label/label_alias.rb +62 -0
  24. data/lib/active_brainz/models/label/label_alias_type.rb +37 -0
  25. data/lib/active_brainz/models/label/label_type.rb +37 -0
  26. data/lib/active_brainz/models/medium/medium.rb +68 -0
  27. data/lib/active_brainz/models/place/place.rb +97 -0
  28. data/lib/active_brainz/models/place/place_alias.rb +62 -0
  29. data/lib/active_brainz/models/place/place_alias_type.rb +37 -0
  30. data/lib/active_brainz/models/place/place_type.rb +37 -0
  31. data/lib/active_brainz/models/recording/recording.rb +101 -0
  32. data/lib/active_brainz/models/release/release.rb +150 -0
  33. data/lib/active_brainz/models/release/release_group.rb +100 -0
  34. data/lib/active_brainz/models/track/track.rb +72 -0
  35. data/lib/active_brainz/version.rb +24 -0
  36. metadata +372 -0
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActiveBrainz
4
+ class PlaceAliasType < Base
5
+ self.table_name = "place_alias_type"
6
+
7
+ include HasGID
8
+ include HasParentChildren
9
+
10
+ has_many :place_aliases,
11
+ class_name: "PlaceAlias",
12
+ foreign_key: "type"
13
+
14
+ attribute :name
15
+ attribute :description
16
+ end
17
+ end
18
+
19
+ # == Schema Information
20
+ #
21
+ # Table name: place_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
+ # place_alias_type_idx_gid (gid) UNIQUE
33
+ #
34
+ # Foreign Keys
35
+ #
36
+ # place_alias_type_fk_parent (parent => place_alias_type.id)
37
+ #
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActiveBrainz
4
+ class PlaceType < Base
5
+ self.table_name = "place_type"
6
+
7
+ include HasGID
8
+ include HasParentChildren
9
+
10
+ has_many :places,
11
+ class_name: "Place",
12
+ foreign_key: "type"
13
+
14
+ attribute :name
15
+ attribute :description
16
+ end
17
+ end
18
+
19
+ # == Schema Information
20
+ #
21
+ # Table name: place_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
+ # place_type_idx_gid (gid) UNIQUE
33
+ #
34
+ # Foreign Keys
35
+ #
36
+ # place_type_fk_parent (parent => place_type.id)
37
+ #
@@ -0,0 +1,101 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActiveBrainz
4
+ class Recording < Base
5
+ self.table_name = "recording"
6
+
7
+ include HasGID
8
+
9
+ belongs_to :recording_artist_credit,
10
+ class_name: "ArtistCredit",
11
+ foreign_key: "artist_credit",
12
+ optional: true
13
+
14
+ # has_many :edit_recordings,
15
+ # class_name: "EditRecording",
16
+ # foreign_key: "recording"
17
+
18
+ # has_many :editor_collection_recordings,
19
+ # class_name: "EditorCollectionRecording",
20
+ # foreign_key: "recording"
21
+
22
+ # has_many :isrcs,
23
+ # class_name: "Isrc",
24
+ # foreign_key: "recording"
25
+
26
+ # has_many :recording_aliases,
27
+ # class_name: "RecordingAlias",
28
+ # foreign_key: "recording"
29
+
30
+ # has_many :recording_annotations,
31
+ # class_name: "RecordingAnnotation",
32
+ # foreign_key: "recording"
33
+
34
+ # has_many :recording_attributes,
35
+ # class_name: "RecordingAttribute",
36
+ # foreign_key: "recording"
37
+
38
+ # has_many :recording_first_release_dates,
39
+ # class_name: "RecordingFirstReleaseDate",
40
+ # foreign_key: "recording"
41
+
42
+ # has_many :recording_gid_redirects,
43
+ # class_name: "RecordingGIDRedirect",
44
+ # foreign_key: "new_id"
45
+
46
+ # has_many :recording_meta,
47
+ # class_name: "RecordingMeta",
48
+ # foreign_key: "id"
49
+
50
+ # has_many :recording_rating_raws,
51
+ # class_name: "RecordingRatingRaw",
52
+ # foreign_key: "recording"
53
+
54
+ # has_many :recording_tag_raws,
55
+ # class_name: "RecordingTagRaw",
56
+ # foreign_key: "recording"
57
+
58
+ # has_many :recording_tags,
59
+ # class_name: "RecordingTag",
60
+ # foreign_key: "recording"
61
+
62
+ has_many :tracks,
63
+ class_name: "Track",
64
+ foreign_key: "recording"
65
+
66
+ attribute :name
67
+ attribute :comment
68
+ attribute :length, :integer
69
+ attribute :video, :boolean
70
+
71
+ attribute :edits_pending, :integer
72
+ attribute :last_updated, :datetime
73
+ end
74
+ end
75
+
76
+ # == Schema Information
77
+ #
78
+ # Table name: recording
79
+ #
80
+ # id :integer not null, primary key
81
+ # artist_credit :integer not null
82
+ # comment :string(255) default(""), not null
83
+ # edits_pending :integer default(0), not null
84
+ # gid :uuid not null
85
+ # last_updated :datetime
86
+ # length :integer
87
+ # name :string not null
88
+ # video :boolean default(FALSE), not null
89
+ #
90
+ # Indexes
91
+ #
92
+ # recording_idx_artist_credit (artist_credit)
93
+ # recording_idx_gid (gid) UNIQUE
94
+ # recording_idx_musicbrainz_collate (name)
95
+ # recording_idx_name (name)
96
+ # recording_idx_txt (mb_simple_tsvector((name)::text)) USING gin
97
+ #
98
+ # Foreign Keys
99
+ #
100
+ # recording_fk_artist_credit (artist_credit => artist_credit.id)
101
+ #
@@ -0,0 +1,150 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActiveBrainz
4
+ class Release < Base
5
+ self.table_name = "release"
6
+
7
+ include HasGID
8
+
9
+ belongs_to :release_artist_credit,
10
+ class_name: "ArtistCredit",
11
+ foreign_key: "artist_credit",
12
+ optional: true
13
+
14
+ # belongs_to :release_language,
15
+ # class_name: "Language",
16
+ # foreign_key: "language",
17
+ # optional: true
18
+
19
+ # belongs_to :release_packaging,
20
+ # class_name: "ReleasePackaging",
21
+ # foreign_key: "packaging",
22
+ # optional: true
23
+
24
+ belongs_to :release_release_group,
25
+ class_name: "ReleaseGroup",
26
+ foreign_key: "release_group",
27
+ optional: true
28
+
29
+ # belongs_to :release_script,
30
+ # class_name: "Script",
31
+ # foreign_key: "script",
32
+ # optional: true
33
+
34
+ # belongs_to :release_status,
35
+ # class_name: "ReleaseStatus",
36
+ # foreign_key: "status",
37
+ # optional: true
38
+
39
+ # has_many :alternative_releases,
40
+ # class_name: "AlternativeRelease",
41
+ # foreign_key: "release"
42
+
43
+ # has_many :edit_releases,
44
+ # class_name: "EditRelease",
45
+ # foreign_key: "release"
46
+
47
+ # has_many :editor_collection_releases,
48
+ # class_name: "EditorCollectionRelease",
49
+ # foreign_key: "release"
50
+
51
+ has_many :media,
52
+ class_name: "Medium",
53
+ foreign_key: "release"
54
+
55
+ # has_many :release_aliases,
56
+ # class_name: "ReleaseAlias",
57
+ # foreign_key: "release"
58
+
59
+ # has_many :release_annotations,
60
+ # class_name: "ReleaseAnnotation",
61
+ # foreign_key: "release"
62
+
63
+ # has_many :release_attributes,
64
+ # class_name: "ReleaseAttribute",
65
+ # foreign_key: "release"
66
+
67
+ # has_many :release_countries,
68
+ # class_name: "ReleaseCountry",
69
+ # foreign_key: "release"
70
+
71
+ # has_many :release_coverarts,
72
+ # class_name: "ReleaseCoverart",
73
+ # foreign_key: "id"
74
+
75
+ # has_many :release_first_release_dates,
76
+ # class_name: "ReleaseFirstReleaseDate",
77
+ # foreign_key: "release"
78
+
79
+ # has_many :release_gid_redirects,
80
+ # class_name: "ReleaseGIDRedirect",
81
+ # foreign_key: "new_id"
82
+
83
+ # has_many :release_labels,
84
+ # class_name: "ReleaseLabel",
85
+ # foreign_key: "release"
86
+
87
+ # has_many :release_meta,
88
+ # class_name: "ReleaseMeta",
89
+ # foreign_key: "id"
90
+
91
+ # has_many :release_tag_raws,
92
+ # class_name: "ReleaseTagRaw",
93
+ # foreign_key: "release"
94
+
95
+ # has_many :release_tags,
96
+ # class_name: "ReleaseTag",
97
+ # foreign_key: "release"
98
+
99
+ # has_many :release_unknown_countries,
100
+ # class_name: "ReleaseUnknownCountry",
101
+ # foreign_key: "release"
102
+
103
+ attribute :name
104
+ attribute :comment
105
+
106
+ attribute :barcode
107
+
108
+ attribute :quality, :integer
109
+ attribute :edits_pending, :integer
110
+ attribute :last_updated, :datetime
111
+ end
112
+ end
113
+
114
+ # == Schema Information
115
+ #
116
+ # Table name: release
117
+ #
118
+ # id :integer not null, primary key
119
+ # artist_credit :integer not null
120
+ # barcode :string(255)
121
+ # comment :string(255) default(""), not null
122
+ # edits_pending :integer default(0), not null
123
+ # gid :uuid not null
124
+ # language :integer
125
+ # last_updated :datetime
126
+ # name :string not null
127
+ # packaging :integer
128
+ # quality :integer default(-1), not null
129
+ # release_group :integer not null
130
+ # script :integer
131
+ # status :integer
132
+ #
133
+ # Indexes
134
+ #
135
+ # release_idx_artist_credit (artist_credit)
136
+ # release_idx_gid (gid) UNIQUE
137
+ # release_idx_musicbrainz_collate (name)
138
+ # release_idx_name (name)
139
+ # release_idx_release_group (release_group)
140
+ # release_idx_txt (mb_simple_tsvector((name)::text)) USING gin
141
+ #
142
+ # Foreign Keys
143
+ #
144
+ # release_fk_artist_credit (artist_credit => artist_credit.id)
145
+ # release_fk_language (language => language.id)
146
+ # release_fk_packaging (packaging => release_packaging.id)
147
+ # release_fk_release_group (release_group => release_group.id)
148
+ # release_fk_script (script => script.id)
149
+ # release_fk_status (status => release_status.id)
150
+ #
@@ -0,0 +1,100 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActiveBrainz
4
+ class ReleaseGroup < Base
5
+ self.table_name = "release_group"
6
+
7
+ include HasGID
8
+
9
+ belongs_to :release_group_artist_credit,
10
+ class_name: "ArtistCredit",
11
+ foreign_key: "artist_credit",
12
+ optional: true
13
+
14
+ # belongs_to :release_group_primary_type,
15
+ # class_name: "ReleaseGroupPrimaryType",
16
+ # foreign_key: "type",
17
+ # optional: true
18
+
19
+ # has_many :edit_release_groups,
20
+ # class_name: "EditReleaseGroup",
21
+ # foreign_key: "release_group"
22
+
23
+ # has_many :editor_collection_release_groups,
24
+ # class_name: "EditorCollectionReleaseGroup",
25
+ # foreign_key: "release_group"
26
+
27
+ # has_many :release_group_aliases,
28
+ # class_name: "ReleaseGroupAlias",
29
+ # foreign_key: "release_group"
30
+
31
+ # has_many :release_group_annotations,
32
+ # class_name: "ReleaseGroupAnnotation",
33
+ # foreign_key: "release_group"
34
+
35
+ # has_many :release_group_attributes,
36
+ # class_name: "ReleaseGroupAttribute",
37
+ # foreign_key: "release_group"
38
+
39
+ # has_many :release_group_gid_redirects,
40
+ # class_name: "ReleaseGroupGIDRedirect",
41
+ # foreign_key: "new_id"
42
+
43
+ # has_many :release_group_meta,
44
+ # class_name: "ReleaseGroupMeta",
45
+ # foreign_key: "id"
46
+
47
+ # has_many :release_group_rating_raws,
48
+ # class_name: "ReleaseGroupRatingRaw",
49
+ # foreign_key: "release_group"
50
+
51
+ # has_many :release_group_secondary_type_joins,
52
+ # class_name: "ReleaseGroupSecondaryTypeJoin",
53
+ # foreign_key: "release_group"
54
+
55
+ # has_many :release_group_tag_raws,
56
+ # class_name: "ReleaseGroupTagRaw",
57
+ # foreign_key: "release_group"
58
+
59
+ # has_many :release_group_tags,
60
+ # class_name: "ReleaseGroupTag",
61
+ # foreign_key: "release_group"
62
+
63
+ has_many :releases,
64
+ class_name: "Release",
65
+ foreign_key: "release_group"
66
+
67
+ attribute :name
68
+ attribute :comment
69
+
70
+ attribute :edits_pending, :integer
71
+ attribute :last_updated, :datetime
72
+ end
73
+ end
74
+
75
+ # == Schema Information
76
+ #
77
+ # Table name: release_group
78
+ #
79
+ # id :integer not null, primary key
80
+ # artist_credit :integer not null
81
+ # comment :string(255) default(""), not null
82
+ # edits_pending :integer default(0), not null
83
+ # gid :uuid not null
84
+ # last_updated :datetime
85
+ # name :string not null
86
+ # type :integer
87
+ #
88
+ # Indexes
89
+ #
90
+ # release_group_idx_artist_credit (artist_credit)
91
+ # release_group_idx_gid (gid) UNIQUE
92
+ # release_group_idx_musicbrainz_collate (name)
93
+ # release_group_idx_name (name)
94
+ # release_group_idx_txt (mb_simple_tsvector((name)::text)) USING gin
95
+ #
96
+ # Foreign Keys
97
+ #
98
+ # release_group_fk_artist_credit (artist_credit => artist_credit.id)
99
+ # release_group_fk_type (type => release_group_primary_type.id)
100
+ #
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActiveBrainz
4
+ class Track < Base
5
+ self.table_name = "track"
6
+
7
+ include HasGID
8
+
9
+ belongs_to :track_artist_credit,
10
+ class_name: "ArtistCredit",
11
+ foreign_key: "artist_credit",
12
+ optional: true
13
+
14
+ belongs_to :track_medium,
15
+ class_name: "Medium",
16
+ foreign_key: "medium",
17
+ optional: true
18
+
19
+ belongs_to :track_recording,
20
+ class_name: "Recording",
21
+ foreign_key: "recording",
22
+ optional: true
23
+
24
+ # has_many :alternative_medium_tracks,
25
+ # class_name: "AlternativeMediumTrack",
26
+ # foreign_key: "track"
27
+
28
+ # has_many :track_gid_redirects,
29
+ # class_name: "TrackGIDRedirect",
30
+ # foreign_key: "new_id"
31
+
32
+ attribute :name
33
+ attribute :number
34
+ attribute :length, :integer
35
+ attribute :position, :integer
36
+ attribute :is_data_track, :boolean
37
+
38
+ attribute :edits_pending, :integer
39
+ attribute :last_updated, :datetime
40
+ end
41
+ end
42
+
43
+ # == Schema Information
44
+ #
45
+ # Table name: track
46
+ #
47
+ # id :integer not null, primary key
48
+ # artist_credit :integer not null
49
+ # edits_pending :integer default(0), not null
50
+ # gid :uuid not null
51
+ # is_data_track :boolean default(FALSE), not null
52
+ # last_updated :datetime
53
+ # length :integer
54
+ # medium :integer not null
55
+ # name :string not null
56
+ # number :text not null
57
+ # position :integer not null
58
+ # recording :integer not null
59
+ #
60
+ # Indexes
61
+ #
62
+ # track_idx_artist_credit (artist_credit)
63
+ # track_idx_gid (gid) UNIQUE
64
+ # track_idx_medium_position (medium,position)
65
+ # track_idx_recording (recording)
66
+ #
67
+ # Foreign Keys
68
+ #
69
+ # track_fk_artist_credit (artist_credit => artist_credit.id)
70
+ # track_fk_medium (medium => medium.id)
71
+ # track_fk_recording (recording => recording.id)
72
+ #