示例#1
0
def download_all_videos(item):
    logger.info("tvalacarta.channels.api_programas download_all_videos item="+repr(item))

    item.action="get_items"

    from core import downloadtools
    downloadtools.download_all_episodes(item)
示例#2
0
def download_all_videos(item):
    logger.info("tvalacarta.channels.api_programas download_all_videos item=" +
                repr(item))

    item.action = "get_items"

    from core import downloadtools
    downloadtools.download_all_episodes(item)
示例#3
0
def download_all_episodes(channel_name, action, title, url, preferred_server,
                          first_episode, filter_language):
    exec "from channels import " + channel_name + " as channel"
    item = Item(show=title, extra=action, url=url)
    from core import downloadtools
    downloadtools.download_all_episodes(item,
                                        channel,
                                        first_episode=first_episode,
                                        preferred_server=preferred_server,
                                        filter_language=filter_language)
示例#4
0
def run():
    logger.info("pelisalacarta.platformcode.launcher run")

    # Extract item from sys.argv
    if sys.argv[2]:
        item = Item().fromurl(sys.argv[2])

    # If no item, this is mainlist
    else:
        item = Item(action="selectchannel", viewmode="movie")

    logger.info("pelisalacarta.platformcode.launcher "+item.tostring())

    # Set server filters
    server_white_list = []
    server_black_list = []
    if config.get_setting('filter_servers') == 'true':
        server_white_list, server_black_list = set_server_list()

    try:

        # If item has no action, stops here
        if item.action == "":
            logger.info("pelisalacarta.platformcode.launcher Item sin accion")
            return

        # Action for main menu in channelselector
        if ( item.action=="selectchannel" ):
            import channelselector
            itemlist = channelselector.getmainlist()

            # Check for updates only on first screen
            if config.get_setting("updatecheck2") == "true":
                logger.info("pelisalacarta.platformcode.launcher Check for plugin updates enabled")
                from core import updater
                
                try:
                    version = updater.checkforupdates()

                    if version:
                        import xbmcgui
                        advertencia = xbmcgui.Dialog()
                        advertencia.ok("Versión "+version+" disponible","Ya puedes descargar la nueva versión del plugin\ndesde el listado principal")

                        itemlist.insert(0,Item(title="Descargar version "+version, version=version, channel="updater", action="update", thumbnail=channelselector.get_thumbnail_path() + "Crystal_Clear_action_info.png"))
                except:
                    import xbmcgui
                    advertencia = xbmcgui.Dialog()
                    advertencia.ok("No se puede conectar","No ha sido posible comprobar","si hay actualizaciones")
                    logger.info("cpelisalacarta.platformcode.launcher Fallo al verificar la actualización")

            else:
                logger.info("pelisalacarta.platformcode.launcher Check for plugin updates disabled")

            xbmctools.renderItems(itemlist, item)

        # Action for updating plugin
        elif (item.action=="update"):

            from core import updater
            updater.update(item)
            if config.get_system_platform()!="xbox":
                import xbmc
                xbmc.executebuiltin( "Container.Refresh" )

        # Action for channel types on channelselector: movies, series, etc.
        elif (item.action=="channeltypes"):
            import channelselector
            itemlist = channelselector.getchanneltypes()

            xbmctools.renderItems(itemlist, item)

        # Action for channel listing on channelselector
        elif (item.action=="listchannels"):
            import channelselector
            itemlist = channelselector.filterchannels(item.category)

            xbmctools.renderItems(itemlist, item)

        # Action in certain channel specified in "action" and "channel" parameters
        else:

            # Entry point for a channel is the "mainlist" action, so here we check parental control
            if item.action=="mainlist":
                
                # Parental control
                can_open_channel = False

                # If it is an adult channel, and user has configured pin, asks for it
                if channeltools.is_adult(item.channel) and config.get_setting("adult_pin")!="":

                    import xbmc
                    keyboard = xbmc.Keyboard("","PIN para canales de adultos",True)
                    keyboard.doModal()

                    if (keyboard.isConfirmed()):
                        tecleado = keyboard.getText()
                        if tecleado==config.get_setting("adult_pin"):
                            can_open_channel = True

                # All the other cases can open the channel
                else:
                    can_open_channel = True

                if not can_open_channel:
                    return

            # Checks if channel exists
            channel_file = os.path.join(config.get_runtime_path(), 'channels', item.channel+".py")
            logger.info("pelisalacarta.platformcode.launcher channel_file=%s" % channel_file)

            if item.channel in ["personal","personal2","personal3","personal4","personal5"]:
                import channels.personal as channel

            elif os.path.exists(channel_file):
                channel = __import__('channels.%s' % item.channel, fromlist=["channels.%s" % item.channel])

            logger.info("pelisalacarta.platformcode.launcher running channel {0} {1}".format(channel.__name__, channel.__file__))

            # Special play action
            if item.action == "play":
                logger.info("pelisalacarta.platformcode.launcher play")

                # Mark as watched item on Library channel
                id_video = 0
                category = ''
                if 'infoLabels' in item:
                    if 'episodeid' in item.infoLabels and item.infoLabels['episodeid']:
                        category = 'Series'
                        id_video = item.infoLabels['episodeid']
                    elif 'movieid' in item.infoLabels and item.infoLabels['movieid']:
                        category = 'Movies'
                        id_video = item.infoLabels['movieid']

                # First checks if channel has a "play" function
                if hasattr(channel, 'play'):
                    logger.info("pelisalacarta.platformcode.launcher executing channel 'play' method")
                    itemlist = channel.play(item)

                    # Play should return a list of playable URLS
                    if len(itemlist) > 0:
                        item = itemlist[0]
                        xbmctools.play_video(item)
                        if id_video != 0:
                            library.mark_as_watched(category, id_video)
                    
                    # If not, shows user an error message
                    else:
                        import xbmcgui
                        ventana_error = xbmcgui.Dialog()
                        ok = ventana_error.ok("plugin", "No hay nada para reproducir")

                # If player don't have a "play" function, not uses the standard play from xbmctools
                else:
                    logger.info("pelisalacarta.platformcode.launcher executing core 'play' method")
                    xbmctools.play_video(item)
                    if id_video != 0:
                        library.mark_as_watched(category, id_video)

            # Special action for findvideos, where the plugin looks for known urls
            elif item.action == "findvideos":

                # First checks if channel has a "findvideos" function
                if hasattr(channel, 'findvideos'):
                    itemlist = getattr(channel, item.action)(item)

                    if config.get_setting('filter_servers') == 'true':
                        itemlist = filtered_servers(itemlist, server_white_list, server_black_list)

                # If not, uses the generic findvideos function
                else:
                    logger.info("pelisalacarta.platformcode.launcher no channel 'findvideos' method, executing core method")
                    from core import servertools
                    itemlist = servertools.find_video_items(item)
                    if config.get_setting('filter_servers') == 'true':
                        itemlist = filtered_servers(itemlist, server_white_list, server_black_list)

                # Copy infolabels from parent item
                if 'infoLabels' in item:
                    
                    # All but title
                    if 'title' in item.infoLabels:
                        item.infoLabels.pop('title')
                    new_itemlist = itemlist[:]
                    itemlist = []
                    
                    for i in new_itemlist:
                        itemlist.append(i.clone(infoLabels=item.infoLabels))


                from platformcode import subtitletools
                subtitletools.saveSubtitleName(item)

                # Show xbmc items as "movies", so plot is visible
                import xbmcplugin

                handle = sys.argv[1]
                xbmcplugin.setContent(int( handle ),"movies")

                # Add everything to XBMC item list
                if type(itemlist) == list and itemlist:
                    xbmctools.renderItems(itemlist, item)

                # If not, it shows an empty list
                # FIXME: Aquí deberíamos mostrar alguna explicación del tipo "No hay elementos, esto pasa por bla bla bla"
                else:
                    xbmctools.renderItems([], item)

            # Special action for playing a video from the library
            elif item.action == "play_from_library":
                play_from_library(item, channel, server_white_list, server_black_list)

            # Special action for adding a movie to the library
            elif item.action == "add_pelicula_to_library":
                library.add_pelicula_to_library(item)

            # Special action for adding a serie to the library
            elif item.action == "add_serie_to_library":
                library.add_serie_to_library(item, channel)

            # Special action for downloading all episodes from a serie
            elif item.action == "download_all_episodes":
                downloadtools.download_all_episodes(item, channel)

            # Special action for searching, first asks for the words then call the "search" function
            elif item.action=="search":
                logger.info("pelisalacarta.platformcode.launcher search")
                
                import xbmc
                keyboard = xbmc.Keyboard("")
                keyboard.doModal()
                
                if (keyboard.isConfirmed()):
                    tecleado = keyboard.getText()
                    tecleado = tecleado.replace(" ", "+")
                    itemlist = channel.search(item,tecleado)
                else:
                    itemlist = []
                
                xbmctools.renderItems(itemlist, item)

            # For all other actions
            else:
                logger.info("pelisalacarta.platformcode.launcher executing channel '"+item.action+"' method")
                itemlist = getattr(channel, item.action)(item)

                # Activa el modo biblioteca para todos los canales genéricos, para que se vea el argumento
                import xbmcplugin

                handle = sys.argv[1]
                xbmcplugin.setContent(int( handle ),"movies")

                # Añade los items a la lista de XBMC
                if type(itemlist) == list and itemlist:
                    xbmctools.renderItems(itemlist, item)

                # If not, it shows an empty list
                # FIXME: Aquí deberíamos mostrar alguna explicación del tipo "No hay elementos, esto pasa por bla bla bla"
                else:
                    xbmctools.renderItems([], item)

    except urllib2.URLError,e:
        import traceback
        logger.error("pelisalacarta.platformcode.launcher "+traceback.format_exc())

        import xbmcgui
        ventana_error = xbmcgui.Dialog()

        # Grab inner and third party errors
        if hasattr(e, 'reason'):
            logger.info("pelisalacarta.platformcode.launcher Razon del error, codigo: {0}, Razon: {1}".format(e.reason[0], e.reason[1]))
            texto = config.get_localized_string(30050) # "No se puede conectar con el sitio web"
            ok = ventana_error.ok ("plugin", texto)
        
        # Grab server response errors
        elif hasattr(e,'code'):
            logger.info("pelisalacarta.platformcode.launcher codigo de error HTTP : %d" %e.code)
            texto = (config.get_localized_string(30051) % e.code) # "El sitio web no funciona correctamente (error http %d)"
            ok = ventana_error.ok ("plugin", texto)
