Bonus tracks, user preferred media types

This commit is contained in:
magnolia-fan
2011-09-18 18:59:19 +04:00
parent e69a12ded5
commit c726d1ca44
5 changed files with 17 additions and 35 deletions
+8 -2
View File
@@ -2,7 +2,7 @@ require 'open-uri'
require 'musicbrainz'
class ArtistController < ApplicationController
@@default_album_types = ['Album', 'Soundtrack']
@@default_album_types = [:album, :soundtrack]
def data
@data = {
:status => '',
@@ -81,9 +81,15 @@ class ArtistController < ApplicationController
pic: artist.pic_url
}
media_types = @@default_album_types
session = Session.find_by_key(session_key)
unless session.nil?
media_types = session.user.music
end
@artist[:albums] = []
artist.albums.each do |album|
if @@default_album_types.include? album.album_type and album.status == 1
if media_types.include? album.album_type.downcase.to_sym and album.status == 1
tmp_album = {id: album.id, name: album.name, year: album.year, pic: album.pic_url}
album_tracks = []
bonus_tracks = []