rbrainz 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. data/CHANGES +31 -0
  2. data/LICENSE +1 -1
  3. data/README +3 -2
  4. data/Rakefile +40 -22
  5. data/TODO +6 -23
  6. data/doc/README.rdoc +50 -21
  7. data/examples/getartist.rb +6 -4
  8. data/examples/getuser.rb +30 -0
  9. data/examples/searchartists.rb +35 -0
  10. data/lib/rbrainz.rb +12 -7
  11. data/lib/rbrainz/core_ext.rb +8 -0
  12. data/lib/rbrainz/core_ext/mbid.rb +30 -0
  13. data/lib/rbrainz/core_ext/net_http_digest.rb +52 -0
  14. data/lib/rbrainz/core_ext/range.rb +28 -0
  15. data/lib/rbrainz/core_ext/range/equality.rb +232 -0
  16. data/lib/rbrainz/data/countrynames.rb +7 -5
  17. data/lib/rbrainz/data/languagenames.rb +8 -5
  18. data/lib/rbrainz/data/releasetypenames.rb +34 -0
  19. data/lib/rbrainz/data/scriptnames.rb +8 -5
  20. data/lib/rbrainz/model.rb +27 -35
  21. data/lib/rbrainz/model/alias.rb +31 -7
  22. data/lib/rbrainz/model/artist.rb +30 -41
  23. data/lib/rbrainz/model/collection.rb +102 -0
  24. data/lib/rbrainz/model/default_factory.rb +78 -0
  25. data/lib/rbrainz/model/disc.rb +45 -8
  26. data/lib/rbrainz/model/entity.rb +122 -53
  27. data/lib/rbrainz/model/incomplete_date.rb +31 -47
  28. data/lib/rbrainz/model/individual.rb +103 -0
  29. data/lib/rbrainz/model/label.rb +42 -33
  30. data/lib/rbrainz/model/mbid.rb +111 -40
  31. data/lib/rbrainz/model/relation.rb +78 -14
  32. data/lib/rbrainz/model/release.rb +119 -31
  33. data/lib/rbrainz/model/release_event.rb +38 -9
  34. data/lib/rbrainz/model/scored_collection.rb +99 -0
  35. data/lib/rbrainz/model/tag.rb +39 -0
  36. data/lib/rbrainz/model/track.rb +37 -13
  37. data/lib/rbrainz/model/user.rb +48 -0
  38. data/lib/rbrainz/utils.rb +9 -0
  39. data/lib/rbrainz/utils/data.rb +78 -0
  40. data/lib/rbrainz/utils/helper.rb +22 -0
  41. data/lib/rbrainz/version.rb +15 -0
  42. data/lib/rbrainz/webservice.rb +32 -6
  43. data/lib/rbrainz/webservice/filter.rb +124 -47
  44. data/lib/rbrainz/webservice/includes.rb +49 -10
  45. data/lib/rbrainz/webservice/mbxml.rb +228 -173
  46. data/lib/rbrainz/webservice/query.rb +312 -25
  47. data/lib/rbrainz/webservice/webservice.rb +164 -27
  48. data/test/lib/mock_webservice.rb +53 -0
  49. data/test/lib/test_entity.rb +27 -8
  50. data/test/lib/test_factory.rb +47 -0
  51. data/test/lib/testing_helper.rb +7 -5
  52. data/test/test-data/invalid/artist/tags_1.xml +6 -0
  53. data/test/test-data/valid/artist/Tchaikovsky-2.xml +12 -0
  54. data/test/test-data/valid/label/Atlantic_Records_2.xml +3 -0
  55. data/test/test-data/valid/label/Atlantic_Records_3.xml +11 -0
  56. data/test/test-data/valid/release/Highway_61_Revisited_2.xml +12 -0
  57. data/test/test-data/valid/track/Silent_All_These_Years_6.xml +8 -0
  58. data/test/test_alias.rb +13 -7
  59. data/test/test_artist.rb +26 -4
  60. data/test/test_artist_filter.rb +11 -6
  61. data/test/test_artist_includes.rb +11 -6
  62. data/test/test_collection.rb +66 -0
  63. data/test/test_default_factory.rb +75 -0
  64. data/test/test_disc.rb +9 -4
  65. data/test/test_incomplete_date.rb +21 -14
  66. data/test/test_label.rb +56 -18
  67. data/test/test_label_filter.rb +10 -5
  68. data/test/test_label_includes.rb +11 -6
  69. data/test/test_mbid.rb +34 -19
  70. data/test/test_mbxml.rb +242 -72
  71. data/test/test_query.rb +92 -7
  72. data/test/test_range_equality.rb +144 -0
  73. data/test/test_relation.rb +18 -7
  74. data/test/test_release.rb +15 -4
  75. data/test/test_release_event.rb +16 -4
  76. data/test/test_release_filter.rb +11 -5
  77. data/test/test_release_includes.rb +11 -6
  78. data/test/test_scored_collection.rb +86 -0
  79. data/test/test_tag.rb +39 -0
  80. data/test/test_track.rb +15 -4
  81. data/test/test_track_filter.rb +11 -5
  82. data/test/test_track_includes.rb +11 -6
  83. data/test/test_utils.rb +41 -0
  84. data/test/test_webservice.rb +16 -17
  85. metadata +93 -57