示例#5
0
def run():
    logger.info("streamondemand.platformcode.launcher run")

    # The start() function is not always executed on old platforms (XBMC versions under 12.0)
    if config.OLD_PLATFORM:
        config.verify_directories_created()

    # Extract item from sys.argv
    if sys.argv[2]:
        item = Item().fromurl(sys.argv[2])

    # If no item, this is mainlist
    else:
        item = Item(action="selectchannel", viewmode="movie")

    logger.info("streamondemand.platformcode.launcher " + item.tostring())

    # Set server filters
    server_white_list = []
    server_black_list = []
    if config.get_setting('filter_servers') == 'true':
        server_white_list, server_black_list = set_server_list()

    try:

        # If item has no action, stops here
        if item.action == "":
            logger.info("streamondemand.platformcode.launcher Item sin accion")
            return

        # Action for main menu in channelselector
        if (item.action == "selectchannel"):
            import channelselector
            itemlist = channelselector.getmainlist()

            # Check for updates only on first screen
            if config.get_setting("updatecheck2") == "true":
                logger.info(
                    "streamondemand.platformcode.launcher Check for plugin updates enabled"
                )
                from core import updater

                try:
                    version = updater.checkforupdates()

                    if version:
                        import xbmcgui
                        advertencia = xbmcgui.Dialog()
                        advertencia.ok(
                            "Versione " + version + " disponible",
                            "E' possibile fare il download della nuova versione\nselezionare la relativa voce nel menu principale"
                        )

                        itemlist.insert(
                            0,
                            Item(
                                title="Download versione " + version,
                                version=version,
                                channel="updater",
                                action="update",
                                thumbnail=channelselector.get_thumbnail_path()
                                + "Crystal_Clear_action_info.png"))
                except:
                    import xbmcgui
                    advertencia = xbmcgui.Dialog()
                    advertencia.ok("Impossibile connettersi",
                                   "Non è stato possibile verificare",
                                   "aggiornamenti")
                    logger.info(
                        "cstreamondemand.platformcode.launcher Fallo al verificar la actualización"
                    )

            else:
                logger.info(
                    "streamondemand.platformcode.launcher Check for plugin updates disabled"
                )

            xbmctools.renderItems(itemlist, item)

        # Action for updating plugin
        elif (item.action == "update"):

            from core import updater
            updater.update(item)
            if config.get_system_platform() != "xbox":
                import xbmc
                xbmc.executebuiltin("Container.Refresh")

        # Action for channel types on channelselector: movies, series, etc.
        elif (item.action == "channeltypes"):
            import channelselector
            itemlist = channelselector.getchanneltypes()

            xbmctools.renderItems(itemlist, item)

        # Action for channel listing on channelselector
        elif (item.action == "listchannels"):
            import channelselector
            itemlist = channelselector.filterchannels(item.category)

            xbmctools.renderItems(itemlist, item)

        # Action in certain channel specified in "action" and "channel" parameters
        else:

            # Entry point for a channel is the "mainlist" action, so here we check parental control
            if item.action == "mainlist":

                # Parental control
                can_open_channel = False

                # If it is an adult channel, and user has configured pin, asks for it
                if channeltools.is_adult(item.channel) and config.get_setting(
                        "adult_pin") != "":

                    import xbmc
                    keyboard = xbmc.Keyboard("", "PIN para canales de adultos",
                                             True)
                    keyboard.doModal()

                    if (keyboard.isConfirmed()):
                        tecleado = keyboard.getText()
                        if tecleado == config.get_setting("adult_pin"):
                            can_open_channel = True

                # All the other cases can open the channel
                else:
                    can_open_channel = True

                if not can_open_channel:
                    return

            # Checks if channel exists
            channel_file = os.path.join(config.get_runtime_path(), 'channels',
                                        item.channel + ".py")
            logger.info(
                "streamondemand.platformcode.launcher channel_file=%s" %
                channel_file)

            if item.channel in [
                    "personal", "personal2", "personal3", "personal4",
                    "personal5"
            ]:
                import channels.personal as channel

            elif os.path.exists(channel_file):
                try:
                    channel = __import__(
                        'channels.%s' % item.channel,
                        fromlist=["channels.%s" % item.channel])
                except:
                    exec "import channels." + item.channel + " as channel"

            logger.info(
                "streamondemand.platformcode.launcher running channel {0} {1}".
                format(channel.__name__, channel.__file__))

            # Special play action
            if item.action == "play":
                logger.info("streamondemand.platformcode.launcher play")

                # First checks if channel has a "play" function
                if hasattr(channel, 'play'):
                    logger.info(
                        "streamondemand.platformcode.launcher executing channel 'play' method"
                    )
                    itemlist = channel.play(item)

                    # Play should return a list of playable URLS
                    if len(itemlist) > 0:
                        item = itemlist[0]
                        xbmctools.play_video(item)

                    # If not, shows user an error message
                    else:
                        import xbmcgui
                        ventana_error = xbmcgui.Dialog()
                        ok = ventana_error.ok("plugin",
                                              "No hay nada para reproducir")

                # If player don't have a "play" function, not uses the standard play from xbmctools
                else:
                    logger.info(
                        "streamondemand.platformcode.launcher executing core 'play' method"
                    )
                    xbmctools.play_video(item)

            # Special action for findvideos, where the plugin looks for known urls
            elif item.action == "findvideos":

                if item.strm:
                    # Special action for playing a video from the library
                    play_from_library(item, channel, server_white_list,
                                      server_black_list)

                # First checks if channel has a "findvideos" function
                if hasattr(channel, 'findvideos'):
                    itemlist = getattr(channel, item.action)(item)

                # If not, uses the generic findvideos function
                else:
                    logger.info(
                        "streamondemand.platformcode.launcher no channel 'findvideos' method, "
                        "executing core method")
                    from core import servertools
                    itemlist = servertools.find_video_items(item)
                    if config.get_setting('filter_servers') == 'true':
                        itemlist = filtered_servers(itemlist,
                                                    server_white_list,
                                                    server_black_list)

                from platformcode import subtitletools
                subtitletools.saveSubtitleName(item)

                # Show xbmc items as "movies", so plot is visible
                import xbmcplugin

                handle = sys.argv[1]
                xbmcplugin.setContent(int(handle), "movies")

                # Add everything to XBMC item list
                if type(itemlist) == list and itemlist:
                    xbmctools.renderItems(itemlist, item)

                # If not, it shows an empty list
                # FIXME: Aquí deberíamos mostrar alguna explicación del tipo "No hay elementos, esto pasa por bla bla bla"
                else:
                    xbmctools.renderItems([], item)

            # DrZ3r0
            # Special action for play_from_library, where the plugin looks for known urls
            elif item.action == "play_from_library":
                # Special action for playing a video from the library
                play_from_library(item, channel, server_white_list,
                                  server_black_list)

            # Special action for adding a movie to the library
            elif item.action == "add_pelicula_to_library":
                library.add_pelicula_to_library(item)

            # Special action for adding a serie to the library
            elif item.action == "add_serie_to_library":
                library.add_serie_to_library(item, channel)

            # Special action for downloading all episodes from a serie
            elif item.action == "download_all_episodes":
                downloadtools.download_all_episodes(item, channel)

            # Special action for searching, first asks for the words then call the "search" function
            elif item.action == "search":
                logger.info("streamondemand.platformcode.launcher search")

                import xbmc
                keyboard = xbmc.Keyboard("")
                keyboard.doModal()

                if (keyboard.isConfirmed()):
                    tecleado = keyboard.getText()
                    tecleado = tecleado.replace(" ", "+")
                    itemlist = channel.search(item, tecleado)
                else:
                    itemlist = []

                xbmctools.renderItems(itemlist, item)

            # For all other actions
            else:
                logger.info(
                    "streamondemand.platformcode.launcher executing channel '"
                    + item.action + "' method")
                itemlist = getattr(channel, item.action)(item)

                # Activa el modo biblioteca para todos los canales genéricos, para que se vea el argumento
                import xbmcplugin

                handle = sys.argv[1]
                xbmcplugin.setContent(int(handle), "movies")

                # Añade los items a la lista de XBMC
                if type(itemlist) == list and itemlist:
                    xbmctools.renderItems(itemlist, item)

                # If not, it shows an empty list
                # FIXME: Aquí deberíamos mostrar alguna explicación del tipo "No hay elementos, esto pasa por bla bla bla"
                else:
                    xbmctools.renderItems([], item)

    except urllib2.URLError, e:
        import traceback
        logger.error("streamondemand.platformcode.launcher " +
                     traceback.format_exc())

        import xbmcgui
        ventana_error = xbmcgui.Dialog()

        # Grab inner and third party errors
        if hasattr(e, 'reason'):
            logger.info(
                "streamondemand.platformcode.launcher Razon del error, codigo: {0}, Razon: {1}"
                .format(e.reason[0], e.reason[1]))
            texto = config.get_localized_string(
                30050)  # "No se puede conectar con el sitio web"
            ok = ventana_error.ok("plugin", texto)

        # Grab server response errors
        elif hasattr(e, 'code'):
            logger.info(
                "streamondemand.platformcode.launcher codigo de error HTTP : %d"
                % e.code)
            texto = (
                config.get_localized_string(30051) % e.code
            )  # "El sitio web no funciona correctamente (error http %d)"
            ok = ventana_error.ok("plugin", texto)
