[RELEASE] trakt.tv tv/movie scrobbler
Information 
Yep.

So I tried digging into the logs, trakt python code and XBMC code.

What I've found :

The first difference for the trakt addon in the XBMC logs when it works :

XBMC Logs - Internal player (working) :
Code:
NOTICE: [trakt] [traktPlayer] onPlayBackStarted() - {u'item': {u'type': u'movie', u'id': 269, u'label': u'Welcome To The Jungle'}}

The trakt function "onPlayBackStarted(self)" in service.py in the trakt addon code is never called with the external player.

XBMC Logs - Internal player (working) :

Code:
DEBUG: CApplication::OnPlayBackStarted : play state was 1, starting 1
DEBUG: CApplication::PlayFile : OpenFile succeed, play state 2
DEBUG: CApplication::OnPlayBackStarted : play state was 2, starting 0
...
DEBUG: CApplication::OnPlayBackStopped : play state was 2, starting 0

XBMC Logs - External player (not working) :

Code:
DEBUG: CApplication::PlayFile : OpenFile succeed, play state 1
...
DEBUG: CApplication::OnPlayBackEnded : play state was 1, starting 0

It seems it corresponds to the XBMC function : "CApplication::OnPlayBackStarted()".
I found these "CApplication::OnPlayBack*" XBMC functions in https://github.com/xbmc/xbmc/blob/master...cation.cpp.

Code:
void CApplication::OnPlayBackEnded()
void CApplication::OnPlayBackStarted()
void CApplication::OnPlayBackStopped()
...
+ PlayBackRet CApplication::PlayFile(const CFileItem& item, bool bRestart)

These "CApplication::OnPlayBack*" functions have a python call in their code.

The calls of "OnPlayBackStarted()", "OnPlayBackStopped()" and "OnPlayBackEnded()" are all only made once and in a switch on "m_ePlayState".

XBMC code - Application.cpp :
Code:
// play state: none, starting; playing; stopped; ended.
// last 3 states are set by playback callback, they are all ignored during starting,
// but we recorded the state, here we can make up the callback for the state.
CLog::Log(LOGDEBUG,"%s : OpenFile succeed, play state %d", __FUNCTION__, m_ePlayState);
switch (m_ePlayState)
{
      case PLAY_STATE_PLAYING:
        OnPlayBackStarted();
        break;
      // FIXME: it seems no meaning to callback started here if there was an started callback
      //        before this stopped/ended callback we recorded. if we callback started here
      //        first, it will delay send OnPlay announce, but then we callback stopped/ended
      //        which will send OnStop announce at once, so currently, just call stopped/ended.
      case PLAY_STATE_ENDED:
        OnPlayBackEnded();
        break;
      case PLAY_STATE_STOPPED:
        OnPlayBackStopped();
        break;
      case PLAY_STATE_STARTING:
        // neither started nor stopped/ended callback be called, that means the item still
        // not started, we need not make up any callback, just leave this and
        // let the player callback do its work.
        break;
      default:
        break;
}

With none = 0, starting = 1; playing = 2; stopped = 3; ended = 4 ?!

And now what ? Big Grin

Cheers.


Messages In This Thread
RE: [RELEASE] trakt.tv tv/movie scrobbler - by Ben91 - 2014-05-26, 23:24
Logout Mark Read Team Forum Stats Members Help
[RELEASE] trakt.tv tv/movie scrobbler13