@@ -1,61 +1,83 @@
1
- # $Id: entity.rb 30 2007-05-29 02:12:33Z phw $
2
- # Copyright (c) 2007, Philipp Wolfer
3
- # All rights reserved.
4
- # See LICENSE for permissions.
1
+ # $Id: entity.rb 145 2007-07-19 13:11:44Z phw $
2
+ #
3
+ # Author:: Philipp Wolfer (mailto:phw@rubyforge.org)
4
+ # Copyright:: Copyright (c) 2007, Nigel Graham, Philipp Wolfer
5
+ # License:: RBrainz is free software distributed under a BSD style license.
6
+ # See LICENSE[file:../LICENSE.html] for permissions.
5
7
 
6
8
  require 'rbrainz/model/mbid'
7
9
  require 'rbrainz/model/relation'
10
+ require 'rbrainz/model/collection'
11
+ require 'rbrainz/model/tag'
12
+ require 'set'
8
13
 
9
14
  module MusicBrainz
10
15
  module Model
11
16
 
12
- # Superclass for all entities.
17
+ #
18
+ # A first-level MusicBrainz class.
19
+ #
20
+ # All entities in MusicBrainz have unique IDs (which are MBID's representing
21
+ # absolute URIs) and may have any number of #relations to other entities.
22
+ # This class is abstract and should not be instantiated.
23
+ #
24
+ # Relations are differentiated by their <i>target type</i>, that means,
25
+ # where they link to. MusicBrainz currently supports four target types
26
+ # (artists, releases, tracks, and URLs) each identified using a URI.
27
+ # To get all relations with a specific target type, you can use
28
+ # #relations and pass one of the following constants as the
29
+ # parameter:
30
+ #
31
+ # - Relation::TO_ARTIST
32
+ # - Relation::TO_RELEASE
33
+ # - Relation::TO_TRACK
34
+ # - Relation::TO_URL
35
+ #
36
+ # See:: Relation
37
+ #
13
38
  class Entity
14
-
39
+
40
+ # The entity type of this entity. Must be set by child classes correctly.
41
+ #
42
+ # Use #entity_type to query the type.
43
+ ENTITY_TYPE = nil # :nodoc:
44
+
45
+ # The MusicBrainz ID. A MBID containing an absolute URI.
15
46
  attr_reader :id
16
47
 
