Community:
Possibilità di inserire nello stesso file menu e liste
This commit is contained in:
+72
-62
@@ -89,7 +89,6 @@ def show_channels(item):
|
|||||||
support.channel_config(item, itemlist)
|
support.channel_config(item, itemlist)
|
||||||
return itemlist
|
return itemlist
|
||||||
|
|
||||||
|
|
||||||
def show_menu(item):
|
def show_menu(item):
|
||||||
global list_data
|
global list_data
|
||||||
itemlist = []
|
itemlist = []
|
||||||
@@ -101,6 +100,7 @@ def show_menu(item):
|
|||||||
item.menu = None
|
item.menu = None
|
||||||
if item.url: itemlist.append(item)
|
if item.url: itemlist.append(item)
|
||||||
for key in menu:
|
for key in menu:
|
||||||
|
support.log("KEY= ",key)
|
||||||
if key != 'search':
|
if key != 'search':
|
||||||
if type(menu[key]) == dict:
|
if type(menu[key]) == dict:
|
||||||
title = menu[key]['title'] if menu[key].has_key('title') else item.title
|
title = menu[key]['title'] if menu[key].has_key('title') else item.title
|
||||||
@@ -132,54 +132,76 @@ def show_menu(item):
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
json_data = load_json(item)
|
json_data = load_json(item)
|
||||||
|
for key in json_data:
|
||||||
|
if key == 'menu':
|
||||||
|
for option in json_data['menu']:
|
||||||
|
thumbnail = relative('thumbnail', option, item.path)
|
||||||
|
fanart = relative('fanart', option, item.path)
|
||||||
|
plot = option['plot'] if option.has_key('plot') else item.plot
|
||||||
|
url = relative('link', option, item.path)
|
||||||
|
submenu = option['submenu'] if option.has_key('submenu') else []
|
||||||
|
level2 = option['level2'] if option.has_key('level2') else []
|
||||||
|
itemlist.append(Item(channel=item.channel,
|
||||||
|
title=format_title(option['title']),
|
||||||
|
fulltitle=option['title'],
|
||||||
|
thumbnail=thumbnail,
|
||||||
|
fanart=fanart,
|
||||||
|
plot=plot,
|
||||||
|
action='show_menu',
|
||||||
|
url=url,
|
||||||
|
path=item.path,
|
||||||
|
menu=level2))
|
||||||
|
|
||||||
if "menu" in json_data:
|
if submenu:
|
||||||
for option in json_data['menu']:
|
for key in submenu:
|
||||||
thumbnail = relative('thumbnail', option, item.path)
|
if key != 'search':
|
||||||
fanart = relative('fanart', option, item.path)
|
if type(submenu[key]) == dict:
|
||||||
plot = option['plot'] if option.has_key('plot') else item.plot
|
title = submenu[key]['title'] if submenu[key].has_key('title') else item.title
|
||||||
url = relative('link', option, item.path)
|
thumbnail = relative('thumbnail', submenu[key], item.path)
|
||||||
submenu = option['submenu'] if option.has_key('submenu') else []
|
plot = submenu[key]['plot'] if submenu[key].has_key('plot') else ''
|
||||||
level2 = option['level2'] if option.has_key('level2') else []
|
else:
|
||||||
itemlist.append(Item(channel=item.channel,
|
title = submenu[key]
|
||||||
title=format_title(option['title']),
|
thumbnail = item.thumbnail
|
||||||
fulltitle=option['title'],
|
plot = ''
|
||||||
thumbnail=thumbnail,
|
|
||||||
fanart=fanart,
|
|
||||||
plot=plot,
|
|
||||||
action='show_menu',
|
|
||||||
url=url,
|
|
||||||
path=item.path,
|
|
||||||
menu=level2))
|
|
||||||
|
|
||||||
if submenu:
|
|
||||||
for key in submenu:
|
|
||||||
if key != 'search':
|
|
||||||
if type(submenu[key]) == dict:
|
|
||||||
title = submenu[key]['title'] if submenu[key].has_key('title') else item.title
|
|
||||||
thumbnail = relative('thumbnail', submenu[key], item.path)
|
|
||||||
plot = submenu[key]['plot'] if submenu[key].has_key('plot') else ''
|
|
||||||
else:
|
|
||||||
title = submenu[key]
|
|
||||||
thumbnail = item.thumbnail
|
|
||||||
plot = ''
|
|
||||||
|
|
||||||
|
itemlist.append(Item(channel=item.channel,
|
||||||
|
title=typo(title,'submenu'),
|
||||||
|
url=url,
|
||||||
|
path=item.path,
|
||||||
|
thumbnail=thumbnail,
|
||||||
|
plot=plot,
|
||||||
|
action='submenu',
|
||||||
|
filterkey=key))
|
||||||
|
if submenu.has_key('search'):
|
||||||
itemlist.append(Item(channel=item.channel,
|
itemlist.append(Item(channel=item.channel,
|
||||||
title=typo(title,'submenu'),
|
title=typo('Cerca ' + option['title'] +'...','color kod bold'),
|
||||||
|
thumbnail=get_thumb('search.png'),
|
||||||
|
action='search',
|
||||||
url=url,
|
url=url,
|
||||||
path=item.path,
|
path=item.path))
|
||||||
thumbnail=thumbnail,
|
|
||||||
plot=plot,
|
elif 'list' in key:
|
||||||
action='submenu',
|
# select type of list
|
||||||
filterkey=key))
|
item.url = { key: json_data[key]}
|
||||||
if submenu.has_key('search'):
|
support.log(item.url)
|
||||||
itemlist.append(Item(channel=item.channel,
|
if key == "movies_list":
|
||||||
title=typo('Cerca ' + option['title'] +'...','color kod bold'),
|
item.media_type = 'movies_list'
|
||||||
thumbnail=get_thumb('search.png'),
|
item.contentType = 'movie'
|
||||||
action='search',
|
item.action = 'findvideos'
|
||||||
url=url,
|
elif key == "tvshows_list":
|
||||||
path=item.path))
|
item.media_type = 'tvshows_list'
|
||||||
# add Search
|
item.contentType = 'tvshow'
|
||||||
|
item.action = 'get_season'
|
||||||
|
elif key == "episodes_list":
|
||||||
|
item.media_type = 'episodes_list'
|
||||||
|
item.contentType = 'episode'
|
||||||
|
item.action = 'episodios'
|
||||||
|
elif key == "generic_list":
|
||||||
|
item.media_type= 'generic_list'
|
||||||
|
itemlist += list_all(item)
|
||||||
|
|
||||||
|
# add Search
|
||||||
|
if 'channel_name' in json_data:
|
||||||
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'),
|
||||||
@@ -187,22 +209,7 @@ def show_menu(item):
|
|||||||
url=item.url,
|
url=item.url,
|
||||||
path=item.path))
|
path=item.path))
|
||||||
|
|
||||||
return itemlist
|
return itemlist
|
||||||
|
|
||||||
# select type of list
|
|
||||||
if json_data.has_key("movies_list"):
|
|
||||||
item.media_type = 'movies_list'
|
|
||||||
item.contentType = 'movie'
|
|
||||||
elif json_data.has_key("tvshows_list"):
|
|
||||||
item.media_type = 'tvshows_list'
|
|
||||||
item.contentType = 'tvshow'
|
|
||||||
elif json_data.has_key("episodes_list"):
|
|
||||||
item.media_type = 'episodes_list'
|
|
||||||
item.contentType = 'episode'
|
|
||||||
elif json_data.has_key("generic_list"):
|
|
||||||
item.media_type= 'generic_list'
|
|
||||||
|
|
||||||
return list_all(item)
|
|
||||||
|
|
||||||
|
|
||||||
def submenu(item):
|
def submenu(item):
|
||||||
@@ -264,7 +271,10 @@ def list_all(item):
|
|||||||
|
|
||||||
itemlist = []
|
itemlist = []
|
||||||
media_type = item.media_type
|
media_type = item.media_type
|
||||||
json_data = load_json(item)
|
if type(item.url) == dict:
|
||||||
|
json_data = item.url
|
||||||
|
else:
|
||||||
|
json_data = load_json(item)
|
||||||
contentTitle = contentSerieName = ''
|
contentTitle = contentSerieName = ''
|
||||||
infoLabels = item.infoLabels if item.infoLabels else {}
|
infoLabels = item.infoLabels if item.infoLabels else {}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user