def onAction(self, action): plugintools.log("ChannelWindow.onAction action.id=" + repr(action.getId()) + " action.buttonCode=" + repr(action.getButtonCode())) if action == ACTION_PARENT_DIR or action == ACTION_PREVIOUS_MENU or action == ACTION_PREVIOUS_MENU2: self.close() if action == ACTION_SELECT_ITEM or action == ACTION_MOUSE_LEFT_CLICK: #loader_image = os.path.join( plugintools.get_runtime_path(), 'resources', 'skins', 'Default', 'media', 'loader.gif') #loader = xbmcgui.ControlImage(1200, 19, 40, 40, loader_image) #self.addControl(loader) #self.loader.setVisible(True) pos = self.control_list.getSelectedPosition() item = self.itemlist[pos] if item.action.startswith("play_"): play_items = navigation.get_next_items(item) self.loader.setVisible(False) media_url = play_items[0].url plugintools.direct_play(media_url) else: #next_items = navigation.get_next_items( item ) self.loader.setVisible(False) # Si no hay nada, no muestra la pantalla vacía #if len(next_items)>0: next_window = navigation.get_window_for_item(item) #next_window.setItemlist(next_items) next_window.setParentItem(item) next_window.doModal() del next_window
def onAction(self, action): plugintools.log("ChannelWindow.onAction action.id="+repr(action.getId())+" action.buttonCode="+repr(action.getButtonCode())) if action == ACTION_PARENT_DIR or action==ACTION_PREVIOUS_MENU or action==ACTION_PREVIOUS_MENU2: self.close() if action == ACTION_SELECT_ITEM or action == ACTION_MOUSE_LEFT_CLICK: loader_image = os.path.join( plugintools.get_runtime_path(), 'resources', 'skins', 'Default', 'media', 'loader.gif') loader = xbmcgui.ControlImage(1200, 19, 40, 40, loader_image) self.addControl(loader) pos = self.control_list.getSelectedPosition() item = self.itemlist[pos] if item.action.startswith("play_"): play_items = navigation.get_next_items( item ) loader.setVisible(False) media_url = play_items[0].url plugintools.direct_play(media_url) else: next_items = navigation.get_next_items( item ) loader.setVisible(False) # Si no hay nada, no muestra la pantalla vacía if len(next_items)>0: next_window = navigation.get_window_for_item( item ) next_window.setItemlist(next_items) next_window.setParentItem(item) next_window.doModal() del next_window
def trailer0(params): # Thanks to Abelhas addon! plugintools.log("[%s %s] Youtube trailer in context menu: %s" % (addonName, addonId, repr(params))) trailer_id = params.get("trailer_id") print trailer_id try: trailer_id = params.get("page") url = 'plugin://plugin.video.youtube/play/?video_id=%s' % trailer_id plugintools.log("URL Trailer Youtube: "+url) except: ytpage = 'https://www.googleapis.com/youtube/v3/search?part=id,snippet&q='+urllib.quote_plus(title_fixed)+'-Trailer&maxResults=1&key=AIzaSyCgpWUrGw2mySqmxxzlrsUoNhpGCBVJD7s' title = parser_title(params.get("title")) if title.find("[") >= 0: title_fixed = title.split("[")[0] i = len(title_fixed) if i >= 2: title_fixed = title_fixed[0].strip() else: title_fixed = title req = urllib2.Request(ytpage) req.add_header('User-Agent', user_agent) response = urllib2.urlopen(req) ytpage=response.read() response.close() youtubeid = plugintools.find_single_match(ytpage, '"videoId": "(.+?)"') url = 'plugin://plugin.video.youtube/play/?video_id=%s' % youtubeid if url == None: return xbmc.executebuiltin("Container.SetViewMode(508)") plugintools.direct_play(url)
def onAction(self, action): plugintools.log("ChannelWindow.onAction action.id=" + repr(action.getId()) + " action.buttonCode=" + repr(action.getButtonCode())) ## Botón izquierdo del ratón para las listas del inicio hasta la primera lista de menú de los canales. if action == 100: action = ACTION_SELECT_ITEM if action == ACTION_PARENT_DIR or action == ACTION_PREVIOUS_MENU or action == ACTION_PREVIOUS_MENU2: self.close() if action == ACTION_SELECT_ITEM: from core import config skin_selector = config.get_setting("skin_selector") if skin_selector == "": skin_selector = "0" if skin_selector == "0": loader_image = os.path.join(plugintools.get_runtime_path(), 'resources', 'skins', 'Default', 'media', 'loader.gif') if skin_selector == "1": loader_image = os.path.join(plugintools.get_runtime_path(), 'resources', 'skins', 'Default', 'media', 'loader-1.gif') loader = xbmcgui.ControlImage(1830, 26, 64, 64, loader_image) self.addControl(loader) pos = self.control_list.getSelectedPosition() item = self.itemlist[pos] if item.action.startswith("play_"): play_items = navigation.get_next_items(item) loader.setVisible(False) media_url = play_items[0].url plugintools.direct_play(media_url) else: next_items = navigation.get_next_items(item) loader.setVisible(False) # Si no hay nada, no muestra la pantalla vacía if len(next_items) > 0: next_window = navigation.get_window_for_item(item) next_window.setItemlist(next_items) next_window.setParentItem(item) next_window.doModal() del next_window