17
- def initialize
48
+ # A Collection of Tag objects assigned to this entity.
49
+ attr_reader :tags
50
+
51
+ # Create a new Entity. You can assign a MusicBrainz identifier to the
52
+ # created entity with the parameter _mbid_ (see id=).
53
+ def initialize(mbid=nil)
54
+ self.id = mbid
55
+ @tags = Collection.new
18
56
  @relations = {
19
- Relation::TO_ARTIST => Array.new,
20
- Relation::TO_RELEASE => Array.new,
21
- Relation::TO_TRACK => Array.new,
22
- Relation::TO_LABEL => Array.new,
23
- Relation::TO_URL => Array.new,
57
+ Relation::TO_ARTIST => Collection.new,
58
+ Relation::TO_RELEASE => Collection.new,
59
+ Relation::TO_TRACK => Collection.new,
60
+ Relation::TO_LABEL => Collection.new,
61
+ Relation::TO_URL => Collection.new,
24
62
  }
25
63
  end
26
64
 
27
65
  # Set the MBID.
28
66
  #
29
- # +mbid+ should be an instance of +MBID+ or a string
67
+ # _mbid_ should be an instance of MBID or a string
30
68
  # representing either a complete MBID URI or just the
31
69
  # UUID part of it. If it is a complete URI the entity
32
70
  # part of the URI must match the entity type returned
33
- # by +entity_type+ or an +EntityTypeNotMatchingError+
71
+ # by +entity_type+ or an EntityTypeNotMatchingError
34
72
  # will be raised.
35
73
  #
36
- # Raises: +UnknownEntityError+, +InvalidUUIDError+,
37
- # +EntityTypeNotMatchingError+
74
+ # Raises: UnknownEntityError, InvalidMBIDError,
75
+ # EntityTypeNotMatchingError
38
76
  def id=(mbid)
39
- # If this already is an instance of MBID store it directly.
40
- if mbid.is_a? MBID
41
- @id = mbid
42
- elsif mbid.nil?
43
- @id = nil
77
+ if mbid
78
+ @id = MBID.parse(mbid, entity_type)
44
79
  else
45
- # Try to create an MBID from URI
46
- begin
47
- @id = MBID.from_uri(mbid)
48
- rescue InvalidMBIDError => e
49
- # Try it again and use mbid as the UUID
50
- @id = MBID.from_uuid(self.entity_type, mbid)
51
- end
52
- end
53
-
54
- # Check if the entity type of @id matches that of the current object.
55
- unless @id.nil? or @id.entity == self.entity_type
56
- exception = EntityTypeNotMatchingError.new(@id.entity.to_s)
57
80
  @id = nil
58
- raise exception
59
81
  end
60
82
  end
61
83
 
@@ -64,7 +86,7 @@ module MusicBrainz
64
86
  # Depending on the class this is <tt>:artist</tt>, <tt>:release</tt>,
65
87
  # <tt>:track</tt> or <tt>:label</tt>.
66
88
  def self.entity_type
67
- self.name.sub('MusicBrainz::Model::', '').downcase.to_sym
89
+ self::ENTITY_TYPE
68
90
  end
69
91
 
70
92
  # Returns the entity type of the instance.
@@ -75,36 +97,83 @@ module MusicBrainz
75
97
  self.class.entity_type
76
98
  end
77
99
 
78
- # Add a relation to this entity.
100
+ #
101
+ # Adds a relation.
102
+ #
103
+ # This method adds _relation_ to the list of relations. The
104
+ # given relation has to be initialized, at least the target
105
+ # type has to be set.
106
+ #
79
107
  def add_relation(relation)
80
108
  @relations[relation.target_type] << relation
81
109
  end
82
110
 
