diff --git a/Gemfile.lock b/Gemfile.lock index 7b8fd73..17b66ab 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -67,7 +67,7 @@ GEM i18n (>= 0.4.0) mime-types (~> 1.16) treetop (~> 1.4.8) - mime-types (1.16) + mime-types (1.17.2) multi_json (1.0.3) musicbrainz (0.5.0) nokogiri @@ -100,14 +100,14 @@ GEM rdoc (~> 3.4) thor (~> 0.14.6) raindrops (0.8.0) - rake (0.9.2) + rake (0.9.2.2) rdoc (3.11) json (~> 1.4) sass (3.1.10) sprockets (2.0.3) hike (~> 1.2) rack (~> 1.0) - tilt (~> 1.1, != 1.3.0) + tilt (!= 1.3.0, ~> 1.1) therubyracer (0.9.8) libv8 (~> 3.3.10) thor (0.14.6) diff --git a/app/models/music/artist.rb b/app/models/music/artist.rb index aa5fe38..04ab964 100644 --- a/app/models/music/artist.rb +++ b/app/models/music/artist.rb @@ -9,8 +9,12 @@ class Artist < ActiveRecord::Base def status_str %w(loading ok fail)[self.status] end + +private def prepare_description - self.desc.gsub! /[\[<].*?[\]>]/, '' unless self.desc.nil? + self.desc.gsub!(/[\[<].*?[\]>]/, '') unless self.desc.nil? + rescue + # WTF?! end end diff --git a/app/views/artist/_page.html.haml b/app/views/artist/_page.html.haml index 36186b0..9927955 100644 --- a/app/views/artist/_page.html.haml +++ b/app/views/artist/_page.html.haml @@ -6,7 +6,7 @@ = image_tag @artist.pic_url unless @artist.pic_url.nil? .span7.columns.desc %h2= @artist.name - = @artist.desc unless @artist.desc.nil? + = @artist.desc.html_safe unless @artist.desc.nil? - unless @artist.artist_links.empty? .service-icons - @artist.artist_links.each do |service| diff --git a/lib/discogs.rb b/lib/discogs.rb index f2de145..f0dc6ab 100644 --- a/lib/discogs.rb +++ b/lib/discogs.rb @@ -126,10 +126,15 @@ class Discogs end def self.get_master_albums url - x = Nokogiri::HTML(open(url, - 'User-Agent' => 'Haven Search Bot', - 'Cookie' => 'artist_layout=med; artist_limit=500' - ).read) + begin + xml = open(url, + 'User-Agent' => 'Haven Search Bot', + 'Cookie' => 'artist_layout=med; artist_limit=500' + ).read + rescue => e + xml = "" + end + x = Nokogiri::HTML(xml) albums = [] split = 0 x.css('table.discography > tbody > tr').each do |_|