david-sabata/Chrome-Last.fm-Scrobbler — pull request #367 by cenobitedk (2014-05-01 00:09:33+00:00)
Title: Better Soundcloud scrobbler using JS event bus.

This pull request adapt the connector to receive messages via `window.postMessage` from a new DOM injected script (`soundcloud-dom-inject.js`) connected to the Soundcloud JS event-bus.

The event-bus allows capturing of `audio:play` and `audio:pause` events with all metadata related to the playing track via **require.js** and **jquery** supplied from soundcloud.
The metadata is sent to the connector script and cleaned due to often dirty metadata (e.g. artist name in track title and other garbage) and forwarded (as usual) to the scrobbler script for processing.

As a bonus from using the event-bus the whole playlist issue (https://github.com/david-sabata/Chrome-Last.fm-Scrobbler/pull/363 though resolved) is no longer relevant.
Another problem this also fixes is when visiting a single track page. The page title alone would trigger the detection mechanism and lead to multiple "now playing" notifications even when not playing.

*Note: scrobbling of private tracks has been disabled with a bool variable, see line 3 in connector script. This has been dicussed here: https://github.com/david-sabata/Chrome-Last.fm-Scrobbler/issues/333#issuecomment-41653703*