Exemplo n.º 1
0
def episodes(imdb, tvdb, season, episode, watched):
    try:
        if trakt.getTraktIndicatorsInfo() == False: raise Exception()
        if int(watched) == 7: trakt.markEpisodeAsWatched(tvdb, season, episode)
        else: trakt.markEpisodeAsNotWatched(tvdb, season, episode)
        trakt.cachesyncTVShows()
        control.refresh()
    except:
        pass

    try:
        from metahandler import metahandlers
        metaget = metahandlers.MetaData(preparezip=False)
        metaget.get_meta('tvshow', name='', imdb_id=imdb)
        metaget.get_episode_meta('',
                                 imdb_id=imdb,
                                 season=season,
                                 episode=episode)
        metaget.change_watched('episode',
                               '',
                               imdb_id=imdb,
                               season=season,
                               episode=episode,
                               watched=int(watched))
        if trakt.getTraktIndicatorsInfo() == False: control.refresh()
    except:
        pass
Exemplo n.º 2
0
def tvshows(tvshowtitle, imdb, tvdb, season, watched):
    try:
        import sys,xbmc

        if not trakt.getTraktIndicatorsInfo() == False: raise Exception()

        from metahandler import metahandlers
        from resources.lib.indexers import episodes

        metaget = metahandlers.MetaData(preparezip=False)

        name = control.addonInfo('name')

        dialog = control.progressDialogBG
        dialog.create(str(name), str(tvshowtitle))
        dialog.update(0, str(name), str(tvshowtitle))

        metaget.get_meta('tvshow', name='', imdb_id=imdb)

        items = episodes.episodes().get(tvshowtitle, '0', imdb, tvdb, '0','0', idx=False)

        try: items = [i for i in items if int('%01d' % int(season)) == int('%01d' % int(i['season']))]
        except: pass
        items = [{'label': '%s S%02dE%02d' % (tvshowtitle, int(i['season']), int(i['episode'])), '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()

            dialog.update(int((100 / float(len(items))) * i), str(name), str(items[i]['label']))

            season, episode = items[i]['season'], items[i]['episode']
            metaget.get_episode_meta('', imdb_id=imdb, season=season, episode=episode)
            metaget.change_watched('episode', '', imdb_id=imdb, season=season, episode=episode, watched=int(watched))

        try: dialog.close()
        except: pass
    except Exception as e:
        control.log('playcount %s' % e)
        try: dialog.close()
        except: pass


    try:
        if trakt.getTraktIndicatorsInfo() == False: raise Exception()
        if int(watched) == 7: trakt.markTVShowAsWatched(tvdb)
        else: trakt.markTVShowAsNotWatched(tvdb)
        trakt.cachesyncTVShows()
    except:
        pass

        control.refresh()
Exemplo n.º 3
0
def getSeasonIndicators(imdb):
    try:
        if trakt.getTraktIndicatorsInfo() == False: raise Exception()
        indicators = trakt.syncSeason(imdb)
        return indicators
    except:
        pass
Exemplo n.º 4
0
def markMovieDuringPlayback(imdb, watched):
    try:
        if trakt.getTraktIndicatorsInfo() == False: raise Exception()

        if int(watched) == 7:
            trakt.markMovieAsWatched(imdb)
        else:
            trakt.markMovieAsNotWatched(imdb)
        trakt.cachesyncMovies()

        if trakt.getTraktAddonMovieInfo() == True:
            trakt.markMovieAsNotWatched(imdb)
    except:
        pass

    try:
        from metahandler import metahandlers
        metaget = metahandlers.MetaData(preparezip=False)
        metaget.get_meta('movie', name='', imdb_id=imdb)
        metaget.change_watched('movie',
                               name='',
                               imdb_id=imdb,
                               watched=int(watched))
    except:
        pass
Exemplo n.º 5
0
def getSeasonIndicators(imdb):
    try:
        if trakt.getTraktIndicatorsInfo() == False: raise Exception()
        indicators = trakt.syncSeason(imdb)
        return indicators
    except:
        pass
Exemplo n.º 6
0
def getTVShowIndicators(refresh=False):
    try:
        if trakt.getTraktIndicatorsInfo() == True: raise Exception()
        from metahandler import metahandlers
        indicators = metahandlers.MetaData(preparezip=False)
        return indicators
    except:
        pass
    try:
        if trakt.getTraktIndicatorsInfo() == False: raise Exception()
        if refresh == False: timeout = 720
        elif trakt.getWatchedActivity() < trakt.timeoutsyncTVShows(): timeout = 720
        else: timeout = 0
        indicators = trakt.cachesyncTVShows(timeout=timeout)
        return indicators
    except:
        pass
Exemplo n.º 7
0
def movies(imdb, watched):
    try:
        if trakt.getTraktIndicatorsInfo() == False: raise Exception()
        if int(watched) == 7: trakt.markMovieAsWatched(imdb)
        else: trakt.markMovieAsNotWatched(imdb)
        trakt.cachesyncMovies()
        control.refresh()
    except:
        pass

    try:
        from metahandler import metahandlers
        metaget = metahandlers.MetaData(preparezip=False)
        metaget.get_meta('movie', name='', imdb_id=imdb)
        metaget.change_watched('movie', name='', imdb_id=imdb, watched=int(watched))
        if trakt.getTraktIndicatorsInfo() == False: control.refresh()
    except:
        pass
Exemplo n.º 8
0
def getTVShowIndicators(refresh=False):
    try:
        if trakt.getTraktIndicatorsInfo() == True: raise Exception()
        from metahandler import metahandlers
        indicators = metahandlers.MetaData(preparezip=False)
        return indicators
    except:
        pass
    try:
        if trakt.getTraktIndicatorsInfo() == False: raise Exception()
        if refresh == False: timeout = 720
        elif trakt.getWatchedActivity() < trakt.timeoutsyncTVShows():
            timeout = 720
        else:
            timeout = 0
        indicators = trakt.cachesyncTVShows(timeout=timeout)
        return indicators
    except:
        pass
Exemplo n.º 9
0
def episodes(imdb, tvdb, season, episode, watched):
    try:
        if trakt.getTraktIndicatorsInfo() == False: raise Exception()
        if int(watched) == 7: trakt.markEpisodeAsWatched(tvdb, season, episode)
        else: trakt.markEpisodeAsNotWatched(tvdb, season, episode)
        trakt.cachesyncTVShows()
        control.refresh()
    except:
        pass

    try:
        from metahandler import metahandlers
        metaget = metahandlers.MetaData(preparezip=False)
        metaget.get_meta('tvshow', name='', imdb_id=imdb)
        metaget.get_episode_meta('', imdb_id=imdb, season=season, episode=episode)
        metaget.change_watched('episode', '', imdb_id=imdb, season=season, episode=episode, watched=int(watched))
        if trakt.getTraktIndicatorsInfo() == False: control.refresh()
    except:
        pass
Exemplo n.º 10
0
def movies(imdb, watched):
    control.busy()
    try:
        if trakt.getTraktIndicatorsInfo() == False: raise Exception()
        if int(watched) == 7:
            trakt.markMovieAsWatched(imdb)
        else:
            trakt.markMovieAsNotWatched(imdb)
        trakt.cachesyncMovies()
        control.refresh()
    except:
        pass

    try:
        from metahandler import metahandlers
        metaget = metahandlers.MetaData(preparezip=False)
        metaget.get_meta('movie', name='', imdb_id=imdb)
        metaget.change_watched('movie',
                               name='',
                               imdb_id=imdb,
                               watched=int(watched))
        if trakt.getTraktIndicatorsInfo() == False: control.refresh()
    except:
        pass
Exemplo n.º 11
0
def tvshows(tvshowtitle, imdb, tvdb, season, watched):
    try:
        import sys, xbmc

        if not trakt.getTraktIndicatorsInfo() == False: raise Exception()

        from metahandler import metahandlers
        from resources.lib.indexers import episodes

        metaget = metahandlers.MetaData(preparezip=False)

        name = control.addonInfo('name')

        dialog = control.progressDialogBG
        dialog.create(str(name), str(tvshowtitle))
        dialog.update(0, str(name), str(tvshowtitle))

        metaget.get_meta('tvshow', name='', imdb_id=imdb)

        items = episodes.episodes().get(tvshowtitle,
                                        '0',
                                        imdb,
                                        tvdb,
                                        '0',
                                        '0',
                                        idx=False)

        try:
            items = [
                i for i in items
                if int('%01d' % int(season)) == int('%01d' % int(i['season']))
            ]
        except:
            pass
        items = [{
            'label':
            '%s S%02dE%02d' %
            (tvshowtitle, int(i['season']), int(i['episode'])),
            '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()

            dialog.update(int((100 / float(len(items))) * i), str(name),
                          str(items[i]['label']))

            season, episode = items[i]['season'], items[i]['episode']
            metaget.get_episode_meta('',
                                     imdb_id=imdb,
                                     season=season,
                                     episode=episode)
            metaget.change_watched('episode',
                                   '',
                                   imdb_id=imdb,
                                   season=season,
                                   episode=episode,
                                   watched=int(watched))

        try:
            dialog.close()
        except:
            pass
    except Exception as e:
        control.log('playcount %s' % e)
        try:
            dialog.close()
        except:
            pass

    try:
        if trakt.getTraktIndicatorsInfo() == False: raise Exception()
        if int(watched) == 7: trakt.markTVShowAsWatched(tvdb)
        else: trakt.markTVShowAsNotWatched(tvdb)
        trakt.cachesyncTVShows()
    except:
        pass

        control.refresh()
Exemplo n.º 12
0
import sys

from resources.lib.libraries import control
from resources.lib.libraries import trakt

sysaddon = sys.argv[0];
syshandle = int(sys.argv[1])

artPath = control.artPath();
addonFanart = control.addonFanart()

imdbCredentials = False if control.setting('imdb.user') == '' else True

traktCredentials = trakt.getTraktCredentialsInfo()

traktIndicators = trakt.getTraktIndicatorsInfo()

queueMenu = control.lang(32065).encode('utf-8')


class navigator:
    def root(self):
        self.addDirectoryItem(32001, 'movieNavigator', 'movies.png', 'DefaultMovies.png')
        self.addDirectoryItem(32002, 'tvNavigator', 'tvshows.png', 'DefaultTVShows.png')

        if not control.setting('lists.widget') == '0':
            self.addDirectoryItem(32003, 'mymovieNavigator', 'mymovies.png', 'DefaultVideoPlaylists.png')
            self.addDirectoryItem(32004, 'mytvNavigator', 'mytvshows.png', 'DefaultVideoPlaylists.png')

        if not control.setting('movie.widget') == '0':
            self.addDirectoryItem(32005, 'movieWidget', 'latest-movies.png', 'DefaultRecentlyAddedMovies.png')