Ejemplo n.º 1
0
def traktSeenRate(imdbid):
	mymovie = traktlib.getMovieInfobyImdbid(imdbid)
	movie = {}
	movie['imdb_id'] = mymovie['imdb_id']
	movie['title']= mymovie['title']
	movie['year']= mymovie['year']
	ratings = []
	for i in range(1,11):
		ratings.append(str(i))
	dialog = xbmcgui.Dialog()
	myrating = dialog.select('Rating', ratings)
	if myrating==-1: return
	movie['rating'] = ratings[myrating]
	response = traktlib.setRating(movie,'movie')
	common.traktResponse(response)
	args = {}
	movie = {}
	args['movies'] = []
	movie['imdb_id'] = mymovie['imdb_id']
	movie['title']= mymovie['title']
	movie['year']= mymovie['year']
	movie['plays'] = 1
	movie['last_played'] = int(time.time())
	args['movies'].append(movie)
	traktlib.setSeen(args)
	return
Ejemplo n.º 2
0
def addMovietoWatchlist(imdbid):
	response = traktlib.addMovietoWatchlist(imdbid)
	common.traktResponse(response)
	movies = traktlib.getWatchlistMoviesFromTrakt()
	for movie in movies:
		common.createMovieStrm(movie['title'],movie['year'],movie['imdb_id'])
	        common.createMovieNfo(movie['title'],movie['year'],movie['imdb_id'])
	xbmc.executebuiltin('UpdateLibrary(video)')
Ejemplo n.º 3
0
def traktSeenShow(tvdbid,season,episode):
	show = {}
	show['tvdb_id'] = tvdbid
	if season==100:
		ratings = []
		for i in range(1,11):
			ratings.append(str(i))
		dialog = xbmcgui.Dialog()
		myrating = dialog.select('Rating', ratings)
		if myrating==-1: return
		show['rating'] = ratings[myrating]
		response = traktlib.setRating(show,'show')
		common.traktResponse(response)

	response = traktlib.setShowSeen(tvdbid,season,episode)
	common.traktResponse(response)


	return
Ejemplo n.º 4
0
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'])
Ejemplo n.º 5
0
def addShowtoWatchlist(tvdbid):
	response = traktlib.addShowtoWatchList(tvdbid)
	common.traktResponse(response)
	getWatchlistShows()
	xbmc.executebuiltin('UpdateLibrary(video)')