 
     @_get url, (response) ->
       response = JSON.parse(response.response).recenttracks
-      if Object::toString.call(response.track) is "[object Array]"
+      if response.track? and isArray response.track
         callback? response.track[0]
       else callback?()
 


window.onload = ->
  drawTrack = (track) ->
    alert track.name

  aberigle.api.lastfm.getNowPlaying "jayle23", (track) ->
    if track? then drawTrack track
    else aberigle.api.image.getImage (response) ->
      document.body.style.backgroundImage = "url(#{response.imageUrl})"
      link = copyright.firstChild
      link.href = response.copyrightLink
      link.text = response.copyright

      copyright.onmouseenter = -> document.body.classList.add "clean"
      copyright.onmouseleave = -> document.body.classList.remove "clean"

console.log "Hay there, you can find me @aberigle"

window.isArray = (object) -> Object::toString.call(object) is "[object Array]"

class API

