Community Custom Search URL
This commit is contained in:
+47
-19
@@ -97,6 +97,7 @@ def show_channels(item):
|
|||||||
def show_menu(item):
|
def show_menu(item):
|
||||||
global list_data
|
global list_data
|
||||||
itemlist = []
|
itemlist = []
|
||||||
|
add_search = True
|
||||||
support.log()
|
support.log()
|
||||||
# If Second Level Menu
|
# If Second Level Menu
|
||||||
if item.menu:
|
if item.menu:
|
||||||
@@ -127,11 +128,16 @@ def show_menu(item):
|
|||||||
filterkey=key if not url else '' ))
|
filterkey=key if not url else '' ))
|
||||||
|
|
||||||
if menu.has_key('search'):
|
if menu.has_key('search'):
|
||||||
|
if type(menu['search']) == dict and menu['search'].has_key('url'):
|
||||||
|
url = relative('url', menu['search'], item.path)
|
||||||
|
else:
|
||||||
|
url = ''
|
||||||
itemlist.append(Item(channel=item.channel,
|
itemlist.append(Item(channel=item.channel,
|
||||||
title=typo('Cerca ' + item.fulltitle +'...','color kod bold'),
|
title=typo('Cerca ' + item.fulltitle +'...','color kod bold'),
|
||||||
thumbnail=get_thumb('search.png'),
|
thumbnail=get_thumb('search.png'),
|
||||||
action='search',
|
action='search',
|
||||||
url=item.url,
|
url=item.url,
|
||||||
|
custom_url=url,
|
||||||
path=item.path))
|
path=item.path))
|
||||||
return itemlist
|
return itemlist
|
||||||
|
|
||||||
@@ -146,16 +152,28 @@ def show_menu(item):
|
|||||||
url = relative('link', option, item.path)
|
url = relative('link', option, item.path)
|
||||||
submenu = option['submenu'] if option.has_key('submenu') else []
|
submenu = option['submenu'] if option.has_key('submenu') else []
|
||||||
level2 = option['level2'] if option.has_key('level2') else []
|
level2 = option['level2'] if option.has_key('level2') else []
|
||||||
itemlist.append(Item(channel=item.channel,
|
if option.has_key('title'):
|
||||||
title=format_title(option['title']),
|
itemlist.append(Item(channel=item.channel,
|
||||||
fulltitle=option['title'],
|
title=format_title(option['title']),
|
||||||
thumbnail=thumbnail,
|
fulltitle=option['title'],
|
||||||
fanart=fanart,
|
thumbnail=thumbnail,
|
||||||
plot=plot,
|
fanart=fanart,
|
||||||
action='show_menu',
|
plot=plot,
|
||||||
url=url,
|
action='show_menu',
|
||||||
path=item.path,
|
url=url,
|
||||||
menu=level2))
|
path=item.path,
|
||||||
|
menu=level2))
|
||||||
|
if option.has_key('search'):
|
||||||
|
menu = json_data['menu']
|
||||||
|
if type(option['search']) == dict and option['search'].has_key('url'):
|
||||||
|
url = relative('url', option['search'], item.path)
|
||||||
|
itemlist.append(Item(channel=item.channel,
|
||||||
|
title=typo('Cerca nel Canale...','color kod bold'),
|
||||||
|
thumbnail=get_thumb('search.png'),
|
||||||
|
action='search',
|
||||||
|
url=url,
|
||||||
|
path=item.path))
|
||||||
|
add_search = False
|
||||||
|
|
||||||
if submenu:
|
if submenu:
|
||||||
for key in submenu:
|
for key in submenu:
|
||||||
@@ -177,6 +195,10 @@ def show_menu(item):
|
|||||||
action='submenu',
|
action='submenu',
|
||||||
filterkey=key))
|
filterkey=key))
|
||||||
if submenu.has_key('search'):
|
if submenu.has_key('search'):
|
||||||
|
if type(submenu['search']) == dict and submenu['search'].has_key('url'):
|
||||||
|
url = relative('url', submenu['search'], item.path)
|
||||||
|
else:
|
||||||
|
url = ''
|
||||||
itemlist.append(Item(channel=item.channel,
|
itemlist.append(Item(channel=item.channel,
|
||||||
title=typo('Cerca ' + option['title'] +'...','color kod bold'),
|
title=typo('Cerca ' + option['title'] +'...','color kod bold'),
|
||||||
thumbnail=get_thumb('search.png'),
|
thumbnail=get_thumb('search.png'),
|
||||||
@@ -205,13 +227,13 @@ def show_menu(item):
|
|||||||
itemlist += list_all(item)
|
itemlist += list_all(item)
|
||||||
|
|
||||||
# add Search
|
# add Search
|
||||||
if 'channel_name' in json_data:
|
if 'channel_name' in json_data and add_search:
|
||||||
itemlist.append(Item(channel=item.channel,
|
itemlist.append(Item(channel=item.channel,
|
||||||
title=typo('Cerca nel Canale...','color kod bold'),
|
title=typo('Cerca nel Canale...','color kod bold'),
|
||||||
thumbnail=get_thumb('search.png'),
|
thumbnail=get_thumb('search.png'),
|
||||||
action='search',
|
action='search',
|
||||||
url=item.url,
|
url=item.url,
|
||||||
path=item.path))
|
path=item.path))
|
||||||
|
|
||||||
return itemlist
|
return itemlist
|
||||||
|
|
||||||
@@ -245,6 +267,7 @@ def submenu(item):
|
|||||||
thumbnail = ''
|
thumbnail = ''
|
||||||
plot = ''
|
plot = ''
|
||||||
if item.filterkey in ['director','actors']:
|
if item.filterkey in ['director','actors']:
|
||||||
|
tmdb.set_infoLabels(itemlist, seekTmdb=True)
|
||||||
load_info = load_json('http://api.themoviedb.org/3/search/person/?api_key=' + tmdb_api + '&language=' + lang + '&query=' + filter)
|
load_info = load_json('http://api.themoviedb.org/3/search/person/?api_key=' + tmdb_api + '&language=' + lang + '&query=' + filter)
|
||||||
id = str(load_info['results'][0]['id']) if load_info.has_key('results') else ''
|
id = str(load_info['results'][0]['id']) if load_info.has_key('results') else ''
|
||||||
if id:
|
if id:
|
||||||
@@ -655,7 +678,9 @@ def add_channel(item):
|
|||||||
|
|
||||||
community_json = open(path, "r")
|
community_json = open(path, "r")
|
||||||
community_json = jsontools.load(community_json.read())
|
community_json = jsontools.load(community_json.read())
|
||||||
id = len(community_json['channels']) + 1
|
id = 1
|
||||||
|
while community_json['channels'].has_key(str(id)):
|
||||||
|
id +=1
|
||||||
community_json['channels'][id]=(channel_to_add)
|
community_json['channels'][id]=(channel_to_add)
|
||||||
|
|
||||||
with open(path, "w") as file:
|
with open(path, "w") as file:
|
||||||
@@ -732,6 +757,8 @@ def format_title(title):
|
|||||||
|
|
||||||
def search(item, text):
|
def search(item, text):
|
||||||
support.log('Search ', text)
|
support.log('Search ', text)
|
||||||
|
if item.custom_url:
|
||||||
|
item.url=item.custom_url + text
|
||||||
itemlist = []
|
itemlist = []
|
||||||
json_data = load_json(item)
|
json_data = load_json(item)
|
||||||
|
|
||||||
@@ -782,8 +809,9 @@ def load_links(item, itemlist, json_data, text):
|
|||||||
|
|
||||||
if json_data.has_key('menu'):
|
if json_data.has_key('menu'):
|
||||||
for option in json_data['menu']:
|
for option in json_data['menu']:
|
||||||
json_data = load_json(option['link'] if option['link'].startswith('http') else item.path+option['link'])
|
if option.has_key('link'):
|
||||||
load_links(item, itemlist, json_data, text)
|
json_data = load_json(option['link'] if option['link'].startswith('http') else item.path+option['link'])
|
||||||
|
load_links(item, itemlist, json_data, text)
|
||||||
else:
|
else:
|
||||||
links(item, itemlist, json_data, text)
|
links(item, itemlist, json_data, text)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user