Exemplo n.º 1
0
def menu():
    autoupdates.STARTUP()
    if kodi.get_setting('trakt_authorized') == 'true':
        kodi.addDir("Parent Approved Movies",
                    '',
                    'custom_movie_lists',
                    artwork + 'movies.png',
                    '',
                    1,
                    '',
                    '',
                    fanart=fanart)
        kodi.addDir("Parent Approved TV Shows",
                    '',
                    'custom_tv_lists',
                    artwork + 'tvshows.png',
                    '',
                    1,
                    '',
                    '',
                    fanart=fanart)
    if kodi.get_setting('trakt_authorized') == 'false':
        kodi.addDir("[COLOR gold]Requires Trakt Integration[/COLOR]",
                    messages + 'trakt_auth.txt',
                    'get_pin',
                    artwork + 'trakt.png',
                    '',
                    1,
                    '',
                    '',
                    fanart=fanart,
                    is_playable=False,
                    is_folder=True)
    kodi.auto_view('menu')
Exemplo n.º 2
0
def custom_list_view_tv(trakt_id,media):
	try:
		lists = trakt_api.get_special_list('kids',media)#is actually SLUG ID
		for e in lists:
			infoLabels = trakt_api.process_movie(e)
			infoLabels.update(make_infoLabels(e))
			menu_items=[]
			trakt_id = str(infoLabels['trakt_id'])
			trailer = infoLabels['trailer_url']
			year = str(infoLabels['year'])
			name = infoLabels['title'].encode('utf-8')
			thumb=infoLabels['cover_url']
			if thumb is None:
				thumb = ''
			menu_items.append(('[COLOR gold]Show Information[/COLOR]', 'XBMC.Action(Info)'))
			if trailer:
				utube = tools.make_trailer(trailer)
				menu_items.append(('[COLOR gold]Play Trailer[/COLOR]', 'PlayMedia('+utube+',xbmcgui.ListItem(title, iconImage=image, thumbnailImage=image))'))


			kodi.addDir(name+' ('+year+')','','find_season',thumb,name,5,trakt_id,'shows',meta_data=infoLabels,menu_items=menu_items,replace_menu=False)
			kodi.auto_view('tvshows')
	except Exception as e:
		log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
		if kodi.get_setting('error_notify') == "true":
			kodi.notify(header='Custom List Error',msg='(error) %s  %s' % (str(e), ''),duration=5000,sound=None)
Exemplo n.º 3
0
def menu():
	autoupdates.STARTUP()
	if  kodi.get_setting('trakt_authorized') =='true':
		kodi.addDir("Parent Approved Movies",'','custom_movie_lists',artwork+'movies.png','',1,'','',fanart=fanart)
		kodi.addDir("Parent Approved TV Shows",'','custom_tv_lists',artwork+'tvshows.png','',1,'','',fanart=fanart)
	if  kodi.get_setting('trakt_authorized') =='false':
		kodi.addDir("[COLOR gold]Requires Trakt Integration[/COLOR]",messages+'trakt_auth.txt','get_pin',artwork+'trakt.png','',1,'','',fanart=fanart,is_playable=False,is_folder=True)
	kodi.auto_view('menu')
