Example #1
0
	def _get_actor_details():
		from modules.history import add_to_search_history
		try: actors = tmdb_people_info(query)
		except: return None, None, None
		if len(actors) == 1:
			actors = actors[0]
			actor_id = actors['id']
			actor_name = actors['name']
			try: image_id = actors['profile_path']
			except: image_id = None
			if not image_id: actor_image = os.path.join(icon_directory, 'genre_family.png')
			else: actor_image = tmdb_image_url % image_id
		else:
			def _builder():
				for item in actors:
					known_for_list = [i.get('title', 'NA') for i in item['known_for']]
					known_for_list = [i for i in known_for_list if not i == 'NA']
					image = tmdb_image_url % item['profile_path'] if item['profile_path'] else os.path.join(icon_directory, 'genre_family.png')
					yield {'line1': item['name'], 'line2': ', '.join(known_for_list) if known_for_list else '', 'icon': image}
			list_items = list(_builder())
			kwargs = {'items': json.dumps(list_items), 'heading': 'Fen', 'enumerate': 'false', 'multi_choice': 'false', 'multi_line': 'false'}
			selection = select_dialog(actors, **kwargs)
			if selection == None: return None, None, None
			actor_id = int(selection['id'])
			actor_name = selection['name']
			actor_image = tmdb_image_url % selection['profile_path'] if selection['profile_path'] else os.path.join(icon_directory, 'genre_family.png')
		add_to_search_history(actor_name, 'people_queries')
		return actor_name, actor_image, actor_id
Example #2
0
 def _get_actor_details(self):
     from modules.history import add_to_search_history
     actors = TMDb.tmdb_people_info(self.query)
     actor_list = []
     if len(actors) > 1:
         for item in actors:
             known_for_list = [i.get('title', 'NA') for i in item['known_for']]
             known_for_list = [i for i in known_for_list if not i == 'NA']
             known_for = '[I]%s[/I]' % ', '.join(known_for_list) if known_for_list else '[I]Movie Actor[/I]'
             listitem = xbmcgui.ListItem(item['name'], known_for)
             image = 'http://image.tmdb.org/t/p/w185/%s' % item['profile_path'] if item['profile_path'] else os.path.join(icon_directory, 'genre_family.png')
             listitem.setArt({'icon': image})
             listitem.setProperty('id', str(item['id']))
             listitem.setProperty('name', str(item['name']))
             listitem.setProperty('image', str(image.replace('w185', 'h632')))
             actor_list.append(listitem)
         selection = dialog.select("Select Person", actor_list, useDetails=True)
         if selection >= 0:
             actor_id = int(actor_list[selection].getProperty('id'))
             actor_name = actor_list[selection].getProperty('name')
             actor_image = actor_list[selection].getProperty('image')
         else: return None, None, None
     else:
         actors = actors[0]
         actor_id = actors['id']
         actor_name = actors['name']
         try: image_id = actors['profile_path']
         except: image_id = None
         if not image_id: actor_image = os.path.join(icon_directory, 'genre_family.png')
         else: actor_image = 'http://image.tmdb.org/t/p/h632/%s' % image_id
     add_to_search_history(actor_name, 'people_queries')
     return actor_id, actor_name, actor_image
Example #3
0
def tmdb_tv_search(term, page_no):
    from modules.history import add_to_search_history
    add_to_search_history(term, 'tvshow_queries')
    string = "%s_%s_%s" % ('tmdb_tv_search', term, page_no)
    url = 'https://api.themoviedb.org/3/search/tv?api_key=%s&language=en-US&query=%s&page=%s' % (
        tmdb_api, term, page_no)
    return cache_object(get_tmdb, string, url, expiration=4)
Example #4
0
def search_furk(params):
    from modules.history import add_to_search_history
    __handle__ = int(argv[1])
    search_title = clean_file_name(params.get('query')) if (
        'query' in params and params.get('query') != 'NA') else None
    if not search_title: search_title = kodi_utils.dialog.input('Fen')
    try:
        search_name = clean_file_name(unquote(search_title))
        search_method = 'search' if 'accurate_search' in params else 'direct_search'
        search_setting = 'furk_video_queries' if params.get(
            'db_type') == 'video' else 'furk_audio_queries'
        list_type = 'video' if params.get('db_type') == 'video' else 'audio'
        add_to_search_history(search_name, search_setting)
        files = Furk.direct_search(
            search_name) if search_method == 'direct_search' else Furk.search(
                search_name)
        if not files: return kodi_utils.ok_dialog(text=32760, top_space=True)
        try:
            files = [
                i for i in files
                if i.get('is_ready', '0') == '1' and i['type'] == list_type
            ]
        except:
            return kodi_utils.ok_dialog(text=32760, top_space=True)
        furk_file_browser(files, params, 'search', __handle__)
    except:
        pass
    kodi_utils.set_content(__handle__, 'files')
    kodi_utils.end_directory(__handle__)
    kodi_utils.set_view_mode('view.premium')
Example #5
0
def tmdb_tv_search(query, page_no):
    from modules.history import add_to_search_history
    add_to_search_history(query, 'tvshow_queries')
    string = 'tmdb_tv_search_%s_%s' % (query, page_no)
    url = 'https://api.themoviedb.org/3/search/tv?api_key=%s&language=en-US&query=%s&page=%s' % (
        tmdb_api_key(), query, page_no)
    return cache_object(get_tmdb, string, url, expiration=EXPIRY_4_HOURS)
