Exemplo n.º 1
0
def set_scrobble(current_time,
                 total_time,
                 _content,
                 _imdb='',
                 _tvdb='',
                 _season='',
                 _episode=''):
    try:
        if not (current_time == 0 or total_time == 0):
            percent = float((current_time / total_time)) * 100
        else:
            percent = 0
        if int(current_time) > 120 and 2 < percent < 92:
            trakt.scrobbleMovie(
                _imdb, percent, action='pause'
            ) if _content == 'movie' else trakt.scrobbleEpisode(
                _imdb, _season, _episode, percent, action='pause')
            if control.setting('trakt.scrobble.notify') == 'true':
                control.sleep(1000)
                control.infoDialog('Trakt: Scrobble Paused')
        elif percent >= 92:
            trakt.scrobbleMovie(
                _imdb, percent, action='stop'
            ) if _content == 'movie' else trakt.scrobbleEpisode(
                _imdb, _season, _episode, percent, action='stop')
            if control.setting('trakt.scrobble.notify') == 'true':
                control.sleep(1000)
                control.infoDialog('Trakt: Scrobbled')
    except:
        log_utils.log('Scrobble - Exception', 1)
        control.infoDialog('Scrobble Failed')
Exemplo n.º 2
0
    def onPlayBackStopped(self):
        control.sleep(2500)
        bookmarks().reset(self.currentTime, self.totalTime, self.name,
                          self.year)

        if control.setting(
                'trakt.scrobble') == 'true' and trakt.getTraktCredentialsInfo(
                ) == True:
            try:
                percent = float((self.currentTime / self.totalTime) * 100)
                if 1 < percent < 95:
                    trakt.scrobbleMovie(
                        self.imdb, percent
                    ) if self.content == 'movie' else trakt.scrobbleEpisode(
                        self.tvdb, self.season, self.episode, percent)
                    if control.setting('trakt.scrobble.notify') == 'true':
                        control.infoDialog('Trakt: Scrobbled')
            except:
                import traceback
                from resources.lib.modules import log_utils
                failure = traceback.format_exc()
                log_utils.log('Scrobble - Exception: ' + str(failure))
                control.infoDialog('Scrobble Failed')

        try:
            if (self.currentTime / self.totalTime) >= .90:
                self.libForPlayback()
        except:
            pass

        if control.setting('crefresh') == 'true':
            control.refresh()
Exemplo n.º 3
0
	def set_scrobble(self, current_time, media_length, media_type, imdb='', tmdb='', tvdb='', season='', episode=''):
		try:
			percent = float((current_time / media_length)) * 100
			seekable = (int(current_time) > 180 and (percent <= 85))
			if seekable:
				trakt.scrobbleMovie(imdb, tmdb, percent) if media_type == 'movie' else trakt.scrobbleEpisode(imdb, tmdb, tvdb, season, episode, percent)
			if percent > 85:
				trakt.scrobbleReset(imdb, tvdb, season, episode, refresh=False)
		except:
			log_utils.error()
Exemplo n.º 4
0
 def set_scrobble(self,
                  current_time,
                  media_length,
                  media_type,
                  imdb='',
                  tvdb='',
                  season='',
                  episode=''):
     # log_utils.log('current_time =  %s' % current_time, __name__, log_utils.LOGDEBUG)
     # log_utils.log('media_type =  %s' % media_type, __name__, log_utils.LOGDEBUG)
     try:
         percent = float((current_time / media_length)) * 100
         # log_utils.log('percent =  %s' % percent, __name__, log_utils.LOGDEBUG)
         if percent < 95:
             trakt.scrobbleMovie(
                 imdb, percent
             ) if media_type == 'movie' else trakt.scrobbleEpisode(
                 tvdb, season, episode, percent)
             # if control.setting('trakt.scrobble.notify') == 'true':
             # control.infoDialog('Trakt: Scrobbled')
     except:
         log_utils.error()