david-sabata/Chrome-Last.fm-Scrobbler — pull request #60 by shamer (2012-05-29 00:45:04+00:00)
Title: (fixes for) Jango connector

From Pull request #56
I've added a connector for the site jango.com

Because chrome isolates the extension in a separate context I had to use the script-injection trick to be able to access javascript on the page. With access to the page JS I am able to read the song information out of the local "media player" structures.

Communication back with the extension happens through a node in the DOM with the same DOMSubtreeModified method that several of the other connectors use to catch track changes.

From comments:
It looks like the problem was from partially loaded tracks. The sound manager's "duration" is only an estimate before it finishes loading the entire track. If the JS was triggered in this interval that the song was loading it could get a duration that was only a few seconds long.

I've added a check to make sure the entire song is loaded before requesting the duration. I've also added in more check to make sure the player/UI are started up before interacting with them.