def getWatchlistShows(): tot = 0 shows = traktlib.getWatchlistShowsfromTrakt() # for myshow in shows: # # seasons = traktlib.getSeasons(myshow['tvdb_id']) # common.Notification('Getting:', myshow['title']) # for season in seasons: # if season['season']==0: # continue # #print 'Season:' + str(season['season']) # episodes = traktlib.getEpisodes(myshow['tvdb_id'],season['season']) # for myepisode in episodes: # if not False: #myepisode['watched']: # #print episode['title'] # tot = tot + common.createShowStrm(myshow['title'],myepisode['season'],myepisode['number'],myshow['tvdb_id']) # return tot for myshow in shows: if common.checkEnded(myshow['title']) == False: fullshow = traktlib.getFullShow(myshow['tvdb_id']) seasons = fullshow['seasons'] common.Notification('Getting:', myshow['title']) for season in seasons: if season['season']==0: continue episodes = season['episodes'] for myepisode in episodes: tot = tot + common.createShowStrm(myshow['title'],myepisode['season'],myepisode['number'],myshow['tvdb_id']) common.putShowStatus(fullshow['title'],fullshow['status']) return tot
def getWatchlistShows(): tot = 0 shows = traktlib.getWatchlistShowsfromTrakt() for myshow in shows: if common.checkEnded(myshow['title']) == False: fullshow = traktlib.getFullShow(myshow['tvdb_id']) seasons = fullshow['seasons'] common.Notification('Getting:', myshow['title']) for season in seasons: if season['season']==0: continue episodes = season['episodes'] for myepisode in episodes: tot = tot + common.createShowStrm(myshow['title'],myepisode['season'],myepisode['number'],myshow['tvdb_id']) common.putShowStatus(fullshow['title'],fullshow['status']) return tot
def traktAction(params): if(params['action'] == 'trakt_Menu'): displayTraktMenu() elif(params['action'] == 'trakt_SearchMovies'): # Search keyboard = xbmc.Keyboard('', 'Search') keyboard.doModal() if keyboard.isConfirmed(): query = keyboard.getText() movies = traktlib.getMovieInfobySearch(unicode(query)) for movie in movies: common.createMovieListItemTrakt(movie,totalItems = len(movies)) common.endofDir() elif(params['action'] == 'trakt_SearchShows'): # Search keyboard = xbmc.Keyboard('', 'Search') keyboard.doModal() if keyboard.isConfirmed(): query = keyboard.getText() shows = traktlib.getShowInfobySearch(unicode(query)) for show in shows: common.createShowListItemTrakt(show,totalItems = len(shows)) common.endofDir() elif(params['action'] == 'trakt_SeenRate'): imdbid = params['imdbid'] traktSeenRate(imdbid) elif(params['action'] == 'trakt_DismissMovie'): imdbid = params['imdbid'] traktDismissMovie(imdbid) elif(params['action'] == 'trakt_MovieGenres'): displayGenres(type='Movie') elif(params['action'] == 'trakt_ShowGenres'): displayGenres(type='Show') elif(params['action'] == 'trakt_RecommendedShows'): try: genre = params['genre'] except: genre = None if genre: displayRecommendedShows(genre) else : url = sys.argv[0]+'?action=trakt_ShowGenres' common.createListItem('Filter by Genre', True, url) displayRecommendedShows(genre) elif(params['action'] == 'trakt_listfeeds'): myfeeds = furklib.myFeeds()['feeds'] myfeeds = sorted(myfeeds,key=lambda feed: feed['name']) url = sys.argv[0]+'?action=trakt_addfeeds' common.createListItem('Add Feeds from trakt', True, url) for feed in myfeeds: url = sys.argv[0]+'?action=trakt_MovieGenres' common.createListItem(feed['name'], True, url) common.endofDir() elif(params['action'] == 'trakt_addfeeds'): myfeeds = furklib.myFeeds()['feeds'] shows = traktlib.getWatchlistShowsfromTrakt() progress = traktlib.getProgress() series = [] for current in progress: series.append(current['show']) shows = shows + series for show in shows: check = [feed for feed in myfeeds if feed['name'] == show['title']] if len(check)==0: furklib.addFeed(show['title']) url = sys.argv[0]+'?action=trakt_MovieGenres' common.createListItem(show['title'], False, '') common.endofDir() elif(params['action'] == 'trakt_RecommendedMovies'): try: genre = params['genre'] except: genre = None if genre: displayRecommendedMovies(genre) else : url = sys.argv[0]+'?action=trakt_MovieGenres' common.createListItem('Filter by Genre', True, url) displayRecommendedMovies(genre) elif(params['action'] == 'trakt_AddShowtoWatchlist'): tvdbid = params['tvdbid'] addShowtoWatchlist(tvdbid) elif(params['action'] == 'trakt_AddMovietoWatchlist'): imdbid = params['imdbid'] addMovietoWatchlist(imdbid) elif(params['action'] == 'trakt_RemoveMoviefromWatchlist'): imdbid = params['imdbid'] response = traktlib.removeMoviefromWatchlist(imdbid) common.traktResponse(response) elif(params['action'] == 'trakt_DismissShow'): tvdbid = params['tvdbid'] traktDismissShow(tvdbid) elif(params['action'] == 'trakt_SetShowSeen'): tvdbid = params['tvdbid'] try: season = params['season'] episode = params['episode'] except: season = 100 episode = 100 response = traktSeenShow(tvdbid,season,episode) elif(params['action'] == 'trakt_TrendingMovies'): movies = traktlib.getTrendingMoviesFromTrakt() for movie in movies: common.createMovieListItemTrakt(movie,totalItems = len(movies)) common.endofDir() elif(params['action'] == 'trakt_TrendingShows'): shows = traktlib.getTrendingShowsFromTrakt() progressShows = calculateProgress() for show in shows: if show['title'] in progressShows: common.createShowListItemTrakt(show,len(shows),progressShows[show['title']][0],progressShows[show['title']][1]) else: common.createShowListItemTrakt(show,totalItems = len(shows)) common.endofDir() elif(params['action'] == 'trakt_Progress'): displayProgress() elif(params['action'] == 'trakt_getList'): user=params['user'] slug=params['slug'] displayList(user,slug) else: common.Notification('Action Not found:' , params['action'])