示例#6
0
def run(item=None):
    logger.info("tvalacarta.platformcode.launcher run")
    
    if item is None:
        # Extract item from sys.argv
        if sys.argv[2]:
            item = Item().fromurl(sys.argv[2])
            params = ""

        # If no item, this is mainlist
        else:
            item = Item(action="selectchannel")
            params = ""

    logger.info(item.tostring())

    # If item has no action, stops here
    if item.action == "":
        logger.info("Item sin accion")
        return

    try:
        # Action for main menu in channelselector
        if item.action=="selectchannel":
            
            import channelselector
            # TODO: Que channelselector devuelva items, procesados por el mismo add_items_to_kodi_directory que el resto
            itemlist = channelselector.mainlist(params, item.url, item.category)

            # Check for updates only on first screen
            if config.get_setting("updatecheck2") == "true":
                logger.info("tvalacarta.platformcode.launcher Check for plugin updates enabled")
                from core import updater
                
                try:
                    version = updater.checkforupdates()

                    if version:
                        import xbmcgui
                        advertencia = xbmcgui.Dialog()
                        advertencia.ok("Versión "+version+" disponible","Ya puedes descargar la nueva versión del plugin\ndesde el listado principal")

                        itemlist.insert(0,Item(title="Descargar version "+version, version=version, channel="updater", action="update", thumbnail=channelselector.get_thumbnail_path() + "Crystal_Clear_action_info.png"))
                except:
                    import xbmcgui
                    advertencia = xbmcgui.Dialog()
                    advertencia.ok("No se puede conectar","No ha sido posible comprobar","si hay actualizaciones")
                    logger.info("channelselector.mainlist Fallo al verificar la actualización")

            else:
                logger.info("tvalacarta.platformcode.launcher Check for plugin updates disabled")

            #xbmctools.add_items_to_kodi_directory(itemlist, item)

        # Action for updating plugin
        elif item.action=="update":

            from core import updater
            updater.update(item)
            if config.get_system_platform()!="xbox":
                import xbmc
                xbmc.executebuiltin( "Container.Refresh" )

        # Action for channel types on channelselector: movies, series, etc.
        elif item.action=="channeltypes":
            import channelselector
            # TODO: Que channelselector devuelva items, procesados por el mismo add_items_to_kodi_directory que el resto
            itemlist = channelselector.channeltypes(params,item.url,item.category)

            #xbmctools.add_items_to_kodi_directory(itemlist, item)

        # Action for channel listing on channelselector
        elif item.action=="listchannels":
            import channelselector
            # TODO: Que channelselector devuelva items, procesados por el mismo add_items_to_kodi_directory que el resto
            itemlist = channelselector.listchannels(params,item.url,item.category)

            #xbmctools.add_items_to_kodi_directory(itemlist, item)

        elif item.action=="player_directo":

            from core import window_player_background
            from channels import directos
            import plugintools

            window = window_player_background.PlayerWindowBackground("player_background.xml",plugintools.get_runtime_path())
            window.setItemlist(directos.build_channel_list())
            window.setCurrentPosition(item.position)
            window.doModal()
            del window
            return

        # Action in certain channel specified in "action" and "channel" parameters
        else:

            # Checks if channel exists
            channel_file = os.path.join( config.get_runtime_path() , 'channels' , item.channel+".py" )
            logger.info("tvalacarta.platformcode.launcher channel_file=%s" % channel_file)

            channel = __import__('channels.%s' % item.channel, fromlist=["channels.%s" % item.channel])
            logger.info("tvalacarta.platformcode.launcher running channel {0} {1}".format(channel.__name__, channel.__file__))


            # Special play action
            if item.action == "play":
                logger.info("tvalacarta.platformcode.launcher play")

                # First checks if channel has a "play" function
                if hasattr(channel, 'play'):
                    logger.info("tvalacarta.platformcode.launcher executing channel 'play' method")
                    itemlist = channel.play(item)

                    if len(itemlist)>0:
                        item = itemlist[0]
                        xbmctools.play_video(item)
                    else:
                        import xbmcgui
                        ventana_error = xbmcgui.Dialog()
                        ok = ventana_error.ok ("plugin", "No hay nada para reproducir")
                else:
                    logger.info("tvalacarta.platformcode.launcher executing core 'play' method")
                    xbmctools.play_video(item)

            elif item.action.startswith("serie_options##"):
                from core import suscription
                import xbmcgui
                dia = xbmcgui.Dialog()
                opciones = []

                suscription_item = Item(channel=item.channel, title=item.show, url=item.url, action=item.action.split("##")[1], extra=item.extra, plot=item.plot, show=item.show, thumbnail=item.thumbnail)

                if not suscription.already_suscribed(suscription_item):
                    opciones.append("Activar descarga automática")
                else:
                    opciones.append("Cancelar descarga automática")

                #opciones.append("Añadir esta serie a favoritos")
                opciones.append("Descargar todos los episodios")
                seleccion = dia.select("Elige una opción", opciones) # "Elige una opción"

                if seleccion==0:
                    if not suscription.already_suscribed(suscription_item):
                        suscription.append_suscription(suscription_item)

                        yes_pressed = xbmcgui.Dialog().yesno( "Descarga automática activada" , "A partir de ahora los nuevos vídeos que se publiquen de este programa se descargarán automáticamente, podrás encontrarlos en la sección 'Descargas'." )

                        if yes_pressed:
                            download_all_episodes(suscription_item,channel)

                    else:
                        suscription.remove_suscription(suscription_item)
                        xbmcgui.Dialog().ok( "Descarga automática cancelada" , "Los vídeos que hayas descargado se mantienen, pero los nuevos ya no se descargarán ellos solos." )

                elif seleccion==1:
                    downloadtools.download_all_episodes(item, channel)

                '''
                elif seleccion==1:
                    from core import favoritos
                    from core import downloadtools
                    import xbmc

                    keyboard = xbmc.Keyboard(downloadtools.limpia_nombre_excepto_1(item.show)+" ["+item.channel+"]")
                    keyboard.doModal()
                    if keyboard.isConfirmed():
                        title = keyboard.getText()
                        favoritos.savebookmark(titulo=title,url=item.url,thumbnail=item.thumbnail,server="",plot=item.plot,fulltitle=title)
                        advertencia = xbmcgui.Dialog()
                        resultado = advertencia.ok(config.get_localized_string(30102) , title , config.get_localized_string(30108)) # 'se ha añadido a favoritos'
                    return
                '''

            elif item.action=="search":
                logger.info("tvalacarta.platformcode.launcher search")

                import xbmc
                keyboard = xbmc.Keyboard("")
                keyboard.doModal()

                itemlist = []
                if (keyboard.isConfirmed()):
                    tecleado = keyboard.getText()
                    #tecleado = tecleado.replace(" ", "+")
                    itemlist = channel.search(item,tecleado)
                    if itemlist is None:
                        itemlist = []

                xbmctools.add_items_to_kodi_directory(itemlist, item)

            else:
                logger.info("tvalacarta.platformcode.launcher executing channel '"+item.action+"' method")
                exec "itemlist = channel."+item.action+"(item)"
                if itemlist is None:
                    itemlist = []

                # Activa el modo biblioteca para todos los canales genéricos, para que se vea el argumento
                handle = sys.argv[1]
                xbmcplugin.setContent(int( handle ),"movies")
                
                # Añade los items a la lista de XBMC
                xbmctools.add_items_to_kodi_directory(itemlist, item)

    except UserException,e:
        import xbmcgui
        xbmcgui.Dialog().ok ("Se ha producido un error", e.value)
