Importing favorites from vkontakte

This commit is contained in:
magnolia-fan
2011-11-30 03:08:00 +04:00
parent 41e9165ff4
commit f8d86216c8
4 changed files with 58 additions and 8 deletions
+11
View File
@@ -25,6 +25,7 @@ class window.Vkontakte
_session.query '/user/auth', {}, (ar) ->
log "Authenticating user ..."
if ar.newbie or ar.user.name == ""
log "Requesting user name from Vkontakte ..."
VK.Api.call 'getVariable', key: 1281, (r) ->
_session.query '/user/update', params: { name: r.response }, (ar2) ->
_session.setUser ar2.user
@@ -34,6 +35,16 @@ class window.Vkontakte
if ar.ok_reload
window.location.reload()
false
log "Requesting user tracks from Vkontakte ..."
VK.Api.call 'audio.get', uid: ar.user.vkid, (r) ->
_session.query "/user/set_first_favorites", tracks: r.response, (r2) ->
log "Sending your Vkontakte media collection to BeatHaven ..."
if r2.status?
log "Got error: #{r2.status}"
else
log "We believe your favorite artists are #{r2.join(', ')}"
false
false
else if ar.ok_reload
window.location.reload()
false