lib/firstfm/track.rb in firstfm-0.1.0 vs lib/firstfm/track.rb in firstfm-0.1.1

- old
+ new

@@ -6,11 +6,11 @@ include HTTParty base_uri 'ws.audioscrobbler.com' format :xml - def self.search(track, page = 1, limit = 50) - response = get("/2.0/", {:query => {:method => 'tracks.search', :track => track, :page => page, :limit => limit, :api_key => Firstfm::CONFIG['api_key']}}) + def self.search(track, page = 1, limit = 30) + response = get("/2.0/", {:query => {:method => 'track.search', :track => track, :page => page, :limit => limit, :api_key => Firstfm::CONFIG['api_key']}}) tracks_array = (response and response["lfm"] and response["lfm"]["results"] and response["lfm"]["results"]["trackmatches"] and response["lfm"]["results"]["trackmatches"]["track"]) || [] tracks = Track.init_from_array(tracks_array) WillPaginate::Collection.create(page, limit) do |pager| pager.replace tracks pager.total_entries = response['lfm']['results']['opensearch:totalResults'].to_i \ No newline at end of file