def download_all_episodes(channel_name,action,title,url,preferred_server,first_episode,filter_language):
    exec "from channels import "+channel_name+" as channel"
    item = Item(show=title, extra=action, url=url)
    from core import downloadtools
    downloadtools.download_all_episodes(item,channel,first_episode=first_episode,preferred_server=preferred_server,filter_language=filter_language)
示例#8
0
def run(item=None):
    logger.info("tvalacarta.platformcode.launcher run")

    if item is None:
        # Extract item from sys.argv
        if sys.argv[2]:
            item = Item().fromurl(sys.argv[2])
            params = ""

        # If no item, this is mainlist
        else:
            item = Item(action="selectchannel")
            params = ""

    logger.info(item.tostring())

    # If item has no action, stops here
    if item.action == "":
        logger.info("Item sin accion")
        return

    try:
        # Action for main menu in channelselector
        if item.action == "selectchannel":

            import channelselector
            # TODO: Que channelselector devuelva items, procesados por el mismo add_items_to_kodi_directory que el resto
            itemlist = channelselector.mainlist(params, item.url,
                                                item.category)

            # Check for updates only on first screen
            if config.get_setting("updatecheck2") == "true":
                logger.info(
                    "tvalacarta.platformcode.launcher Check for plugin updates enabled"
                )
                from core import updater

                try:
                    version = updater.checkforupdates()

                    if version:
                        import xbmcgui
                        advertencia = xbmcgui.Dialog()
                        advertencia.ok(
                            "Versión " + version + " disponible",
                            "Ya puedes descargar la nueva versión del plugin\ndesde el listado principal"
                        )

                        itemlist.insert(
                            0,
                            Item(
                                title="Descargar version " + version,
                                version=version,
                                channel="updater",
                                action="update",
                                thumbnail=channelselector.get_thumbnail_path()
                                + "Crystal_Clear_action_info.png"))
                except:
                    import xbmcgui
                    advertencia = xbmcgui.Dialog()
                    advertencia.ok("No se puede conectar",
                                   "No ha sido posible comprobar",
                                   "si hay actualizaciones")
                    logger.info(
                        "channelselector.mainlist Fallo al verificar la actualización"
                    )

            else:
                logger.info(
                    "tvalacarta.platformcode.launcher Check for plugin updates disabled"
                )

            #xbmctools.add_items_to_kodi_directory(itemlist, item)

        # Action for updating plugin
        elif item.action == "update":

            from core import updater
            updater.update(item)
            if config.get_system_platform() != "xbox":
                import xbmc
                xbmc.executebuiltin("Container.Refresh")

        # Action for channel types on channelselector: movies, series, etc.
        elif item.action == "channeltypes":
            import channelselector
            # TODO: Que channelselector devuelva items, procesados por el mismo add_items_to_kodi_directory que el resto
            itemlist = channelselector.channeltypes(params, item.url,
                                                    item.category)

            #xbmctools.add_items_to_kodi_directory(itemlist, item)

        # Action for channel listing on channelselector
        elif item.action == "listchannels":
            import channelselector
            # TODO: Que channelselector devuelva items, procesados por el mismo add_items_to_kodi_directory que el resto
            itemlist = channelselector.listchannels(params, item.url,
                                                    item.category)

            #xbmctools.add_items_to_kodi_directory(itemlist, item)

        elif item.action == "player_directo":

            from core import window_player_background
            from channels import directos
            import plugintools

            window = window_player_background.PlayerWindowBackground(
                "player_background.xml", plugintools.get_runtime_path())
            window.setItemlist(directos.build_channel_list())
            window.setCurrentPosition(item.position)
            window.doModal()
            del window
            return

        # Action in certain channel specified in "action" and "channel" parameters
        else:

            # Checks if channel exists
            channel_file = os.path.join(config.get_runtime_path(), 'channels',
                                        item.channel + ".py")
            logger.info("tvalacarta.platformcode.launcher channel_file=%s" %
                        channel_file)

            channel = __import__('channels.%s' % item.channel,
                                 fromlist=["channels.%s" % item.channel])
            logger.info(
                "tvalacarta.platformcode.launcher running channel {0} {1}".
                format(channel.__name__, channel.__file__))

            # Special play action
            if item.action == "play":
                logger.info("tvalacarta.platformcode.launcher play")

                # First checks if channel has a "play" function
                if hasattr(channel, 'play'):
                    logger.info(
                        "tvalacarta.platformcode.launcher executing channel 'play' method"
                    )
                    itemlist = channel.play(item)

                    if len(itemlist) > 0:
                        item = itemlist[0]
                        xbmctools.play_video(item)
                    else:
                        import xbmcgui
                        ventana_error = xbmcgui.Dialog()
                        ok = ventana_error.ok("plugin",
                                              "No hay nada para reproducir")
                else:
                    logger.info(
                        "tvalacarta.platformcode.launcher executing core 'play' method"
                    )
                    xbmctools.play_video(item)

            elif item.action.startswith("serie_options##"):
                from core import suscription
                import xbmcgui
                dia = xbmcgui.Dialog()
                opciones = []

                suscription_item = Item(channel=item.channel,
                                        title=item.show,
                                        url=item.url,
                                        action=item.action.split("##")[1],
                                        extra=item.extra,
                                        plot=item.plot,
                                        show=item.show,
                                        thumbnail=item.thumbnail)

                if not suscription.already_suscribed(suscription_item):
                    opciones.append("Activar descarga automática")
                else:
                    opciones.append("Cancelar descarga automática")

                #opciones.append("Añadir esta serie a favoritos")
                opciones.append("Descargar todos los episodios")
                seleccion = dia.select("Elige una opción",
                                       opciones)  # "Elige una opción"

                if seleccion == 0:
                    if not suscription.already_suscribed(suscription_item):
                        suscription.append_suscription(suscription_item)

                        yes_pressed = xbmcgui.Dialog().yesno(
                            "Descarga automática activada",
                            "A partir de ahora los nuevos vídeos que se publiquen de este programa se descargarán automáticamente, podrás encontrarlos en la sección 'Descargas'."
                        )

                        if yes_pressed:
                            download_all_episodes(suscription_item, channel)

                    else:
                        suscription.remove_suscription(suscription_item)
                        xbmcgui.Dialog().ok(
                            "Descarga automática cancelada",
                            "Los vídeos que hayas descargado se mantienen, pero los nuevos ya no se descargarán ellos solos."
                        )

                elif seleccion == 1:
                    downloadtools.download_all_episodes(item, channel)
                '''
                elif seleccion==1:
                    from core import favoritos
                    from core import downloadtools
                    import xbmc

                    keyboard = xbmc.Keyboard(downloadtools.limpia_nombre_excepto_1(item.show)+" ["+item.channel+"]")
                    keyboard.doModal()
                    if keyboard.isConfirmed():
                        title = keyboard.getText()
                        favoritos.savebookmark(titulo=title,url=item.url,thumbnail=item.thumbnail,server="",plot=item.plot,fulltitle=title)
                        advertencia = xbmcgui.Dialog()
                        resultado = advertencia.ok(config.get_localized_string(30102) , title , config.get_localized_string(30108)) # 'se ha añadido a favoritos'
                    return
                '''

            elif item.action == "search":
                logger.info("tvalacarta.platformcode.launcher search")

                import xbmc
                keyboard = xbmc.Keyboard("")
                keyboard.doModal()

                itemlist = []
                if (keyboard.isConfirmed()):
                    tecleado = keyboard.getText()
                    #tecleado = tecleado.replace(" ", "+")
                    itemlist = channel.search(item, tecleado)
                    if itemlist is None:
                        itemlist = []

                xbmctools.add_items_to_kodi_directory(itemlist, item)

            else:
                logger.info(
                    "tvalacarta.platformcode.launcher executing channel '" +
                    item.action + "' method")
                exec "itemlist = channel." + item.action + "(item)"
                if itemlist is None:
                    itemlist = []

                # Activa el modo biblioteca para todos los canales genéricos, para que se vea el argumento
                handle = sys.argv[1]
                xbmcplugin.setContent(int(handle), "movies")

                # Añade los items a la lista de XBMC
                xbmctools.add_items_to_kodi_directory(itemlist, item)

    except UserException, e:
        import xbmcgui
        xbmcgui.Dialog().ok("Se ha producido un error", e.value)