Exemplo n.º 4
0
def find_episode(name,trakt_id,movie_title):

	try:
		media ='episode'
		season = name.replace('Season ','')
		#print "SHOW TRAKT IS : "+trakt_id
		link = trakt_api.get_show_episodes(trakt_id,season)
		for e in link:
			ep_trakt_id= e['ids']['trakt']
			#print "Episode TRAKT ID IS  : "+str(ep_trakt_id)
			infoLabels={}
			infoLabels.update(make_infoLabels(e))
			episode = infoLabels['episode']
			infoLabels = trakt_api.get_episode_details(trakt_id,season,episode)
			menu_items=[]
			trailer = infoLabels['trailer_url']
			year = str(infoLabels['year'])
			name = infoLabels['title'].encode('utf-8')
			thumb=infoLabels['cover_url']
			# ################
			was_watched=watched_cache.get_watched_cache(ep_trakt_id)
			if was_watched is not None:
				infoLabels['playcount'] = 1
			# ################
			if thumb is None:
				thumb = ''
			#print infoLabels['premiered'][:10]
			#if (episode['first_aired'] != None and utils2.iso_2_utc(episode['first_aired']) <= time.time()) or (include_unknown and episode['first_aired'] == None):
			d1 = str(infoLabels['premiered'])
			d2 = str(datetime.date.today())
			#print today - was_aired
			#if infoLabels['premiered'] =='':
			if d1 >= d2 or infoLabels['premiered'] == '':
				if name is not '':
					menu_items.append(('[COLOR gold]Show Information[/COLOR]', 'XBMC.Action(Info)'))
					kodi.addDir('[COLOR maroon]S'+str(season)+'E'+str(episode)+'  '+name+'[/COLOR]','','findsource',thumb,movie_title,5,'','shows',meta_data=infoLabels,menu_items=menu_items,replace_menu=True)
					#name = name+" [COLOR red]Coming Soon[/COLOR]"
			else:
				menu_items.append(('[COLOR gold]Show Information[/COLOR]', 'XBMC.Action(Info)'))
				kodi.addDir('S'+str(season)+'E'+str(episode)+'  '+name,'','findsource',thumb,movie_title,5,'','shows',meta_data=infoLabels,menu_items=menu_items,replace_menu=True)
			kodi.auto_view('episode')
	except Exception as e:
		log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
		if kodi.get_setting('error_notify') == "true":
			kodi.notify(header='Trakt Episodes',msg='(error) %s  %s' % (str(e), ''),duration=5000,sound=None)
Exemplo n.º 5
0
def custom_list_view(trakt_id, media):
    try:
        lists = trakt_api.get_special_list(trakt_id,
                                           media)  #is actually SLUG ID
        for e in lists:
            infoLabels = trakt_api.process_movie(e)
            infoLabels.update(make_infoLabels(e))
            menu_items = []
            trakt_id = str(infoLabels['trakt_id'])
            trailer = infoLabels['trailer_url']
            year = str(infoLabels['year'])
            name = infoLabels['title'].encode('utf-8')
            thumb = infoLabels['cover_url']
            if thumb is None:
                thumb = ''
            menu_items.append(
                ('[COLOR gold]Show Information[/COLOR]', 'XBMC.Action(Info)'))
            if trailer:
                utube = tools.make_trailer(trailer)
                menu_items.append((
                    '[COLOR gold]Play Trailer[/COLOR]', 'PlayMedia(' + utube +
                    ',xbmcgui.ListItem(title, iconImage=image, thumbnailImage=image))'
                ))

            kodi.addDir(name + ' (' + year + ')',
                        '',
                        'findsource',
                        thumb,
                        name,
                        5,
                        '',
                        'movies',
                        meta_data=infoLabels,
                        menu_items=menu_items,
                        replace_menu=False)
            kodi.auto_view('movies')
    except Exception as e:
        log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
        if kodi.get_setting('error_notify') == "true":
            kodi.notify(header='Custom List Error',
                        msg='(error) %s  %s' % (str(e), ''),
                        duration=5000,
                        sound=None)
Exemplo n.º 6
0
def find_season(name,trakt_id):

	try:
		media = 'shows'
		movie_title =name
		print "TRAKT ID IS : "+trakt_id
		link = trakt_api.get_show_seasons(trakt_id)
		for e in link:
					infoLabels = trakt_api.process_show(e)
					infoLabels.update(make_infoLabels(e))
					#trakt_id = str(infoLabels['trakt_id'])
					if infoLabels['cover_url'] == None:
						infoLabels['cover_url'] = artwork+'place_poster.png'
					menu_items=[]
					menu_items.append(('[COLOR gold]Show Information[/COLOR]', 'XBMC.Action(Info)'))
					#if kodi.get_setting('trakt_authorized') == 'true':
						#menu_items.append(('[COLOR gold]Mark as Watched[/COLOR]',      'RunPlugin(%s)' % addon.build_plugin_url({'trakt_id':trakt_id, 'mode':'add_watched_history', 'name':name, 'media':media})))
					kodi.addDir('Season '+str(infoLabels['number']),'','find_episode',infoLabels['cover_url'],movie_title,5,trakt_id,'shows',meta_data=infoLabels,menu_items=menu_items,replace_menu=True)
					kodi.auto_view('season')
	except Exception as e:
		log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
		if kodi.get_setting('error_notify') == "true":
			kodi.notify(header='Trakt Seasons',msg='(error) %s  %s' % (str(e), ''),duration=5000,sound=None)