Example #6
0
def imdb_build_keyword_results(db_type, query):
	def _builder():
		for count, item in enumerate(results, 1):
			cm = []
			cm_append = cm.append
			keyword = item[0]
			listings = item[1]
			url_params = {'mode': mode, 'action': 'imdb_keywords_list_contents', 'list_id': keyword.lower(), 'iconImage': 'imdb.png'}
			url_json = json.dumps(url_params)
			add_list_params = {'mode': 'navigator.adjust_main_lists', 'method': 'add_external', 'list_name': '%s (IMDb)' % keyword, 'menu_item': url_json}
			add_folder_params = {'mode': 'navigator.adjust_shortcut_folder_lists', 'method': 'add_external', 'name': '%s (IMDb)' % keyword, 'menu_item': url_json}
			url = build_url(url_params)
			listitem = make_listitem()
			listitem.setLabel('%02d | [B]%s[/B] [I]%s[/I]' % (count, keyword.upper(), listings))
			listitem.setArt({'icon': default_imdb_icon, 'poster': default_imdb_icon, 'thumb': default_imdb_icon, 'fanart': fanart, 'banner': default_imdb_icon})
			cm_append((ls(32730),'RunPlugin(%s)' % build_url(add_list_params)))
			cm_append((ls(32731),'RunPlugin(%s)' % build_url(add_folder_params)))
			listitem.addContextMenuItems(cm)
			yield (url, listitem, True)
	__handle__ = int(argv[1])
	results = imdb_keyword_search(query)
	add_to_search_history(query, 'imdb_keyword_%s_queries' % db_type)
	if not results: return
	mode = 'build_%s_list' % db_type
	kodi_utils.add_items(__handle__, list(_builder()))
	kodi_utils.set_content(__handle__, 'files')
	kodi_utils.end_directory(__handle__)
	kodi_utils.set_view_mode('view.main')
Example #7
0
def trakt_movies_search(query, page_no, letter):
    from modules.history import add_to_search_history
    add_to_search_history(query, 'movie_queries')
    string = 'trakt_movies_search_%s_%s' % (query, page_no)
    url = {
        'path': 'search/movie?query=%s',
        'path_insert': query,
        'params': {
            'limit': 200
        },
        'page': page_no
    }
    original_list = cache_object(get_trakt, string, url, False)
    final_list, total_pages = paginate_list(original_list, page_no, letter)
    return final_list, total_pages
Example #8
0
def search_easynews(params):
    from modules.history import add_to_search_history
    __handle__ = int(argv[1])
    search_title = clean_file_name(params.get('query')) if (
        'query' in params and params.get('query') != 'NA') else None
    if not search_title:
        search_title = kodi_utils.dialog.input('Enter search Term')
    try:
        if search_title:
            search_name = clean_file_name(unquote(search_title))
            add_to_search_history(search_name, 'easynews_video_queries')
            files = EasyNews.search(search_name)
            if not files:
                return kodi_utils.ok_dialog(text=32760, top_space=True)
            easynews_file_browser(files, __handle__)
    except:
        pass
    kodi_utils.set_content(__handle__, 'files')
    kodi_utils.end_directory(__handle__)
    kodi_utils.set_view_mode('view.premium')
Example #9
0
def search_easynews():
    from modules.history import add_to_search_history
    params = dict(parse_qsl(sys.argv[2].replace('?', '')))
    default = params.get('suggestion', '')
    search_title = clean_file_name(params.get('query')) if (
        'query' in params and params.get('query') != 'NA') else None
    if not search_title:
        search_title = dialog.input('Enter search Term',
                                    type=xbmcgui.INPUT_ALPHANUM,
                                    defaultt=default)
    if not search_title: return
    try:
        search_name = clean_file_name(unquote(search_title))
        add_to_search_history(search_name, 'easynews_video_queries')
        files = EasyNews.search(search_name)
        if not files: return dialog.ok('No results', 'No results')
        files = files[0:int(__addon__.getSetting('easynews_limit'))]
        easynews_file_browser(files)
    except:
        pass
    xbmcplugin.setContent(__handle__, 'files')
    xbmcplugin.endOfDirectory(__handle__)
    setView('view.premium')
Example #10
0
def search_furk():
    from modules.history import add_to_search_history
    params = dict(parse_qsl(sys.argv[2].replace('?','')))
    default = params.get('suggestion', '')
    search_title = clean_file_name(params.get('query')) if ('query' in params and params.get('query') != 'NA') else None
    if not search_title: search_title = dialog.input('Enter search Term', type=xbmcgui.INPUT_ALPHANUM, defaultt=default)
    if not search_title: return
    try:
        search_name = clean_file_name(urllib.unquote(search_title))
        search_method = 'search' if 'accurate_search' in params else 'direct_search'
        search_setting = 'furk_video_queries' if params.get('db_type') == 'video' else 'furk_audio_queries'
        list_type = 'video' if params.get('db_type') == 'video' else 'audio'
        add_to_search_history(search_name, search_setting)
        files = Furk.direct_search(search_name) if search_method == 'direct_search' else Furk.search(search_name)
        if not files: return dialog.ok('No results', 'No results')
        if not settings.include_uncached_results():
            try: files = [i for i in files if i.get('is_ready', '0') == '1' and i['type'] == list_type]
            except: return dialog.ok('No results', 'No results')
        files = files[0:int(__addon__.getSetting('furk.limit'))]
        furk_file_browser(files, params, display_mode='search')
    except: pass
    xbmcplugin.setContent(__handle__, 'files')
    xbmcplugin.endOfDirectory(__handle__)
    setView('view.premium')