Agregada opcion para poner inicio desde cualquier canal

This commit is contained in:
Unknown
2017-11-29 13:08:51 -03:00
parent aa5fa6d275
commit ef962d7ed2
8 changed files with 141 additions and 42 deletions
+2 -11
View File
@@ -16,6 +16,7 @@ from core.item import Item
from platformcode import config, logger from platformcode import config, logger
from platformcode import platformtools from platformcode import platformtools
from core import jsontools from core import jsontools
from channels import side_menu
THUMBNAILS = {'0': 'posters', '1': 'banners', '2': 'squares'} THUMBNAILS = {'0': 'posters', '1': 'banners', '2': 'squares'}
@@ -205,16 +206,6 @@ def add_menu_items(item, itemlist):
return itemlist return itemlist
def set_menu_settings(item):
if os.path.exists(menu_settings_path):
menu_node = jsontools.get_node_from_file('menu_settings_data.json', 'menu')
else:
menu_node = {}
menu_node['categoria actual'] = item.extra
jsontools.update_node(menu_node, 'menu_settings_data.json', "menu")
def novedades(item): def novedades(item):
logger.info() logger.info()
@@ -248,7 +239,7 @@ def novedades(item):
list_canales, any_active = get_channels_list() list_canales, any_active = get_channels_list()
if mode=='silent' and any_active and len(list_canales[item.extra]) > 0: if mode=='silent' and any_active and len(list_canales[item.extra]) > 0:
set_menu_settings(item) side_menu.set_menu_settings(item)
aux_list=[] aux_list=[]
for canal in list_canales[item.extra]: for canal in list_canales[item.extra]:
if len(aux_list)<2: if len(aux_list)<2:
+122 -27
View File
@@ -9,8 +9,17 @@ from platformcode import launcher
import xbmc, xbmcgui, xbmcplugin, xbmcaddon import xbmc, xbmcgui, xbmcplugin, xbmcaddon
media_path = os.path.join(config.get_runtime_path(), "resources/skins/Default/media/side_menu/") media_path = os.path.join(config.get_runtime_path(), "resources/skins/Default/media/side_menu/")
menu_settings_path = os.path.join(config.get_data_path(), "settings_channels", 'menu_settings_data.json')
if os.path.exists(menu_settings_path):
menu_node = jsontools.get_node_from_file('menu_setting_data.json', 'menu')
else:
menu_node = {'categoria actual':config.get_setting('category')}
jsontools.update_node(menu_node, 'menu_settings_data.json', "menu")
menu_node = jsontools.get_node_from_file('menu_settings_data.json', 'menu') menu_node = jsontools.get_node_from_file('menu_settings_data.json', 'menu')
category = menu_node['categoria actual'] if 'categoria actual' in menu_node:
category = menu_node['categoria actual']
ACTION_SHOW_FULLSCREEN = 36 ACTION_SHOW_FULLSCREEN = 36
ACTION_GESTURE_SWIPE_LEFT = 511 ACTION_GESTURE_SWIPE_LEFT = 511
@@ -21,6 +30,49 @@ ACTION_MOVE_RIGHT = 2
ACTION_MOVE_DOWN = 4 ACTION_MOVE_DOWN = 4
ACTION_MOVE_UP = 3 ACTION_MOVE_UP = 3
def set_menu_settings(item):
if os.path.exists(menu_settings_path):
menu_node = jsontools.get_node_from_file('menu_settings_data.json', 'menu')
else:
menu_node = {}
menu_node['categoria actual'] = item.extra
jsontools.update_node(menu_node, 'menu_settings_data.json', "menu")
def check_user_home(item):
logger.info()
if os.path.exists(menu_settings_path):
menu_node = jsontools.get_node_from_file('menu_settings_data.json', 'menu')
if 'user_home' in menu_node:
item = Item().fromurl(menu_node['user_home'])
else:
item = Item(channel="channelselector", action="getmainlist", viewmode="movie")
return item
def set_home(item):
logger.info()
if os.path.exists(menu_settings_path):
menu_node = jsontools.get_node_from_file('menu_settings_data.json', 'menu')
parent_item= Item().fromurl(item.parent)
logger.debug(item)
logger.debug(parent_item)
menu_node['user_home']=item.parent
jsontools.update_node(menu_node, 'menu_settings_data.json', "menu")
def get_start_page():
logger.info()
category = config.get_setting('category').lower()
if category != 'definido':
item = Item(channel="news", action="novedades", extra=category, mode='silent')
else:
from channels import side_menu
item = Item()
item = side_menu.check_user_home(item)
return item
def open_menu(item): def open_menu(item):
@@ -37,27 +89,37 @@ class Main(xbmcgui.WindowXMLDialog):
self.setCoordinateResolution(2) self.setCoordinateResolution(2)
self.focus = -1 self.focus = -1
self.buttons = [] self.buttons = []
posx= 22 posx= 0
posy= 170 posy= 170
space = 30 space = 30
selected = 'selected.png' selected = 'selected.png'
width = 216 width = 260
height = 30 height = 30
textcolor = "0xff000000" textcolor = "0xffffd700"
shadow = "0xFFffff00" shadow = "0xFF000000"
offsetx = 30 offsetx = 30
font = 'font32_title'
label = 'Menú Clasico' label = 'Menú Clasico'
self.button_alfa = xbmcgui.ControlButton(posx, posy, width, height, label, font='font14', alignment=0x00000000, self.button_alfa = xbmcgui.ControlButton(posx, posy, width, height, label, font=font, alignment=0x00000000,
noFocusTexture='', focusTexture=media_path+selected, noFocusTexture='', focusTexture=media_path+selected,
textColor=textcolor, shadowColor=shadow, textOffsetX=offsetx, textColor=textcolor, shadowColor=shadow, textOffsetX=offsetx,
textOffsetY=-3) textOffsetY=-3)
self.addControl(self.button_alfa) self.addControl(self.button_alfa)
self.buttons.append(self.button_alfa) self.buttons.append(self.button_alfa)
posy += space*2
label = 'Inicio'
self.button_start = xbmcgui.ControlButton(posx, posy, width, height, label, font=font, alignment=0x00000000,
noFocusTexture='', focusTexture=media_path + selected,
textColor=textcolor, shadowColor=shadow, textOffsetX=offsetx,
textOffsetY=-3)
self.addControl(self.button_start)
self.buttons.append(self.button_start)
posy += space*2 posy += space*2
label = 'Peliculas' label = 'Peliculas'
self.button_peliculas = xbmcgui.ControlButton(posx, posy, width, height, label, font='font14', self.button_peliculas = xbmcgui.ControlButton(posx, posy, width, height, label, font=font,
alignment=0x00000000, noFocusTexture='', alignment=0x00000000, noFocusTexture='',
focusTexture=media_path+selected, textColor=textcolor, focusTexture=media_path+selected, textColor=textcolor,
shadowColor=shadow, textOffsetX=offsetx, textOffsetY=-3) shadowColor=shadow, textOffsetX=offsetx, textOffsetY=-3)
@@ -65,7 +127,7 @@ class Main(xbmcgui.WindowXMLDialog):
self.buttons.append(self.button_peliculas) self.buttons.append(self.button_peliculas)
posy += space posy += space
label = 'Series' label = 'Series'
self.button_series = xbmcgui.ControlButton(posx, posy, width, height, label, font='font14', self.button_series = xbmcgui.ControlButton(posx, posy, width, height, label, font=font,
alignment=0x00000000, noFocusTexture='', alignment=0x00000000, noFocusTexture='',
focusTexture=media_path+selected, textColor=textcolor, focusTexture=media_path+selected, textColor=textcolor,
shadowColor=shadow, textOffsetX=offsetx, textOffsetY=-3) shadowColor=shadow, textOffsetX=offsetx, textOffsetY=-3)
@@ -73,7 +135,7 @@ class Main(xbmcgui.WindowXMLDialog):
self.buttons.append(self.button_series) self.buttons.append(self.button_series)
posy += space posy += space
label = 'Anime' label = 'Anime'
self.button_anime = xbmcgui.ControlButton(posx, posy, width, height, label, font='font14', alignment=0x00000000, self.button_anime = xbmcgui.ControlButton(posx, posy, width, height, label, font=font, alignment=0x00000000,
noFocusTexture='', focusTexture=media_path+selected, noFocusTexture='', focusTexture=media_path+selected,
textColor=textcolor, shadowColor=shadow, textOffsetX=offsetx, textColor=textcolor, shadowColor=shadow, textOffsetX=offsetx,
textOffsetY=-3) textOffsetY=-3)
@@ -81,7 +143,7 @@ class Main(xbmcgui.WindowXMLDialog):
self.buttons.append(self.button_anime) self.buttons.append(self.button_anime)
posy += space posy += space
label = 'Infantiles' label = 'Infantiles'
self.button_infantil = xbmcgui.ControlButton(posx, posy, width, height, label, font='font14', self.button_infantil = xbmcgui.ControlButton(posx, posy, width, height, label, font=font,
alignment=0x00000000, noFocusTexture='', alignment=0x00000000, noFocusTexture='',
focusTexture=media_path+selected, textColor=textcolor, focusTexture=media_path+selected, textColor=textcolor,
shadowColor=shadow, textOffsetX=offsetx, textOffsetY=-3) shadowColor=shadow, textOffsetX=offsetx, textOffsetY=-3)
@@ -89,7 +151,7 @@ class Main(xbmcgui.WindowXMLDialog):
self.buttons.append(self.button_infantil) self.buttons.append(self.button_infantil)
posy += space posy += space
label = 'Documentales' label = 'Documentales'
self.button_docu = xbmcgui.ControlButton(posx, posy, width, height, label, font='font14', self.button_docu = xbmcgui.ControlButton(posx, posy, width, height, label, font=font,
alignment=0x00000000, noFocusTexture='', alignment=0x00000000, noFocusTexture='',
focusTexture=media_path + selected, textColor=textcolor, focusTexture=media_path + selected, textColor=textcolor,
shadowColor=shadow, textOffsetX=offsetx, textOffsetY=-3) shadowColor=shadow, textOffsetX=offsetx, textOffsetY=-3)
@@ -98,31 +160,32 @@ class Main(xbmcgui.WindowXMLDialog):
posy += space posy += space
label = 'Terror' label = 'Terror'
self.button_terror = xbmcgui.ControlButton(posx, posy, width, height, label, font='font14', self.button_terror = xbmcgui.ControlButton(posx, posy, width, height, label, font=font,
alignment=0x00000000, noFocusTexture='', alignment=0x00000000, noFocusTexture='',
focusTexture=media_path+selected, textColor=textcolor, focusTexture=media_path+selected, textColor=textcolor,
shadowColor=shadow, textOffsetX=offsetx, textOffsetY=-3) shadowColor=shadow, textOffsetX=offsetx, textOffsetY=-3)
self.addControl(self.button_terror) self.addControl(self.button_terror)
self.buttons.append(self.button_terror) self.buttons.append(self.button_terror)
posy += space
label = 'Castellano'
self.button_cast = xbmcgui.ControlButton(posx, posy, width, height, label, font='font14', alignment=0x00000000,
noFocusTexture='', focusTexture=media_path+selected,
textColor=textcolor, shadowColor=shadow, textOffsetX=offsetx,
textOffsetY=-3)
self.addControl(self.button_cast)
self.buttons.append(self.button_cast)
posy += space posy += space
label = 'Latino' label = 'Latino'
self.button_lat = xbmcgui.ControlButton(posx, posy, width, height, label, font='font14', alignment=0x00000000, self.button_lat = xbmcgui.ControlButton(posx, posy, width, height, label, font=font, alignment=0x00000000,
noFocusTexture='', focusTexture=media_path+selected, noFocusTexture='', focusTexture=media_path+selected,
textColor=textcolor, shadowColor=shadow, textOffsetX=offsetx, textColor=textcolor, shadowColor=shadow, textOffsetX=offsetx,
textOffsetY=-3) textOffsetY=-3)
self.addControl(self.button_lat) self.addControl(self.button_lat)
self.buttons.append(self.button_lat) self.buttons.append(self.button_lat)
posy += space posy += space
label = 'Castellano'
self.button_cast = xbmcgui.ControlButton(posx, posy, width, height, label, font=font, alignment=0x00000000,
noFocusTexture='', focusTexture=media_path + selected,
textColor=textcolor, shadowColor=shadow, textOffsetX=offsetx,
textOffsetY=-3)
self.addControl(self.button_cast)
self.buttons.append(self.button_cast)
posy += space
label = 'Torrents' label = 'Torrents'
self.button_torrent = xbmcgui.ControlButton(posx, posy, width, height, label, font='font14', self.button_torrent = xbmcgui.ControlButton(posx, posy, width, height, label, font=font,
alignment=0x00000000, noFocusTexture='', alignment=0x00000000, noFocusTexture='',
focusTexture=media_path+selected, textColor=textcolor, focusTexture=media_path+selected, textColor=textcolor,
shadowColor=shadow, textOffsetX=offsetx, textOffsetY=-3) shadowColor=shadow, textOffsetX=offsetx, textOffsetY=-3)
@@ -130,24 +193,47 @@ class Main(xbmcgui.WindowXMLDialog):
self.buttons.append(self.button_torrent) self.buttons.append(self.button_torrent)
posy += space posy += space
label = 'Canales Activos' label = 'Canales Activos'
self.button_config = xbmcgui.ControlButton(posx, posy, width, height, label, font='font14', self.button_config = xbmcgui.ControlButton(posx, posy, width, height, label, font=font,
alignment=0x00000000, noFocusTexture='', alignment=0x00000000, noFocusTexture='',
focusTexture=media_path+selected, textColor=textcolor, focusTexture=media_path+selected, textColor=textcolor,
shadowColor=shadow, textOffsetX=offsetx, textOffsetY=-3) shadowColor=shadow, textOffsetX=offsetx, textOffsetY=-3)
self.addControl(self.button_config) self.addControl(self.button_config)
self.buttons.append(self.button_config) self.buttons.append(self.button_config)
posy += space*2
label = 'Buscar'
self.button_buscar = xbmcgui.ControlButton(posx, posy, width, height, label, font=font, alignment=0x00000000,
noFocusTexture='', focusTexture=media_path + selected,
textColor=textcolor, shadowColor=shadow, textOffsetX=offsetx,
textOffsetY=-3)
self.addControl(self.button_buscar)
self.buttons.append(self.button_buscar)
posy += space
label = 'Buscar Actor'
self.button_actor = xbmcgui.ControlButton(posx, posy, width, height, label, font=font, alignment=0x00000000,
noFocusTexture='', focusTexture=media_path + selected,
textColor=textcolor, shadowColor=shadow, textOffsetX=offsetx,
textOffsetY=-3)
self.addControl(self.button_actor)
self.buttons.append(self.button_actor)
label='' label=''
self.button_close = xbmcgui.ControlButton(260, 0, 1020, 725, label, noFocusTexture='', focusTexture='') self.button_close = xbmcgui.ControlButton(260, 0, 1020, 725, label, noFocusTexture='', focusTexture='')
self.addControl(self.button_close) self.addControl(self.button_close)
def onClick(self, control): def onClick(self, control):
new_item='' new_item=''
control = self.getControl(control).getLabel() control = self.getControl(control).getLabel()
menu_node['categoria actual'] = control.lower()
jsontools.update_node(menu_node, 'menu_settings_data.json', "menu")
if control == u'Menú Clasico': if control == u'Menú Clasico':
new_item = Item(channel='', action='getmainlist', title='Menú Alfa') new_item = Item(channel='', action='getmainlist', title='Menú Alfa')
elif control == 'Inicio':
new_item = get_start_page()
elif control == 'Peliculas': elif control == 'Peliculas':
new_item = Item(channel='news', action="novedades", extra="peliculas", mode='silent') new_item = Item(channel='news', action="novedades", extra="peliculas", mode='silent')
elif control == 'Series': elif control == 'Series':
@@ -168,9 +254,16 @@ class Main(xbmcgui.WindowXMLDialog):
new_item = Item(channel='news', action="novedades", extra="torrent", mode='silent') new_item = Item(channel='news', action="novedades", extra="torrent", mode='silent')
elif control == 'Canales Activos': elif control == 'Canales Activos':
new_item = Item(channel='news', action="setting_channel", extra=category, menu=True) new_item = Item(channel='news', action="setting_channel", extra=category, menu=True)
elif control == 'Buscar':
new_item = Item(channel='search', action="search")
elif control == 'Buscar Actor':
new_item = Item(channel='tvmoviedb', title="Buscar actor/actriz", action="search_",
search={'url': 'search/person', 'language': 'es', 'page': 1}, star=True)
elif control == '': elif control == '':
self.close() self.close()
if new_item !='': if new_item !='' and new_item !='definido':
self.run_action(new_item)
elif new_item == 'definido':
self.run_action(new_item) self.run_action(new_item)
def onAction(self, action): def onAction(self, action):
@@ -208,3 +301,5 @@ class Main(xbmcgui.WindowXMLDialog):
self.close() self.close()
xbmc.executebuiltin("Container.update(%s)"%launcher.run(item)) xbmc.executebuiltin("Container.update(%s)"%launcher.run(item))
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