83
- # Returns the relations of this entity.
111
+ #
112
+ # Returns a list of relations.
113
+ #
114
+ # If _target_type_ is given, only relations of that target
115
+ # type are returned. For MusicBrainz, the following target
116
+ # types are defined:
117
+ # - Relation::TO_ARTIST
118
+ # - Relation::TO_RELEASE
119
+ # - Relation::TO_TRACK
120
+ # - Relation::TO_URL
121
+ #
122
+ # If _target_type_ is Relation::TO_ARTIST, for example,
123
+ # this method returns all relations between this Entity and
124
+ # artists.
125
+ #
126
+ # You may use the _relation_type_ parameter to further restrict
127
+ # the selection. If it is set, only relations with the given
128
+ # relation type are returned. The _required_attributes_ sequence
129
+ # lists attributes that have to be part of all returned relations.
130
+ #
131
+ # If _direction_ is set, only relations with the given reading
132
+ # direction are returned. You can use the Relation::DIR_FORWARD,
133
+ # Relation::DIR_BACKWARD, and Relation::DIR_BOTH constants
134
+ # for this.
135
+ #
84
136
  def get_relations(options = {:target_type => nil, :relation_type => nil,
85
137
  :required_attributes => [], :direction => nil})
86
- # Select all results depending on the requested target type
87
- if options[:target_type]
88
- result = @relations[options[:target_type]]
138
+ Utils.check_options options,
139
+ :target_type, :relation_type, :required_attributes, :direction
140
+ target_type = options[:target_type]
141
+ relation_type = options[:relation_type]
142
+ required_attributes =
143
+ options[:required_attributes] ? options[:required_attributes] : []
144
+ direction = options[:direction]
145
+
146
+ # Select all relevant relations depending on the requested target type
147
+ if target_type
148
+ result = @relations[target_type].to_a
89
149
  else
90
- result = []
91
- @relations.each_value {|array| result += array}
150
+ result = @relations.values.flatten
92
151
  end
93
152
 
94
- # Remove relations which don't meet all the criteria.
95
- result.delete_if {|relation|
96
- (options[:relation_type] and relation.type != options[:relation_type]) \
97
- or (options[:required_attributes] and
98
- (relation.attributes & options[:required_attributes]).sort \
99
- != options[:required_attributes].sort) \
100
- or (options[:direction] and relation.direction != options[:direction])
101
- }
153
+ # Filter for direction
154
+ #
155
+ result = result.find_all { |r| r.direction == direction } if direction
102
156
 
103
- return result
157
+ # Filter for relation type
158
+ #
159
+ result = result.find_all{ |r| r.type == relation_type } if relation_type
160
+
161
+ # Filter for attributes
162
+ #
163
+ required = required_attributes.to_set
164
+ result.find_all do |r|
165
+ required.subset?( r.attributes.to_set )
166
+ end
104
167
  end
105
168
 
106
- # Return all relation target types for which this entity
107
- # has relations defined.
169
+ #
170
+ # Returns a list of target types available for this entity.
171
+ #
172
+ # Use this to find out to which types of targets this entity
173
+ # has relations. If the entity only has relations to tracks and
174
+ # artists, for example, then a list containg the strings
175
+ # Relation::TO_TRACK and Relation::TO_ARTIST is returned.
176
+ #
108
177
  def relation_target_types
109
178
  result = []