示例#9
0
if config.get_setting("suscription_check")=="true":

    # Espera 60 segundos antes de empezar, para dar tiempo a XBMC a inicializarse
    wait_if_xbmc_not_closing(10)

    logger.info("tvalacarta.service_subscription First time launch")

    while not xbmc.abortRequested:

        logger.info("tvalacarta.service_subscription Checking for new items in subscriptions")

        current_suscriptions = suscription.get_current_suscriptions()

        for item in current_suscriptions:
            from core import downloadtools
            exec "from channels import "+item.channel+" as channel_module"
            downloadtools.download_all_episodes(item,channel_module,silent=True)

            if xbmc.abortRequested:
                break

        # Espera 8 horas (en segundos)    
        logger.info("tvalacarta.service_subscription Done, waiting for the expected lapse...")
        wait_if_xbmc_not_closing(8*60*60)

    logger.info("tvalacarta.service_subscription XBMC Abort requested")

else:

    logger.info("tvalacarta.service_subscription Suscription check disabled in config")
示例#10
0
def run():
    logger.info("pelisalacarta.platformcode.launcher run")

    # Extract item from sys.argv
    if sys.argv[2]:
        item = Item().fromurl(sys.argv[2])

    # If no item, this is mainlist
    else:
        item = Item(channel="channelselector", action="getmainlist", viewmode="movie")

    logger.info("pelisalacarta.platformcode.launcher " + item.tostring())

    try:

        # If item has no action, stops here
        if item.action == "":
            logger.info("pelisalacarta.platformcode.launcher Item sin accion")
            return

        # Action for main menu in channelselector
        if item.action == "getmainlist":
            import channelselector

            itemlist = channelselector.getmainlist()

            # Check for updates only on first screen
            if config.get_setting("updatecheck2") == "true":
                logger.info("pelisalacarta.platformcode.launcher Check for plugin updates enabled")
                from core import updater

                try:
                    version = updater.checkforupdates()

                    if version:
                        platformtools.dialog_ok(
                            "Versión " + version + " disponible",
                            "Ya puedes descargar la nueva versión del plugin\n" "desde el listado principal",
                        )

                        itemlist.insert(
                            0,
                            Item(
                                title="Descargar version " + version,
                                version=version,
                                channel="updater",
                                action="update",
                                thumbnail=channelselector.get_thumbnail_path() + "Crystal_Clear_action_info.png",
                            ),
                        )
                except:
                    platformtools.dialog_ok(
                        "No se puede conectar", "No ha sido posible comprobar", "si hay actualizaciones"
                    )
                    logger.info("cpelisalacarta.platformcode.launcher Fallo al verificar la actualización")

            else:
                logger.info("pelisalacarta.platformcode.launcher Check for plugin updates disabled")

            platformtools.render_items(itemlist, item)

        # Action for updating plugin
        elif item.action == "update":

            from core import updater

            updater.update(item)
            if config.get_system_platform() != "xbox":
                import xbmc

                xbmc.executebuiltin("Container.Refresh")

        # Action for channel types on channelselector: movies, series, etc.
        elif item.action == "getchanneltypes":
            import channelselector

            itemlist = channelselector.getchanneltypes()

            platformtools.render_items(itemlist, item)

        # Action for channel listing on channelselector
        elif item.action == "filterchannels":
            import channelselector

            itemlist = channelselector.filterchannels(item.channel_type)

            platformtools.render_items(itemlist, item)

        # Special action for playing a video from the library
        elif item.action == "play_from_library":
            play_from_library(item)
            return

        # Action in certain channel specified in "action" and "channel" parameters
        else:

            # Entry point for a channel is the "mainlist" action, so here we check parental control
            if item.action == "mainlist":

                # Parental control
                can_open_channel = False

                # If it is an adult channel, and user has configured pin, asks for it
                if channeltools.is_adult(item.channel) and config.get_setting("adult_pin") != "":

                    tecleado = platformtools.dialog_input("", "PIN para canales de adultos", True)
                    if tecleado is not None:
                        if tecleado == config.get_setting("adult_pin"):
                            can_open_channel = True

                # All the other cases can open the channel
                else:
                    can_open_channel = True

                if not can_open_channel:
                    return

            # Checks if channel exists
            channel_file = os.path.join(config.get_runtime_path(), "channels", item.channel + ".py")
            logger.info("pelisalacarta.platformcode.launcher channel_file=%s" % channel_file)

            channel = None

            if item.channel in ["personal", "personal2", "personal3", "personal4", "personal5"]:
                import channels.personal as channel

            elif os.path.exists(channel_file):
                try:
                    channel = __import__("channels.%s" % item.channel, None, None, ["channels.%s" % item.channel])
                except ImportError:
                    exec "import channels." + item.channel + " as channel"

            logger.info(
                "pelisalacarta.platformcode.launcher running channel " + channel.__name__ + " " + channel.__file__
            )

            # Special play action
            if item.action == "play":
                logger.info("pelisalacarta.platformcode.launcher play")
                # logger.debug("item_toPlay: " + "\n" + item.tostring('\n'))

                # First checks if channel has a "play" function
                if hasattr(channel, "play"):
                    logger.info("pelisalacarta.platformcode.launcher executing channel 'play' method")
                    itemlist = channel.play(item)
                    b_favourite = item.isFavourite
                    # Play should return a list of playable URLS
                    if len(itemlist) > 0:
                        item = itemlist[0]
                        if b_favourite:
                            item.isFavourite = True
                        platformtools.play_video(item)

                    # If not, shows user an error message
                    else:
                        platformtools.dialog_ok("plugin", "No hay nada para reproducir")

                # If player don't have a "play" function, not uses the standard play from platformtools
                else:
                    logger.info("pelisalacarta.platformcode.launcher executing core 'play' method")
                    platformtools.play_video(item)

            # Special action for findvideos, where the plugin looks for known urls
            elif item.action == "findvideos":

                # First checks if channel has a "findvideos" function
                if hasattr(channel, "findvideos"):
                    itemlist = getattr(channel, item.action)(item)

                # If not, uses the generic findvideos function
                else:
                    logger.info(
                        "pelisalacarta.platformcode.launcher no channel 'findvideos' method, " "executing core method"
                    )
                    from core import servertools

                    itemlist = servertools.find_video_items(item)

                if config.get_setting("filter_servers") == "true":
                    itemlist = filtered_servers(itemlist)

                from platformcode import subtitletools

                subtitletools.saveSubtitleName(item)

                platformtools.render_items(itemlist, item)

            # Special action for adding a movie to the library
            elif item.action == "add_pelicula_to_library":
                library.add_pelicula_to_library(item)

            # Special action for adding a serie to the library
            elif item.action == "add_serie_to_library":
                library.add_serie_to_library(item, channel)

            # Special action for downloading all episodes from a serie
            elif item.action == "download_all_episodes":
                downloadtools.download_all_episodes(item, channel)

            # Special action for searching, first asks for the words then call the "search" function
            elif item.action == "search":
                logger.info("pelisalacarta.platformcode.launcher search")

                tecleado = platformtools.dialog_input("")
                if tecleado is not None:
                    tecleado = tecleado.replace(" ", "+")
                    # TODO revisar 'personal.py' porque no tiene función search y daría problemas
                    itemlist = channel.search(item, tecleado)
                else:
                    itemlist = []

                platformtools.render_items(itemlist, item)

            # For all other actions
            else:
                logger.info("pelisalacarta.platformcode.launcher executing channel '" + item.action + "' method")
                itemlist = getattr(channel, item.action)(item)
                platformtools.render_items(itemlist, item)

    except urllib2.URLError, e:
        import traceback

        logger.error("pelisalacarta.platformcode.launcher " + traceback.format_exc())

        # Grab inner and third party errors
        if hasattr(e, "reason"):
            logger.info(
                "pelisalacarta.platformcode.launcher Razon del error, codigo: "
                + str(e.reason[0])
                + ", Razon: "
                + str(e.reason[1])
            )
            texto = config.get_localized_string(30050)  # "No se puede conectar con el sitio web"
            platformtools.dialog_ok("plugin", texto)

        # Grab server response errors
        elif hasattr(e, "code"):
            logger.info("pelisalacarta.platformcode.launcher codigo de error HTTP : %d" % e.code)
            # "El sitio web no funciona correctamente (error http %d)"
            platformtools.dialog_ok("plugin", config.get_localized_string(30051) % e.code)