+8 -2
View File
@@ -16,6 +16,7 @@ from platformcode import config, logger
from platformcode import platformtools from platformcode import platformtools
def start(): def start():
""" Primera funcion que se ejecuta al entrar en el plugin. """ Primera funcion que se ejecuta al entrar en el plugin.
Dentro de esta funcion deberian ir todas las llamadas a las Dentro de esta funcion deberian ir todas las llamadas a las
@@ -39,10 +40,15 @@ def run(item=None):
else: else:
if config.get_setting("custom_menu") == True: if config.get_setting("custom_menu") == True:
category = config.get_setting("category").lower() category = config.get_setting("category").lower()
item = Item(channel="news", action="novedades", extra=category, mode = 'silent') if category != 'definido':
item = Item(channel="news", action="novedades", extra=category, mode = 'silent')
else:
from channels import side_menu
item= Item()
item = side_menu.check_user_home(item)
else: else:
item = Item(channel="channelselector", action="getmainlist", viewmode="movie") item = Item(channel="channelselector", action="getmainlist", viewmode="movie")
logger.info(item.tostring()) #logger.info(item.tostring())
try: try:
# If item has no action, stops here # If item has no action, stops here
@@ -135,7 +135,7 @@ def render_items(itemlist, parent_item):
if item.fanart: if item.fanart:
fanart = item.fanart fanart = item.fanart
else: else:
fanart = os.path.join(config.get_runtime_path(), "fanart.jpg") fanart = os.path.join(config.get_runtime_path(), "fanart-xmas.jpg")
# Creamos el listitem # Creamos el listitem
listitem = xbmcgui.ListItem(item.title) listitem = xbmcgui.ListItem(item.title)
@@ -407,8 +407,15 @@ def set_context_commands(item, parent_item):
item.clone(channel='search', item.clone(channel='search',
action="do_search", action="do_search",
from_channel=item.channel, from_channel=item.channel,
contextual=True).tourl()))) contextual=True).tourl())))
if item.action not in ['findvideos', 'play']:
context_commands.insert(0, ("[COLOR 0xffccff00]Definir como Inicio[/COLOR]",
"XBMC.RunPlugin(%s?%s)" % (
sys.argv[0], Item(channel='side_menu',
action="set_home",
parent=item.tourl()).tourl())))
if item.channel != "videolibrary": if item.channel != "videolibrary":
# Añadir Serie a la videoteca # Añadir Serie a la videoteca
+1 -1
View File
@@ -41,7 +41,7 @@
<category label="Menu Inicial"> <category label="Menu Inicial">
<setting id="custom_menu" type="bool" label="Menu Personal" default="false"/> <setting id="custom_menu" type="bool" label="Menu Personal" default="false"/>
<setting id="category" type="labelenum" label="Mostrar en inicio" <setting id="category" type="labelenum" label="Mostrar en inicio"
values="Peliculas|Series|Anime|Infantiles|Documentales|Terror|Castellano|Latino|Torrents" values="Peliculas|Series|Anime|Infantiles|Documentales|Terror|Castellano|Latino|Torrent|Definido"
default="Peliculas" visible="eq(-1,True)"/> default="Peliculas" visible="eq(-1,True)"/>
</category> </category>
<category label="Opciones Visuales"> <category label="Opciones Visuales">
Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 315 B

After

Width:  |  Height:  |  Size: 351 B