Lastfm workout
This commit is contained in:
@@ -32,7 +32,7 @@ class window.Player
|
||||
data = e.jPlayer.status
|
||||
if not _player.scrobbled and data.currentPercentAbsolute > 50
|
||||
$obj = $('.playlist li.now')
|
||||
self.scrobble $obj.attr('data-artist'), $obj.attr('data-album'), $obj.attr('data-track')
|
||||
self.scrobble _player.getTrackInfo $obj.attr('data-id')
|
||||
_player.scrobbled = true
|
||||
$('.player .progress .loaded').width(data.seekPercent * self.bar_width / 100)
|
||||
$('.player .progress .played').width(data.currentPercentAbsolute * self.bar_width / 100)
|
||||
@@ -82,15 +82,15 @@ class window.Player
|
||||
$('.player .now-playing').html query
|
||||
$('.playlist li').removeClass 'now'
|
||||
$obj.addClass 'now'
|
||||
console.log(track)
|
||||
_vkontakte.loadTracksData track.artist, track.name, track.duration, (url) ->
|
||||
_player.playSource url
|
||||
this.updateNowListening track.artist, track.album, track.name
|
||||
this.updateNowListening track
|
||||
false
|
||||
|
||||
getTrackInfo: (id) ->
|
||||
console.log(id)
|
||||
for track in _player.playlist
|
||||
if track.id == parseInt(id, 10)
|
||||
if parseInt(track.id, 10) == parseInt(id, 10)
|
||||
return track
|
||||
false
|
||||
|
||||
@@ -152,14 +152,14 @@ class window.Player
|
||||
onRepeat: ->
|
||||
#return $('#repeat').hasClass 'active'
|
||||
|
||||
updateNowListening: (artist, album, track) ->
|
||||
updateNowListening: (track) ->
|
||||
if _session.getUser().lastfm_username
|
||||
_session.query '/lastfm/listening?r=' +Math.random(), artist: artist, album: album, track: track
|
||||
_session.query '/lastfm/listening?r=' +Math.random(), track
|
||||
false
|
||||
|
||||
scrobble: (artist, album, track) ->
|
||||
scrobble: (track) ->
|
||||
if _session.getUser().lastfm_username
|
||||
_session.query '/lastfm/scrobble?r=' +Math.random(), artist: artist, album: album, track: track
|
||||
_session.query '/lastfm/scrobble?r=' +Math.random(), track
|
||||
false
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user