From ebdd89bc29adedf5ce0e649fdd6f40e05f62b8c3 Mon Sep 17 00:00:00 2001 From: Alhaziel01 Date: Sat, 23 Nov 2019 17:25:49 +0100 Subject: [PATCH] =?UTF-8?q?Community:=20Possibilit=C3=A0=20di=20inserire?= =?UTF-8?q?=20nello=20stesso=20file=20menu=20e=20liste?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- specials/community.py | 134 +++++++++++++++++++++++------------------- 1 file changed, 72 insertions(+), 62 deletions(-) diff --git a/specials/community.py b/specials/community.py index 436fa070..ddd1dae8 100644 --- a/specials/community.py +++ b/specials/community.py @@ -89,7 +89,6 @@ def show_channels(item): support.channel_config(item, itemlist) return itemlist - def show_menu(item): global list_data itemlist = [] @@ -101,6 +100,7 @@ def show_menu(item): item.menu = None if item.url: itemlist.append(item) for key in menu: + support.log("KEY= ",key) if key != 'search': if type(menu[key]) == dict: title = menu[key]['title'] if menu[key].has_key('title') else item.title @@ -132,54 +132,76 @@ def show_menu(item): else: 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: - 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 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 = '' + 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, - title=typo(title,'submenu'), + title=typo('Cerca ' + option['title'] +'...','color kod bold'), + thumbnail=get_thumb('search.png'), + action='search', url=url, - path=item.path, - thumbnail=thumbnail, - plot=plot, - action='submenu', - filterkey=key)) - if submenu.has_key('search'): - itemlist.append(Item(channel=item.channel, - title=typo('Cerca ' + option['title'] +'...','color kod bold'), - thumbnail=get_thumb('search.png'), - action='search', - url=url, - path=item.path)) - # add Search + path=item.path)) + + elif 'list' in key: + # select type of list + item.url = { key: json_data[key]} + support.log(item.url) + if key == "movies_list": + item.media_type = 'movies_list' + item.contentType = 'movie' + item.action = 'findvideos' + elif key == "tvshows_list": + item.media_type = 'tvshows_list' + 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, title=typo('Cerca nel Canale...','color kod bold'), thumbnail=get_thumb('search.png'), @@ -187,22 +209,7 @@ def show_menu(item): url=item.url, path=item.path)) - 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) + return itemlist def submenu(item): @@ -264,7 +271,10 @@ def list_all(item): itemlist = [] 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 = '' infoLabels = item.infoLabels if item.infoLabels else {}