Class: MusicBrainz::Webservice::TrackFilter

Inherits:
AbstractFilter show all
Defined in:
lib/rbrainz/webservice/filter.rb

Overview

A filter for the track collection.

Instance Method Summary collapse

Methods inherited from AbstractFilter

#to_s

Constructor Details

#initialize(filter) ⇒ TrackFilter

The parameter filter is a hash with filter options. At least the :title, :puid or :query filter must be specified.

Available filter options: [:title] Fetch a list of tracks with a matching title. [:artist] The returned tracks have to match the given artist name. [:release] The returned tracks have to match the given release title. [:duration] The length of the track in milliseconds [:tracknum] The track number [:artistid] The artist's MBID. If this is given, the artist parameter is ignored. [:releaseid] The release's MBID. If this is given, the release parameter is ignored. [:puid] The returned tracks have to match the given PUID. [:count] Number of tracks on the release. [:releasetype] The type of the release this track appears on. See Model::Release for possible values. [:limit] The maximum number of tracks returned. Defaults to 25, the maximum allowed value is 100. [:offset] Return search results starting at a given offset. Used for paging through more than one page of results. [:query] A Lucene search query. The query parameter is a search string which will be passed to the underlying Lucene search engine. It must follow the syntax described in http://musicbrainz.org/doc/TextSearchSyntax.



209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# File 'lib/rbrainz/webservice/filter.rb', line 209

def initialize(filter)
  Utils.check_options filter, 
      :limit, :offset, :query, :title, :artist, :release, :duration, 
      :tracknum, :artistid, :releaseid, :puid, :count, :releasetype
  super(filter)
  @filter[:title]       = filter[:title]     if filter[:title]
  @filter[:artist]      = filter[:artist]    if filter[:artist]
  @filter[:release]     = filter[:release]   if filter[:release]
  @filter[:duration]    = filter[:duration]  if filter[:duration]
  @filter[:tracknum]    = filter[:tracknum]  if filter[:tracknum]
  @filter[:artistid]    = filter[:artistid]  if filter[:artistid]
  @filter[:releaseid]   = filter[:releaseid] if filter[:releaseid]
  @filter[:puid]        = filter[:puid]      if filter[:puid]
  @filter[:count]       = filter[:count]     if filter[:count]
  if filter[:releasetype]
    @filter[:releasetype] = Utils.remove_namespace(filter[:releasetype])
  end
end