Example #1
0
def getShowCount(indicators, imdb, tvdb):
	if not imdb.startswith('tt'): return None
	try:
		if traktIndicators:
			if indicators and imdb in str(indicators):
				for indicator in indicators:
					if indicator[0] == imdb:
						total = indicator[1]
						watched = len(indicator[2])
						unwatched = total - watched
						return {'total': total, 'watched': watched, 'unwatched': unwatched}
			elif not indicators:
				result = trakt.showCount(imdb)
				return result
			else: # TMDb has "total_episodes" now so return None and it will be used when indicators is populated but tvdb not found(shows never watched)
				return None
		else:
			return None # this code below for metahandler does not aply here nor does the addon offer a means to return such counts
			if not indicators: return None
			for indicator in indicators:
				if indicator[0] == tvdb:
					total = indicator[1]
					watched = len(indicator[2])
					unwatched = total - watched
					return {'total': total, 'watched': watched, 'unwatched': unwatched}
	except:
		from resources.lib.modules import log_utils
		log_utils.error()
		return None
def getShowCount(indicators, imdb, tvdb):
	if not imdb.startswith('tt'): return None
	try:
		if traktIndicators:
			if indicators and tvdb in str(indicators):
				for indicator in indicators:
					if indicator[0] == tvdb:
						total = indicator[1]
						watched = len(indicator[2])
						unwatched = total - watched
						return {'total': total, 'watched': watched, 'unwatched': unwatched}
			else:
				result = trakt.showCount(imdb)
				return result
		else:
			return None
			if not indicators: return None # this code for metahandler does not aply here nor does the addon offer a means to return such counts
			for indicator in indicators:
				if indicator[0] == tvdb:
					total = indicator[1]
					watched = len(indicator[2])
					unwatched = total - watched
					return {'total': total, 'watched': watched, 'unwatched': unwatched}
	except:
		log_utils.error()
		return None
Example #3
0
def getShowCount(indicators, imdb, tvdb, limit=False):
    if not imdb.startswith('tt'):
        return None
    try:
        if traktIndicators:
            result = trakt.showCount(imdb)
            if limit and result:
                result['unwatched'] = min(99, result['unwatched'])
            return result
        else:
            for indicator in indicators:
                if indicator[0] == tvdb:
                    total = indicator[1]
                    watched = len(indicator[2])
                    unwatched = total - watched

                    if limit:
                        unwatched = min(99, unwatched)
                    return {
                        'total': total,
                        'watched': watched,
                        'unwatched': unwatched
                    }
    except:
        log_utils.error()
        return None
Example #4
0
def getShowCount(indicators, imdb, tvdb, limit = False):
	try:
		if traktIndicators is False:
			raise Exception()
		result = trakt.showCount(imdb)

		if limit and result:
			result['unwatched'] = min(99, result['unwatched'])

		return result
	except:

		try:
			for indicator in indicators:
				if indicator[0] == tvdb:
					total = indicator[1]
					watched = len(indicator[2])
					unwatched = total - watched
					if limit:
						unwatched = min(99, unwatched)

					return {'total': total, 'watched': watched, 'unwatched': unwatched}
		except:
			pass
		return None
def getShowCount(indicators, imdb, tvdb):
    if not imdb.startswith('tt'): return None
    try:
        if traktIndicators:
            if indicators and tvdb in str(indicators):
                for indicator in indicators:
                    if indicator[0] == tvdb:
                        total = indicator[1]
                        watched = len(indicator[2])
                        unwatched = total - watched
                        return {
                            'total': total,
                            'watched': watched,
                            'unwatched': unwatched
                        }
            else:
                result = trakt.showCount(imdb)
                return result
        else:
            if not indicators: return None
            for indicator in indicators:
                if indicator[0] == tvdb:
                    total = indicator[1]
                    watched = len(indicator[2])
                    unwatched = total - watched
                    return {
                        'total': total,
                        'watched': watched,
                        'unwatched': unwatched
                    }
    except:
        log_utils.error()
        return None