Exemplo n.º 7
0
def find_season(name, trakt_id):

    try:
        media = 'shows'
        movie_title = name
        print "TRAKT ID IS : " + trakt_id
        link = trakt_api.get_show_seasons(trakt_id)
        for e in link:
            infoLabels = trakt_api.process_show(e)
            infoLabels.update(make_infoLabels(e))
            #trakt_id = str(infoLabels['trakt_id'])
            if infoLabels['cover_url'] == None:
                infoLabels['cover_url'] = artwork + 'place_poster.png'
            menu_items = []
            menu_items.append(
                ('[COLOR gold]Show Information[/COLOR]', 'XBMC.Action(Info)'))
            #if kodi.get_setting('trakt_authorized') == 'true':
            #menu_items.append(('[COLOR gold]Mark as Watched[/COLOR]',      'RunPlugin(%s)' % addon.build_plugin_url({'trakt_id':trakt_id, 'mode':'add_watched_history', 'name':name, 'media':media})))
            kodi.addDir('Season ' + str(infoLabels['number']),
                        '',
                        'find_episode',
                        infoLabels['cover_url'],
                        movie_title,
                        5,
                        trakt_id,
                        'shows',
                        meta_data=infoLabels,
                        menu_items=menu_items,
                        replace_menu=True)
            kodi.auto_view('season')
    except Exception as e:
        log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
        if kodi.get_setting('error_notify') == "true":
            kodi.notify(header='Trakt Seasons',
                        msg='(error) %s  %s' % (str(e), ''),
                        duration=5000,
                        sound=None)
Exemplo n.º 8
0
def find_episode(name, trakt_id, movie_title):

    try:
        media = 'episode'
        season = name.replace('Season ', '')
        #print "SHOW TRAKT IS : "+trakt_id
        link = trakt_api.get_show_episodes(trakt_id, season)
        for e in link:
            ep_trakt_id = e['ids']['trakt']
            #print "Episode TRAKT ID IS  : "+str(ep_trakt_id)
            infoLabels = {}
            infoLabels.update(make_infoLabels(e))
            episode = infoLabels['episode']
            infoLabels = trakt_api.get_episode_details(trakt_id, season,
                                                       episode)
            menu_items = []
            trailer = infoLabels['trailer_url']
            year = str(infoLabels['year'])
            name = infoLabels['title'].encode('utf-8')
            thumb = infoLabels['cover_url']
            # ################
            was_watched = watched_cache.get_watched_cache(ep_trakt_id)
            if was_watched is not None:
                infoLabels['playcount'] = 1
            # ################
            if thumb is None:
                thumb = ''
            #print infoLabels['premiered'][:10]
            #if (episode['first_aired'] != None and utils2.iso_2_utc(episode['first_aired']) <= time.time()) or (include_unknown and episode['first_aired'] == None):
            d1 = str(infoLabels['premiered'])
            d2 = str(datetime.date.today())
            #print today - was_aired
            #if infoLabels['premiered'] =='':
            if d1 >= d2 or infoLabels['premiered'] == '':
                if name is not '':
                    menu_items.append(('[COLOR gold]Show Information[/COLOR]',
                                       'XBMC.Action(Info)'))
                    kodi.addDir('[COLOR maroon]S' + str(season) + 'E' +
                                str(episode) + '  ' + name + '[/COLOR]',
                                '',
                                'findsource',
                                thumb,
                                movie_title,
                                5,
                                '',
                                'shows',
                                meta_data=infoLabels,
                                menu_items=menu_items,
                                replace_menu=True)
                    #name = name+" [COLOR red]Coming Soon[/COLOR]"
            else:
                menu_items.append(('[COLOR gold]Show Information[/COLOR]',
                                   'XBMC.Action(Info)'))
                kodi.addDir('S' + str(season) + 'E' + str(episode) + '  ' +
                            name,
                            '',
                            'findsource',
                            thumb,
                            movie_title,
                            5,
                            '',
                            'shows',
                            meta_data=infoLabels,
                            menu_items=menu_items,
                            replace_menu=True)
            kodi.auto_view('episode')
    except Exception as e:
        log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
        if kodi.get_setting('error_notify') == "true":
            kodi.notify(header='Trakt Episodes',
                        msg='(error) %s  %s' % (str(e), ''),
                        duration=5000,
                        sound=None)