rectifyer/script.trakt — pull request #94 by nate1280 (2013-04-10 00:34:20+00:00)
Title: Dispatch queue

As per a post by codeseven in the trakt.tv plugin thread, here is a fix for issues with playlist scrobbling.

The main part of this is introducing a queue for the dispatch events, the primary reason for this is to help avoid possible race conditions with the player/monitor interfaces.

Issues with scrobbling from playlists should also be resolved with this fix.

Just like in the sync change, I've also added an option to simulate scrobbling to aid in testing.

As usual, please test and provide feedback.

Please do not merge just yet, still double checking a few things, and testing. Also, going to get codeseven to test this to see if it resolves the issues, will comment again when its ready.

Changes are as follows:

- Add simulate scrobble setting for testing.
- Implement queue for dispatch events, should resolve race conditions that can occur.
- Dispatch queue is acted upon every cycle and cleared.
- Add check for xbmc playing video when doing update() from service thread.
- Remove old check for switching videos in a playlist in scrobbler class.
- Small change to rating check, perform the setting check before anything else.
- Change how updating time is handled, only update if the current playlist index is the same as what was seen when playback started.
- In traktPlayer, save playlist index in onPlayBackStarted to variable.
- In traktPlayer, onPlayBackStarted, check current playlist index to saved index if playlist length is greater then 1, if it is, fire an onPlayBackEnded event.
- Add some more debug lines to help in testing playlist playback.