diff --git a/rails/app/models/album.rb b/rails/app/models/album.rb index 4977042..b690e06 100644 --- a/rails/app/models/album.rb +++ b/rails/app/models/album.rb @@ -1,5 +1,23 @@ +# encoding: UTF-8 class Album < ActiveRecord::Base set_table_name 'musicbrainz.bh_release_group' belongs_to :artist has_many :releases, :conditions => "release_type = 1", :order => 'date ASC, id ASC' + + require 'iconv' + + def cover artist + q_artist = CGI::escape(artist) + q_album = CGI::escape(name) + #i = Iconv.new('Windows-31J', 'UTF-8') + path = open( + 'http://ws.audioscrobbler.com/2.0/' << + '?method=album.getinfo' << + '&api_key=b25b959554ed76058ac220b7b2e0a026' << + '&artist=' << q_artist << + '&album=' << q_album + ).read + + path.match(/(.*)<\/image>/i)[1] + end end diff --git a/rails/app/views/artist/view.rhtml b/rails/app/views/artist/view.rhtml index 231b9d0..8b775e9 100644 --- a/rails/app/views/artist/view.rhtml +++ b/rails/app/views/artist/view.rhtml @@ -2,7 +2,7 @@ <% @artist.albums.each do |album| %> <% unless album.releases.empty? %>
-
+

<%= album.name %> <%= (album.year ? album.year : '') %>

<% releases = album.releases diff --git a/rails/public/stylesheets/beathaven.css b/rails/public/stylesheets/beathaven.css index 738ca93..08ce4bc 100644 --- a/rails/public/stylesheets/beathaven.css +++ b/rails/public/stylesheets/beathaven.css @@ -41,7 +41,7 @@ body { .album .name { display: block; float: left; - width: 400px; + width: 450px; font-size: 1.5em; margin: 0 0 0.5em 0; /* background-color: yellowgreen;*/ @@ -50,7 +50,7 @@ body { .album .tracks { display: block; float: left; - width: 400px; + width: 450px; margin-bottom: 1em; /* background-color: lightblue;*/ }