Player functionality restored
This commit is contained in:
parent
7582bd18a5
commit
c138c1a74b
|
@ -88,7 +88,6 @@ class window.Player
|
|||
false
|
||||
|
||||
getTrackInfo: (id) ->
|
||||
console.log(id)
|
||||
for track in _player.playlist
|
||||
if parseInt(track.id, 10) == parseInt(id, 10)
|
||||
return track
|
||||
|
@ -226,12 +225,8 @@ $('.playlist li').live 'click', ->
|
|||
$('.add-album').live 'click', ->
|
||||
artist = $('.artist-info h2').text()
|
||||
album = _player.albums[$(this).attr('data-album-id')]
|
||||
for item in album.tracks.album
|
||||
for item in album.tracks
|
||||
item['artist'] = artist
|
||||
item['album'] = album.name
|
||||
_player.addTracks album.tracks.album
|
||||
for item in album.tracks.bonus
|
||||
item['artist'] = artist
|
||||
item['album'] = album.name
|
||||
_player.addTracks album.tracks.bonus
|
||||
_player.addTracks album.tracks
|
||||
false
|
||||
|
|
|
@ -90,19 +90,18 @@ class ArtistController < ApplicationController
|
|||
@artist[:albums] = []
|
||||
artist.albums.each do |album|
|
||||
if true # 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 = []
|
||||
tmp_album = {:id => album.id, :name => album.name, :year => album.year, :pic => album.pic_url, :tracks => []}
|
||||
album.tracks.each do |track|
|
||||
tmp_track = {id: track.id, name: track.name, live: track.live, acoustic: track.acoustic}
|
||||
tmp_track[:length] = (track.length / 1000).round unless track.length.nil?
|
||||
tmp_track[:duration] = formatTrackDuration(track.length)
|
||||
tmp_track[:position] = track.position.to_s 36
|
||||
# tmp_track[:mbid] = track.mbid
|
||||
(track.bonus == 0 ? album_tracks : bonus_tracks) << tmp_track
|
||||
# (track.bonus == 0 ? album_tracks : bonus_tracks) << tmp_track
|
||||
tmp_album[:tracks] << tmp_track
|
||||
end
|
||||
tmp_album[:tracks] = {album: album_tracks, bonus: bonus_tracks}
|
||||
@artist[:albums] << tmp_album if (album_tracks+bonus_tracks).length > 0
|
||||
# tmp_album[:tracks] = {album: album_tracks, bonus: bonus_tracks}
|
||||
@artist[:albums] << tmp_album unless tmp_album[:tracks].empty?
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class Artist < ActiveRecord::Base
|
||||
has_many :albums, :order => 'has_pic DESC, year ASC, id ASC', :dependent => :destroy
|
||||
has_many :albums, :conditions => ['has_pic = 1'], :order => 'year ASC', :dependent => :destroy
|
||||
has_many :artist_links, :dependent => :destroy
|
||||
has_many :artist_aliases, :dependent => :destroy
|
||||
has_many :tracks, :through => :track_artists
|
||||
|
|
|
@ -18,11 +18,7 @@
|
|||
.span7.columns.tracks
|
||||
%h3= album[:name] + " (" + album[:year].to_s + ")"
|
||||
%table.zebra-striped.tracklist
|
||||
- album[:tracks][:album].each do |track|
|
||||
%tr
|
||||
%td.song-title= track[:name]
|
||||
%td.song-duration= track[:duration]
|
||||
- album[:tracks][:bonus].each do |track|
|
||||
- album[:tracks].each do |track|
|
||||
%tr
|
||||
%td.song-title= track[:name]
|
||||
%td.song-duration= track[:duration]
|
Loading…
Reference in New Issue