示例#11
0
def run():
    logger.info("pelisalacarta.platformcode.launcher run")

    # Extract item from sys.argv
    if sys.argv[2]:
        item = Item().fromurl(sys.argv[2])

    # If no item, this is mainlist
    else:
        item = Item(channel="channelselector",
                    action="getmainlist",
                    viewmode="movie")

    logger.info("pelisalacarta.platformcode.launcher " + item.tostring())

    try:

        # If item has no action, stops here
        if item.action == "":
            logger.info("pelisalacarta.platformcode.launcher Item sin accion")
            return

        # Action for main menu in channelselector
        if item.action == "getmainlist":
            import channelselector
            itemlist = channelselector.getmainlist()

            # Check for updates only on first screen
            if config.get_setting("updatecheck2") == "true":
                logger.info(
                    "pelisalacarta.platformcode.launcher Check for plugin updates enabled"
                )
                from core import updater

                try:
                    version = updater.checkforupdates()

                    if version:
                        platformtools.dialog_ok(
                            "Versión " + version + " disponible",
                            "Ya puedes descargar la nueva versión del plugin\n"
                            "desde el listado principal")

                        itemlist.insert(
                            0,
                            Item(
                                title="Descargar version " + version,
                                version=version,
                                channel="updater",
                                action="update",
                                thumbnail=channelselector.get_thumbnail_path()
                                + "Crystal_Clear_action_info.png"))
                except:
                    platformtools.dialog_ok("No se puede conectar",
                                            "No ha sido posible comprobar",
                                            "si hay actualizaciones")
                    logger.info(
                        "cpelisalacarta.platformcode.launcher Fallo al verificar la actualización"
                    )

            else:
                logger.info(
                    "pelisalacarta.platformcode.launcher Check for plugin updates disabled"
                )

            platformtools.render_items(itemlist, item)

        # Action for updating plugin
        elif item.action == "update":

            from core import updater
            updater.update(item)
            if config.get_system_platform() != "xbox":
                import xbmc
                xbmc.executebuiltin("Container.Refresh")

        # Action for channel types on channelselector: movies, series, etc.
        elif item.action == "getchanneltypes":
            import channelselector
            itemlist = channelselector.getchanneltypes()

            platformtools.render_items(itemlist, item)

        # Action for channel listing on channelselector
        elif item.action == "filterchannels":
            import channelselector
            itemlist = channelselector.filterchannels(item.channel_type)

            platformtools.render_items(itemlist, item)

        # Special action for playing a video from the library
        elif item.action == "play_from_library":
            play_from_library(item)
            return

        # Action in certain channel specified in "action" and "channel" parameters
        else:

            # Entry point for a channel is the "mainlist" action, so here we check parental control
            if item.action == "mainlist":

                # Parental control
                can_open_channel = False

                # If it is an adult channel, and user has configured pin, asks for it
                if channeltools.is_adult(item.channel) and config.get_setting(
                        "adult_pin") != "":

                    tecleado = platformtools.dialog_input(
                        "", "PIN para canales de adultos", True)
                    if tecleado is not None:
                        if tecleado == config.get_setting("adult_pin"):
                            can_open_channel = True

                # All the other cases can open the channel
                else:
                    can_open_channel = True

                if not can_open_channel:
                    return

            # Checks if channel exists
            channel_file = os.path.join(config.get_runtime_path(), 'channels',
                                        item.channel + ".py")
            logger.info("pelisalacarta.platformcode.launcher channel_file=%s" %
                        channel_file)

            channel = None

            if item.channel in [
                    "personal", "personal2", "personal3", "personal4",
                    "personal5"
            ]:
                import channels.personal as channel

            elif os.path.exists(channel_file):
                try:
                    channel = __import__('channels.%s' % item.channel, None,
                                         None, ["channels.%s" % item.channel])
                except ImportError:
                    exec "import channels." + item.channel + " as channel"

            logger.info(
                "pelisalacarta.platformcode.launcher running channel " +
                channel.__name__ + " " + channel.__file__)

            # Special play action
            if item.action == "play":
                logger.info("pelisalacarta.platformcode.launcher play")
                # logger.debug("item_toPlay: " + "\n" + item.tostring('\n'))

                # First checks if channel has a "play" function
                if hasattr(channel, 'play'):
                    logger.info(
                        "pelisalacarta.platformcode.launcher executing channel 'play' method"
                    )
                    itemlist = channel.play(item)
                    b_favourite = item.isFavourite
                    # Play should return a list of playable URLS
                    if len(itemlist) > 0:
                        item = itemlist[0]
                        if b_favourite:
                            item.isFavourite = True
                        platformtools.play_video(item)

                    # If not, shows user an error message
                    else:
                        platformtools.dialog_ok("plugin",
                                                "No hay nada para reproducir")

                # If player don't have a "play" function, not uses the standard play from platformtools
                else:
                    logger.info(
                        "pelisalacarta.platformcode.launcher executing core 'play' method"
                    )
                    platformtools.play_video(item)

            # Special action for findvideos, where the plugin looks for known urls
            elif item.action == "findvideos":

                # First checks if channel has a "findvideos" function
                if hasattr(channel, 'findvideos'):
                    itemlist = getattr(channel, item.action)(item)

                # If not, uses the generic findvideos function
                else:
                    logger.info(
                        "pelisalacarta.platformcode.launcher no channel 'findvideos' method, "
                        "executing core method")
                    from core import servertools
                    itemlist = servertools.find_video_items(item)

                if config.get_setting('filter_servers') == 'true':
                    itemlist = filtered_servers(itemlist)

                from platformcode import subtitletools
                subtitletools.saveSubtitleName(item)

                platformtools.render_items(itemlist, item)

            # Special action for adding a movie to the library
            elif item.action == "add_pelicula_to_library":
                library.add_pelicula_to_library(item)

            # Special action for adding a serie to the library
            elif item.action == "add_serie_to_library":
                library.add_serie_to_library(item, channel)

            # Special action for downloading all episodes from a serie
            elif item.action == "download_all_episodes":
                downloadtools.download_all_episodes(item, channel)

            # Special action for searching, first asks for the words then call the "search" function
            elif item.action == "search":
                logger.info("pelisalacarta.platformcode.launcher search")

                tecleado = platformtools.dialog_input("")
                if tecleado is not None:
                    tecleado = tecleado.replace(" ", "+")
                    # TODO revisar 'personal.py' porque no tiene función search y daría problemas
                    itemlist = channel.search(item, tecleado)
                else:
                    itemlist = []

                platformtools.render_items(itemlist, item)

            # For all other actions
            else:
                logger.info(
                    "pelisalacarta.platformcode.launcher executing channel '" +
                    item.action + "' method")
                itemlist = getattr(channel, item.action)(item)
                platformtools.render_items(itemlist, item)

    except urllib2.URLError, e:
        import traceback
        logger.error("pelisalacarta.platformcode.launcher " +
                     traceback.format_exc())

        # Grab inner and third party errors
        if hasattr(e, 'reason'):
            logger.info(
                "pelisalacarta.platformcode.launcher Razon del error, codigo: "
                + str(e.reason[0]) + ", Razon: " + str(e.reason[1]))
            texto = config.get_localized_string(
                30050)  # "No se puede conectar con el sitio web"
            platformtools.dialog_ok("plugin", texto)

        # Grab server response errors
        elif hasattr(e, 'code'):
            logger.info(
                "pelisalacarta.platformcode.launcher codigo de error HTTP : %d"
                % e.code)
            # "El sitio web no funciona correctamente (error http %d)"
            platformtools.dialog_ok(
                "plugin",
                config.get_localized_string(30051) % e.code)