コード例 #1
0
ファイル: service.py プロジェクト: trickaz/tknorris-beta-repo
                log_utils.log('XBMC silently failed to start playback', xbmc.LOGWARNING)
            elif playedTime>0:
                log_utils.log('Service: Setting bookmark on |%s|%s|%s| to %s seconds' % (self.slug, self.season, self.episode, playedTime), xbmc.LOGDEBUG)
                db_connection.set_bookmark(self.slug, playedTime, self.season, self.episode)
                if percent_played>=75:
                    if xbmc.getCondVisibility('System.HasAddon(script.trakt)'):
                        run = 'RunScript(script.trakt, action=sync, silent=True)'
                        xbmc.executebuiltin(run)
            self.reset()

    def onPlayBackEnded(self):
        log_utils.log('Service: Playback completed')
        self.onPlayBackStopped()
            
monitor = Service()
utils.do_startup_task(MODES.UPDATE_SUBS)

errors=0
while not xbmc.abortRequested:
    try:
        isPlaying = monitor.isPlaying()
        utils.do_scheduled_task(MODES.UPDATE_SUBS, isPlaying)
        if monitor.tracked and monitor.isPlayingVideo():
            monitor._lastPos = monitor.getTime()
    except Exception as e:
        errors += 1
        if errors >= MAX_ERRORS:
            log_utils.log('Service: Error (%s) received..(%s/%s)...Ending Service...' % (e, errors, MAX_ERRORS), xbmc.LOGERROR)
            break
        else:
            log_utils.log('Service: Error (%s) received..(%s/%s)...Continuing Service...' % (e, errors, MAX_ERRORS), xbmc.LOGERROR)
コード例 #2
0
                    db_connection.set_bookmark(self.trakt_id, playedTime,
                                               self.season, self.episode)

                if percent_played >= 75:
                    if xbmc.getCondVisibility('System.HasAddon(script.trakt)'):
                        run = 'RunScript(script.trakt, action=sync, silent=True)'
                        xbmc.executebuiltin(run)
            self.reset()

    def onPlayBackEnded(self):
        log_utils.log('Service: Playback completed', log_utils.LOGNOTICE)
        self.onPlayBackStopped()


monitor = Service()
utils.do_startup_task(MODES.UPDATE_SUBS)

was_on = False


def disable_global_cx():
    global was_on
    if xbmc.getCondVisibility(
            'System.HasAddon(plugin.program.super.favourites)'):
        active_plugin = xbmc.getInfoLabel('Container.PluginName')
        sf = xbmcaddon.Addon('plugin.program.super.favourites')
        if active_plugin == kodi.get_id():
            if sf.getSetting('CONTEXT') == 'true':
                log_utils.log('Disabling Global CX while SALTS is active',
                              log_utils.LOGDEBUG)
                was_on = True