Playback, import fixes

This commit is contained in:
Gregory Eremin
2012-09-17 12:25:38 +04:00
parent a29f4433ca
commit e8fa9e4cda
14 changed files with 80 additions and 43 deletions
@@ -47,18 +47,18 @@ class BeatHaven.Models.Player extends Backbone.Model
if @playlist_on
# not implemented
else
nodes = @current_track.node().next()
return false unless nodes.length == 1
@tracks.get(parseInt($(nodes[0]).data("id"), 10)).play()
node = $(".tracks li.now-playing").neighbour(".tracks li", 1)
return false unless node?
@tracks.get(parseInt($(node).data("id"), 10)).play()
prev: ->
return false unless @current_track?
if @playlist_on
# not implemented
else
nodes = @current_track.node().prev()
return false unless nodes.length == 1
@tracks.get(parseInt($(nodes[0]).data("id"), 10)).play()
node = $(".tracks li.now-playing").neighbour(".tracks li", -1)
return false unless node?
@tracks.get(parseInt($(node).data("id"), 10)).play()
play_something: ->
nodes = $(".artist-page .tracks li[data-id]")
@@ -28,6 +28,7 @@ class BeatHaven.Models.Track extends Backbone.Model
self.start()
add_to_library: (params) ->
self = this
obj = soundManager.createSound
id: @.get("id")
url: @.get("url")
@@ -39,8 +40,10 @@ class BeatHaven.Models.Track extends Backbone.Model
BH.Player.update_progress_bar(this)
onfinish: ->
BH.Player.next()
self.node().removeClass("now-playing").removeClass("paused")
ondataerror: ->
BH.Player.next()
self.node().removeClass("now-playing").removeClass("paused")
@.set("sm_obj", obj)
node: ->