1
0
Fork 0

Some bug fixes

This commit is contained in:
magnolia-fan 2011-10-29 13:34:53 +04:00
parent 9f3a879628
commit 1a5e0cb819
4 changed files with 18 additions and 9 deletions

View File

@ -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)

View File

@ -10,7 +10,11 @@ class Artist < ActiveRecord::Base
%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

View File

@ -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|

View File

@ -126,10 +126,15 @@ class Discogs
end
def self.get_master_albums url
x = Nokogiri::HTML(open(url,
begin
xml = open(url,
'User-Agent' => 'Haven Search Bot',
'Cookie' => 'artist_layout=med; artist_limit=500'
).read)
).read
rescue => e
xml = ""
end
x = Nokogiri::HTML(xml)
albums = []
split = 0
x.css('table.discography > tbody > tr').each do |_|