Bringing on

This commit is contained in:
magnolia-fan
2011-06-14 20:05:12 +04:00
parent c4165a928c
commit 2c52349576
46 changed files with 1070 additions and 0 deletions
+2
View File
@@ -0,0 +1,2 @@
class Album < ActiveRecord::Base
end
+2
View File
@@ -0,0 +1,2 @@
class Artist < ActiveRecord::Base
end
+21
View File
@@ -0,0 +1,21 @@
class MusicBrainzArtist < ActiveRecord::Base
establish_connection :musicbrainz
set_table_name 'musicbrainz.bh_artist'
has_many :albums, :conditions => "release_type = 1", :order => 'year ASC, id ASC'
def self.getByName(name)
Artist.first(:conditions => ['name = ? AND id=credit_id', name], :order => 'rating DESC')
end
def self.getLastFmAutocomplete(query)
return nil if query.nil? or query.strip.empty?
json = ActiveSupport::JSON.decode(open(
'http://www.last.fm/search/autocomplete' <<
'?q=' << URI.escape(query)
).read)
return json.empty? ? nil : json
end
end
+2
View File
@@ -0,0 +1,2 @@
class Track < ActiveRecord::Base
end