Пример #1
0
def episodes(imdb, tvdb, season, episode, watched):

    try:
	
        if not control.setting('trakt.scrobbleTV') == 'true': raise Exception()	
        if trakt.getTraktIndicatorsInfo() == False: raise Exception()
        if int(watched) == 7: trakt.markEpisodeAsWatched(tvdb, season, episode)
        else: trakt.markEpisodeAsNotWatched(tvdb, season, episode)
        trakt.cachesyncTVShows()
        	
    except:
        pass

    try:
        meta = {'imdb':imdb, 'tvdb':tvdb, 'season':season, 'episode':episode}
        playcountMeta('episode', meta, str(watched))
    except:
        pass
Пример #2
0
def markEpisodeDuringPlayback(season, episode, watched, imdb=None, tmdb=None, tvdb=None, refresh=False):
    try:
        if not control.setting('trakt.scrobbleTV') == 'true': raise Exception() 
        if trakt.getTraktIndicatorsInfo() == False: raise Exception()

        if int(watched) == 7: 
            # AVOID WATCHING DUPLICATES
            indicators = getTVShowIndicators(refresh=True)
            overlay = int(getEpisodeOverlay(indicators, season, episode, imdb=imdb, tmdb=tmdb, tvdb=tvdb, traktOnly=True))
            if overlay == 7: raise Exception()
            trakt.markEpisodeAsWatched(season, episode, imdb=imdb, tmdb=tmdb, tvdb=tvdb)
        else: trakt.markEpisodeAsNotWatched(season, episode, imdb=imdb, tmdb=tmdb, tvdb=tvdb)
        trakt.cachesyncTVShows()
    except:
        pass

    try:
        meta = {'imdb':imdb, 'tvdb':tvdb, 'tmdb': tmdb, 'season':season, 'episode':episode}
        playcountMeta('episode', meta, str(watched))
    except:
        pass

        
    if refresh== True: control.refresh()
Пример #3
0
def tvshows(tvshowtitle, imdb, tvdb, season, watched):

	# #### seasonID 0 is Full Tv Show #####
    SeasonID = str(season)
    try:
        import sys,xbmc
        name = control.addonInfo('name')
        dialog = control.progressDialogBG
        dialog.create(str(name), str(tvshowtitle))
        dialog.update(0, str(name), str(tvshowtitle))
        from resources.lib.indexers import episodes

        year = ''
        items = episodes.episodes().getLibrary(tvshowtitle, year, imdb, tvdb, idx=True)

        if SeasonID == '0':
			metaShow = {'imdb':imdb, 'tvdb':tvdb}
			playcountMeta('tv', metaShow, str(watched))

			try: items = [i for i in items]
			except: pass
			items = [{'season': int('%01d' % int(i['season'])), 'episode': int('%01d' % int(i['episode']))} for i in items]
			for i in range(len(items)):
				if xbmc.abortRequested == True: return sys.exit()
				season, episode = items[i]['season'], items[i]['episode']
				dialog.update(int((100 / float(len(items))) * i), 'Setting MetaData', 'Season: ' + str(season) + ' Episode: ' + str(episode))
				meta = {'imdb':imdb, 'tvdb':tvdb, 'season':season, 'episode':episode}
				playcountMeta('episode', meta, str(watched))
        else:
			try: items = [i for i in items if int('%01d' % int(season)) == int('%01d' % int(i['season']))]
			except: pass
			items = [{'season': int('%01d' % int(i['season'])), 'episode': int('%01d' % int(i['episode']))} for i in items]
			
			for i in range(len(items)):
				if xbmc.abortRequested == True: return sys.exit()
				season, episode = items[i]['season'], items[i]['episode']
				dialog.update(int((100 / float(len(items))) * i), 'Setting MetaData', 'Season: ' + str(season) + ' Episode: ' + str(episode))
				meta = {'imdb':imdb, 'tvdb':tvdb, 'season':season, 'episode':episode}
				playcountMeta('episode', meta, str(watched))

        try: dialog.close()
        except: pass

    except:
        try: dialog.close()
        except: pass


    try:
        name = control.addonInfo('name')
        dialog = control.progressDialogBG
        dialog.create(str(name), str(tvshowtitle))
        dialog.update(0, str(name), str(tvshowtitle))
        if trakt.getTraktIndicatorsInfo() == False: raise Exception()
        if not control.setting('trakt.scrobbleTV') == 'true': raise Exception()	
        if SeasonID == '0':
            year = ''
            items = episodes.episodes().getLibrary(tvshowtitle, year, imdb, tvdb, idx=True)
            for i in range(len(items)):
				season, episode = items[i]['season'], items[i]['episode']
				dialog.update(int((100 / float(len(items))) * i), 'TRAKT  Watchlist', 'Season: ' + str(season) + ' Episode: ' + str(episode))
				if int(watched) == 7: trakt.markEpisodeAsWatched(tvdb, season, episode)
				else: trakt.markEpisodeAsNotWatched(tvdb, season, episode)
        else:
           year = ''
           items = episodes.episodes().getLibrary(tvshowtitle, year, imdb, tvdb, idx=True)
           items = [(int(i['season']), int(i['episode'])) for i in items]
           items = [i[1] for i in items if int('%01d' % int(season)) == int('%01d' % i[0])]
           for i in items:
			dialog.update(int((100 / float(len(items))) * i), 'TRAKT  Watchlist', 'Season: ' + str(season) + ' Episode: ' + str(i))
			if int(watched) == 7: trakt.markEpisodeAsWatched(tvdb, season, i)
			else: trakt.markEpisodeAsNotWatched(tvdb, season, i)
				
        try: dialog.close()
        except: pass
        trakt.cachesyncTVShows()
    except:
        pass