110
179
  @relations.each_pair {|type, relations|
@@ -1,7 +1,9 @@
1
- # $Id: incomplete_date.rb 17 2007-05-23 16:51:11Z phw $
2
- # Copyright (c) 2007, Philipp Wolfer
3
- # All rights reserved.
4
- # See LICENSE for permissions.
1
+ # $Id: incomplete_date.rb 145 2007-07-19 13:11:44Z phw $
2
+ #
3
+ # Author:: Philipp Wolfer (mailto:phw@rubyforge.org)
4
+ # Copyright:: Copyright (c) 2007, Nigel Graham, Philipp Wolfer
5
+ # License:: RBrainz is free software distributed under a BSD style license.
6
+ # See LICENSE[file:../LICENSE.html] for permissions.
5
7
 
6
8
  require 'date'
7
9
 
@@ -12,28 +14,35 @@ module MusicBrainz
12
14
  # a date which can be defined without day or without
13
15
  # month and day. It can be written as <em>YYYY</em>,
14
16
  # <em>YYYY-MM</em> or <em>YYYY-MM-DD</em>.
15
- class IncompleteDate
16
-
17
+ class IncompleteDate < ::Range
17
18
  attr_reader :year, :month, :day
18
-
19
- # Include the Comparable module to make incomplete dates
20
- # comparable and sortable.
21
- include Comparable
22
-
23
- # TODO: Validation of the date
19
+
20
+ # Create a new IncompleteDate. The parameter _date_ must be a String in
21
+ # the form <em>YYYY</em>, <em>YYYY-MM</em> or <em>YYYY-MM-DD</em>.
24
22
  def initialize(date)
25
- @year = nil
26
- @month = nil
27
- @day = nil
28
- if date = date.to_s and date =~ /^\d{4}(-\d{2}){0,2}$/
29
- @year = date[0..3].to_i if date.size >= 4
30
- @month = date[5..6].to_i if date.size >= 7
31
- @day = date[8..9].to_i if date.size == 10
32
- elsif not date.empty?
33
- raise ArgumentError
23
+ date = date.to_s if date.respond_to? :to_s
24
+ if date =~ /^(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?$/
25
+ @year = $1.to_i
26
+ @month = $2 ? $2.to_i : nil
27
+ @day = $3 ? $3.to_i : nil
28
+ if @month
29
+ if @day
30
+ start_d = Date.civil( @year, @month, @day)
31
+ end_d = start_d.succ
32
+ else
33
+ start_d = Date.civil( @year, @month)
34
+ end_d = Date.civil( @year, @month+1)
35
+ end
36
+ else
37
+ start_d = Date.civil( @year)
38
+ end_d = Date.civil( @year+1)
39
+ end
40
+ super( start_d, end_d, true)
41
+ else
42
+ raise ArgumentError, "Invalid incomplete date #{date}"
34
43
  end
35
44
  end
36
-
45
+
37
46
  # Returns the incomplete date in its textual form
38
47
  # <em>YYYY</em>, <em>YYYY-MM</em> or <em>YYYY-MM-DD</em>.
39
48
  #
@@ -45,31 +54,6 @@ module MusicBrainz
45
54
  }
46
55
  return date
47
56
  end
48
-
49
- # Compare this incomplete date with another incomplete date.
50
- # If two incomplete dates are compared of which one date has
51
- # less information than the other only the information
52
- # present in both incomplete dates is used for comparison.
53
- # That means that the dates 1980-08-22, 1980-08 and 1980 are
54
- # all considered equal if compared to one another since it
55
- # can't be decided if e.g. the date 1980-08 is earlier or later
56
- # than 1980-08-22.
57
- #
58
- # As a consequence of this a list of +IncompleteDate+ objects
59
- # won't get sorted in the lexical order of their string
60
- # representations. If you need a lexical order you must convert
61
- # these objects to strings before ordering them.
62
- def <=>(other)
63
- result = self.year <=> other.year
64
- if result == 0 and self.month and other.month
65
- result = self.month <=> other.month
66
- if result == 0 and self.day and other.day
67
- result = self.day <=> other.day
68
- end
69
- end
70
- return result
71
- end
72
-
73
57
  end
74
58
 
75
59
  end
@@ -0,0 +1,103 @@
1
+ # $Id: individual.rb 145 2007-07-19 13:11:44Z phw $
2
+ #
3
+ # Author:: Philipp Wolfer (mailto:phw@rubyforge.org)
4
+ # Copyright:: Copyright (c) 2007, Nigel Graham, Philipp Wolfer
5
+ # License:: RBrainz is free software distributed under a BSD style license.
6
+ # See LICENSE[file:../LICENSE.html] for permissions.
7
+
8
+ require 'rbrainz/model/entity'
9
+ require 'rbrainz/model/incomplete_date'
10
+
11
+ module MusicBrainz
12
+ module Model
13
+
14
+ # Superclass for Artist and Label.
15
+ #
16
+ # Aggregates the common attributes of artists and labels.
17
+ class Individual < Entity
18
+
19
+ # The name of the artist or label.
20
+ attr_accessor :name
21
+
22
+ # Name used for sorting (e.g. "White Stripes, The").
23
+ attr_accessor :sort_name
24
+
25
+ # Field to distinguish between identically named artists or labels.
26
+ attr_accessor :disambiguation
27
+
28
+ # The type of this artist or label. See the constants defined in Artist
29
+ # and Label for a list of possible types.
30
+ attr_accessor :type
31
+
32
+ # Collection of alternate names, including possible typos.
33
+ attr_reader :aliases
34
+
35
+ # The begin date is interpreted differently for bands, individual artists
36
+ # and labels. For bands and labels this is the founding date, for
37
+ # individual artists it is the date of birth.
38
+ # The begin date is an instance of IncompleteDate.
39
+ attr_reader :begin_date
40
+
41
+ # The end date is interpreted differently for bands, individual artists
42
+ # and labels. For bands and labels this is the breakup date, for
43
+ # individual artists it is the date of death.
44
+ # The end date is an instance of IncompleteDate.
45
+ attr_reader :end_date
46
+
47
+ # A Collection of releases of this artist or label.
48
+ #
49
+ # This may also include releases where this artist isn't the
50
+ # <i>main</i> artist but has just contributed one or more tracks
51
+ # (aka VA-Releases).
52
+ attr_reader :releases
53
+
54
+ def initialize(id=nil, type=nil, name=nil, sort_name=nil)
55
+ super id
56
+ self.type = type
57
+ self.name = name
58
+ self.sort_name = sort_name
59
+ @aliases = Collection.new
60
+ @releases = Collection.new
61
+ end
62
+
63
+ # Set the begin date of this individual to _date_.
64
+ #
65
+ # Should be an IncompleteDate object or a date string, which will
66
+ # get converted into an IncompleteDate.
67
+ def begin_date=(date)
68
+ date = IncompleteDate.new date unless date.is_a? IncompleteDate
69
+ @begin_date = date
70
+ end
71
+
72
+ # Set the end date of this individual to _date_.
73
+ #
74
+ # Should be an IncompleteDate object or a date string, which will
75
+ # get converted into an IncompleteDate.
76
+ def end_date=(date)
77
+ date = IncompleteDate.new date unless date.is_a? IncompleteDate
78
+ @end_date = date
79
+ end
80
+
81
+ # Returns a unique name for the individual (using disambiguation).
82
+ #
83
+ # The unique name ist the individual's name together with the
84
+ # disambiguation attribute in parenthesis if it exists.
85
+ #
86
+ # Example:: 'Paradise Lost (British metal / hard rock band)'.
87
+ def unique_name
88
+ unique_name = @name
89
+ unique_name += " (#{@disambiguation})" if @disambiguation
90
+ return unique_name
91
+ end
92
+
93
+ # Returns the string representation for this individual.
94
+ #
95
+ # Returns #unique_name converted into a string.
96
+ def to_s
97
+ unique_name.to_s
98
+ end
99
+
100
+ end
101
+
102
+ end
103
+ end
@@ -1,54 +1,63 @@
1
- # $Id: label.rb 30 2007-05-29 02:12:33Z phw $
2
- # Copyright (c) 2007, Philipp Wolfer
3
- # All rights reserved.
4
- # See LICENSE for permissions.
1
+ # $Id: label.rb 141 2007-07-17 14:21:12Z phw $
2
+ #
3
+ # Author:: Philipp Wolfer (mailto:phw@rubyforge.org)
4
+ # Copyright:: Copyright (c) 2007, Nigel Graham, Philipp Wolfer
5
+ # License:: RBrainz is free software distributed under a BSD style license.
6
+ # See LICENSE[file:../LICENSE.html] for permissions.
5
7
 
6
- require 'rbrainz/model/entity'
7
- require 'rbrainz/model/incomplete_date'
8
+ require 'rbrainz/model/individual'
8
9
 
9
10
  module MusicBrainz
10
11
  module Model
11
12
 
12
13
  # A label in the MusicBrainz DB.
13
14
  #
14
- # See http://musicbrainz.org/doc/Label.
15
- class Label < Entity
15
+ # Labels in MusicBrainz can have a type. Currently, the following types
16
+ # are supported
17
+ #
18
+ # - http://musicbrainz.org/ns/mmd-1.0#Unknown
19
+ # - http://musicbrainz.org/ns/mmd-1.0#Distributor
20
+ # - http://musicbrainz.org/ns/mmd-1.0#Holding
21
+ # - http://musicbrainz.org/ns/mmd-1.0#OriginalProduction
22
+ # - http://musicbrainz.org/ns/mmd-1.0#BootlegProduction
23
+ # - http://musicbrainz.org/ns/mmd-1.0#ReissueProduction
24
+ #
25
+ # See:: Individual
26
+ # See:: http://musicbrainz.org/doc/Label.
27
+ class Label < Individual
16
28
 
29
+ # Used if the type of the label is unknown.
30
+ TYPE_UNKNOWN = NS_MMD_1 + 'Unknown'
31
+ # Companies mainly distributing other labels production,
32
+ # usually in a specific region of the world.
17
33
  TYPE_DISTRIBUTOR = NS_MMD_1 + 'Distributor'
34
+ # Holdings, conglomerates or other financial entities whose main
35
+ # activity is not to produce records, but to manage a large set of
36
+ # recording labels owned by them.
18
37
  TYPE_HOLDING = NS_MMD_1 + 'Holding'
38
+ # Recording labels producing entirely new releases.
19
39
  TYPE_ORIGINAL_PRODUCTION = NS_MMD_1 + 'OriginalProduction'
40
+ # Bootlegs companies (as in "not sanctioned by the rights owner(s)
41
+ # of the released work")
20
42
  TYPE_BOOTLEG_PRODUCTION = NS_MMD_1 + 'BootlegProduction'
43
+ # Labels specializing in catalog reissues.
21
44
  TYPE_REISSUE_PRODUCTION = NS_MMD_1 + 'ReissueProduction'
22
45
 
23
- attr_accessor :name, :sort_name, :disambiguation,
24
- :code, :country, :type
25
-
26
- attr_reader :founding_date, :dissolving_date, :releases
27
-
28
- def initialize
29
- super
30
- @releases = Array.new
31
- end
46
+ # See Entity::ENTITY_TYPE.
47
+ ENTITY_TYPE = :label # :nodoc:
32
48
 
33
- # Set the founding date of the label.
49
+ # The code of the label.
34
50
  #
35
- # Should be an IncompleteDate object or
36
- # a date string, which will get converted
37
- # into an IncompleteDate.
38
- def founding_date=(date)
39
- date = IncompleteDate.new date unless date.is_a? IncompleteDate
40
- @founding_date = date
41
- end
51
+ # See:: http://musicbrainz.org/doc/LabelCode
52
+ attr_accessor :code
42
53
 
43
- # Set the dissolving date of the label.
54
+ # The country in which the company was founded.
55
+ # A string containing a ISO 3166 country code like
56
+ # 'GB', 'US' or 'DE'.
44
57
  #
45
- # Should be an IncompleteDate object or
46
- # a date string, which will get converted
47
- # into an IncompleteDate.
48
- def dissolving_date=(date)
49
- date = IncompleteDate.new date unless date.is_a? IncompleteDate
50
- @dissolving_date = date
51
- end
58
+ # See:: Utils#get_country_name
59
+ # See:: http://musicbrainz.org/doc/LabelCountry
60
+ attr_accessor :country
52
61
 
53
62
  end
54
63