diff options
-rw-r--r-- | data/rbot/plugins/lib_spotify.rb | 3 | ||||
-rw-r--r-- | data/rbot/plugins/spotify.rb | 6 |
2 files changed, 7 insertions, 2 deletions
diff --git a/data/rbot/plugins/lib_spotify.rb b/data/rbot/plugins/lib_spotify.rb index a30157c6..24caf428 100644 --- a/data/rbot/plugins/lib_spotify.rb +++ b/data/rbot/plugins/lib_spotify.rb @@ -71,7 +71,8 @@ module ::Spotify def self.get(service, method, query, page=1) query.tr!('-','') url = "http://ws.spotify.com/#{service}/1/#{method}?q=#{CGI.escape(query)}&page=#{page}" - xml = Irc::Utils.bot.httputil.get_response(url).body + xml = Irc::Utils.bot.httputil.get(url) + raise unless xml return REXML::Document.new(xml).root end diff --git a/data/rbot/plugins/spotify.rb b/data/rbot/plugins/spotify.rb index f645a8af..95fe5842 100644 --- a/data/rbot/plugins/spotify.rb +++ b/data/rbot/plugins/spotify.rb @@ -16,7 +16,11 @@ class SpotifyPlugin < Plugin def search(m, params) method = params[:method] || 'track' - result = Spotify.search(method, params[:query].to_s) + begin + result = Spotify.search(method, params[:query].to_s) + rescue + m.reply "problems connecting to Spotify" + end if result.nil? m.reply "no results" |