예제 #1
0
def set_infolabels(listitem, item, player=False):
    """
    Metodo para pasar la informacion al listitem (ver tmdb.set_InfoLabels() )
    item.infoLabels es un dicionario con los pares de clave/valor descritos en:
    http://mirrors.xbmc.org/docs/python-docs/14.x-helix/xbmcgui.html#ListItem-setInfo
    @param listitem: objeto xbmcgui.ListItem
    @type listitem: xbmcgui.ListItem
    @param item: objeto Item que representa a una pelicula, serie o capitulo
    @type item: item
    """
    if item.infoLabels:
        if 'mediatype' not in item.infoLabels:
            item.infoLabels['mediatype'] = item.contentType
        listitem.setInfo("video", item.infoLabels)

    if player and not item.contentTitle:
        if item.fulltitle:
            listitem.setInfo("video", {"Title": item.fulltitle})
        else:
            listitem.setInfo("video", {"Title": item.title})

    elif not player:
        listitem.setInfo("video", {"Title": item.title})

    # Añadido para Kodi Krypton (v17)
    if config.get_platform(True)['num_version'] >= 17.0:
        listitem.setArt({"poster": item.thumbnail})
예제 #2
0
파일: api.py 프로젝트: oscbox/pelisalacarta
def plugins_get_latest_packages():
    logger.info("pelisalacarta.core.api.plugins.get_latest_packages")

    parameters = {
        "plugin": config.PLUGIN_NAME,
        "platform": config.get_platform()
    }
    return remote_call("plugins/get_latest_packages.php", parameters)
예제 #3
0
def plugins_get_latest_packages():
    logger.info()

    parameters = {
        "plugin": config.PLUGIN_NAME,
        "platform": config.get_platform()
    }
    return remote_call("plugins/get_latest_packages.php", parameters)
예제 #4
0
def plugins_get_all_packages():
    plugintools.log("tvalacarta.core.api.plugins.plugins_get_all_packages")

    parameters = {
        "plugin": config.PLUGIN_NAME,
        "platform": config.get_platform()
    }
    return remote_call("plugins/get_all_packages.php", parameters)
예제 #5
0
def plugins_get_all_packages():
    logger.info("streamondemand.core.api.plugins.get_all_packages")

    parameters = {
        "plugin": config.PLUGIN_NAME,
        "platform": config.get_platform()
    }
    return remote_call("plugins/get_all_packages.php", parameters)
예제 #6
0
def set_opcion(item, seleccion, opciones, video_urls):
    logger.info()
    # logger.debug(item.tostring('\n'))
    salir = False
    # No ha elegido nada, lo más probable porque haya dado al ESC

    if seleccion == -1:
        # Para evitar el error "Uno o más elementos fallaron" al cancelar la selección desde fichero strm
        listitem = xbmcgui.ListItem(item.title)

        if config.get_platform(True)['num_version'] >= 16.0:
            listitem.setArt({
                'icon': "DefaultVideo.png",
                'thumb': item.thumbnail
            })
        else:
            listitem.setIconImage("DefaultVideo.png")
            listitem.setThumbnailImage(item.thumbnail)

        xbmcplugin.setResolvedUrl(int(sys.argv[1]), False, listitem)

    # "Descargar"
    elif opciones[seleccion] == config.get_localized_string(30153):
        from channels import downloads
        if item.contentType == "list" or item.contentType == "tvshow":
            item.contentType = "video"
        item.play_menu = True
        downloads.save_download(item)
        salir = True

    # "Quitar de favoritos"
    elif opciones[seleccion] == config.get_localized_string(30154):
        from channels import favorites
        favorites.delFavourite(item)
        salir = True

    # "Añadir a favoritos":
    elif opciones[seleccion] == config.get_localized_string(30155):
        from channels import favorites
        item.from_channel = "favorites"
        favorites.addFavourite(item)
        salir = True

    # "Buscar Trailer":
    elif opciones[seleccion] == config.get_localized_string(30162):
        config.set_setting("subtitulo", False)
        xbmc.executebuiltin("XBMC.RunPlugin(%s?%s)" %
                            (sys.argv[0],
                             item.clone(channel="trailertools",
                                        action="buscartrailer",
                                        contextual=True).tourl()))
        salir = True

    return salir
예제 #7
0
def generate_nginx_conf(ssl=False, ssl_cert_file=None, ssl_key_file=None):
    try:
        platform_root, err = config.get_platform_root()
        if err:
            raise Exception(err)
        platform, err = config.get_platform()
        if err:
            raise Exception(err)
        shutil.copyfile('/etc/nginx/sites-enabled/integral_view_nginx.conf',
                        '/tmp/integral_view_nginx.conf')
        with open('/etc/nginx/sites-enabled/integral_view_nginx.conf', 'w') as f:
            f.write('upstream django {\n')
            f.write(
                ' server unix:///%s/integral_view/integral_view.sock;\n' % platform_root)
            f.write('}\n')
            f.write('\n')
            f.write('server {\n')
            if ssl:
                f.write('  listen      443 ssl;\n')
                f.write('  ssl_certificate %s;\n' % ssl_cert_file)
                f.write('  ssl_certificate_key %s;\n' % ssl_key_file)
            else:
                f.write('  listen      80;\n')

            f.write('  charset     utf-8;\n')
            f.write('  client_max_body_size 75M;\n')
            f.write('  location /static {\n')
            f.write('    alias %s/integral_view/static;\n' % platform_root)
            f.write('  }\n')
            f.write('\n')
            f.write('  location / {\n')
            f.write('    uwsgi_pass  django;\n')
            f.write('    include     %s/integral_view/uwsgi_params;\n' %
                    platform_root)
            f.write('  }\n')
            f.write('}\n')
    except Exception, e:
        if os.path.exists('/tmp/integral_view_nginx.conf'):
            shutil.copyfile('/tmp/integral_view_nginx.conf',
                            '/etc/nginx/sites-enabled/integral_view_nginx.conf')
        return False, 'Error generating HTTPS configuration : %s' % str(e)
예제 #8
0
    IMAGES_PATH = 'http://pelisalacarta.mimediacenter.info/posters/'
elif thumbnail_type == "1":
    IMAGES_PATH = 'http://pelisalacarta.mimediacenter.info/banners/'
elif thumbnail_type == "2":
    IMAGES_PATH = 'http://pelisalacarta.mimediacenter.info/squares/'

ROOT_DIR = config.get_runtime_path()

REMOTE_VERSION_FILE = "http://blog.tvalacarta.info/descargas/" + PLUGIN_NAME + "-version.xml"
LOCAL_VERSION_FILE = os.path.join(ROOT_DIR, "version.xml")
LOCAL_FILE = os.path.join(ROOT_DIR, PLUGIN_NAME + "-")

try:
    # Añadida a la opcion : si plataforma xbmcdharma es "True", no debe ser con la plataforma de la xbox
    # porque seria un falso "True", ya que el xbmc en las xbox no son dharma por lo tanto no existen los addons
    logger.info("[updater.py] get_platform=" + config.get_platform())
    logger.info("[updater.py] get_system_platform=" +
                config.get_system_platform())
    if config.get_platform(
    ) == "xbmcdharma" and not config.get_system_platform() == "xbox":
        import xbmc
        REMOTE_FILE = "http://blog.tvalacarta.info/descargas/" + PLUGIN_NAME + "-xbmc-addon-dharma-"
        DESTINATION_FOLDER = xbmc.translatePath("special://home/addons")
    elif config.get_platform() == "xbmceden":
        import xbmc
        REMOTE_FILE = "http://blog.tvalacarta.info/descargas/" + PLUGIN_NAME + "-xbmc-addon-eden-"
        DESTINATION_FOLDER = xbmc.translatePath("special://home/addons")
    elif config.get_platform() == "xbmcfrodo":
        import xbmc
        REMOTE_FILE = "http://blog.tvalacarta.info/descargas/" + PLUGIN_NAME + "-xbmc-addon-frodo-"
        DESTINATION_FOLDER = xbmc.translatePath("special://home/addons")
예제 #9
0
import config
import logger
import scrapertools

ROOT_DIR = config.get_runtime_path()

REMOTE_VERSION_FILE = "http://descargas.tvalacarta.info/" + config.PLUGIN_NAME + "-version.xml"
LOCAL_VERSION_FILE = os.path.join(ROOT_DIR, "version.xml")
LOCAL_FILE = os.path.join(ROOT_DIR, config.PLUGIN_NAME + "-")

#DESTINATION_FOLDER sera siempre el lugar donde este la carpeta del plugin,
#No hace falta "xbmc.translatePath", get_runtime_path() ya tiene que devolver la ruta correcta
DESTINATION_FOLDER = os.path.join(config.get_runtime_path(), "..")

#Todas las plataformas son "pelisalacarta-nombre-plataforma-version.zip" excepto para xbmc que es "pelisalacarta-xbmc-plugin-version.zip"
if config.get_platform() == "xbmc":
    REMOTE_FILE = "http://descargas.tvalacarta.info/%s-%s-" % (
        config.PLUGIN_NAME, "xbmc-plugin")

else:
    REMOTE_FILE = "http://descargas.tvalacarta.info/%s-%s-" % (
        config.PLUGIN_NAME, config.get_platform())


def checkforupdates():
    logger.info("pelisalacarta.core.updater checkforupdates")

    # Descarga el fichero con la versión en la web
    logger.info("pelisalacarta.core.updater Verificando actualizaciones...")
    logger.info("pelisalacarta.core.updater Version remota: " +
                REMOTE_VERSION_FILE)
예제 #10
0
def render_items(itemlist, parent_item):
    """
    Función encargada de mostrar el itemlist en kodi, se pasa como parametros el itemlist y el item del que procede
    @type itemlist: list
    @param itemlist: lista de elementos a mostrar

    @type parent_item: item
    @param parent_item: elemento padre
    """
    # Si el itemlist no es un list salimos
    if not type(itemlist) == list:

        return

    if parent_item.start:
        menu_icon = get_thumb('menu.png')
        menu = Item(channel="channelselector",
                    action="getmainlist",
                    viewmode="movie",
                    thumbnail=menu_icon,
                    title='Menu')
        itemlist.insert(0, menu)

    # Si no hay ningun item, mostramos un aviso
    if not len(itemlist):
        itemlist.append(Item(title="No hay elementos que mostrar"))

    # Recorremos el itemlist
    for item in itemlist:
        # Si el item no contiene categoria, le ponemos la del item padre
        if item.category == "":
            item.category = parent_item.category

        # Si el item no contiene fanart, le ponemos el del item padre
        if item.fanart == "":
            item.fanart = parent_item.fanart

        # Formatear titulo
        if item.text_color:
            item.title = '[COLOR %s]%s[/COLOR]' % (item.text_color, item.title)
        if item.text_bold:
            item.title = '[B]%s[/B]' % item.title
        if item.text_italic:
            item.title = '[I]%s[/I]' % item.title

        # Añade headers a las imagenes si estan en un servidor con cloudflare
        from core import httptools
        item.thumbnail = httptools.get_url_headers(item.thumbnail)
        item.fanart = httptools.get_url_headers(item.fanart)

        # IconImage para folder y video
        if item.folder:
            icon_image = "DefaultFolder.png"
        else:
            icon_image = "DefaultVideo.png"

        # Ponemos el fanart
        if item.fanart:
            fanart = item.fanart
        else:
            fanart = os.path.join(config.get_runtime_path(), "fanart.jpg")

        # Creamos el listitem
        listitem = xbmcgui.ListItem(item.title)

        # values icon, thumb or poster are skin dependent.. so we set all to avoid problems
        # if not exists thumb it's used icon value
        if config.get_platform(True)['num_version'] >= 16.0:
            listitem.setArt({
                'icon': icon_image,
                'thumb': item.thumbnail,
                'poster': item.thumbnail,
                'fanart': fanart
            })
        else:
            listitem.setIconImage(icon_image)
            listitem.setThumbnailImage(item.thumbnail)
            listitem.setProperty('fanart_image', fanart)

        # No need it, use fanart instead
        # xbmcplugin.setPluginFanart(int(sys.argv[1]), os.path.join(config.get_runtime_path(), "fanart.jpg"))

        # Esta opcion es para poder utilizar el xbmcplugin.setResolvedUrl()
        # if item.isPlayable == True or (config.get_setting("player_mode") == 1 and item.action == "play"):
        if config.get_setting("player_mode") == 1 and item.action == "play":
            if item.folder:
                item.folder = False
            listitem.setProperty('IsPlayable', 'true')

        # Añadimos los infoLabels
        set_infolabels(listitem, item)

        # Montamos el menu contextual
        context_commands = set_context_commands(item, parent_item)

        # Añadimos el item
        if config.get_platform(True)['num_version'] >= 17.0:
            listitem.addContextMenuItems(context_commands)
        else:
            listitem.addContextMenuItems(context_commands, replaceItems=True)

        if not item.totalItems:
            item.totalItems = 0
        xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),
                                    url='%s?%s' % (sys.argv[0], item.tourl()),
                                    listitem=listitem,
                                    isFolder=item.folder,
                                    totalItems=item.totalItems)

    # Fijar los tipos de vistas...
    if config.get_setting("forceview"):
        # ...forzamos segun el viewcontent
        xbmcplugin.setContent(int(sys.argv[1]), parent_item.viewcontent)
    elif parent_item.channel not in ["channelselector", ""]:
        # ... o segun el canal
        xbmcplugin.setContent(int(sys.argv[1]), "movies")

    # Fijamos el "breadcrumb"
    xbmcplugin.setPluginCategory(handle=int(sys.argv[1]),
                                 category=parent_item.category.capitalize())

    # No ordenar items
    xbmcplugin.addSortMethod(handle=int(sys.argv[1]),
                             sortMethod=xbmcplugin.SORT_METHOD_NONE)

    # Cerramos el directorio
    xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=True)

    # Fijar la vista
    if config.get_setting("forceview"):
        viewmode_id = get_viewmode_id(parent_item)
        xbmc.executebuiltin("Container.SetViewMode(%s)" % viewmode_id)
    if parent_item.mode in ['silent', 'get_cached', 'set_cache', 'finish']:
        xbmc.executebuiltin("Container.SetViewMode(500)")
예제 #11
0
def set_context_commands(item, parent_item):
    """
    Función para generar los menus contextuales.
        1. Partiendo de los datos de item.context
             a. Metodo antiguo item.context tipo str separando las opciones por "|" (ejemplo: item.context = "1|2|3")
                (solo predefinidos)
            b. Metodo list: item.context es un list con las diferentes opciones del menu:
                - Predefinidos: Se cargara una opcion predefinida con un nombre.
                    item.context = ["1","2","3"]

                - dict(): Se cargara el item actual modificando los campos que se incluyan en el dict() en caso de
                    modificar los campos channel y action estos serán guardados en from_channel y from_action.
                    item.context = [{"title":"Nombre del menu", "action": "action del menu",
                                        "channel":"channel del menu"}, {...}]

        2. Añadiendo opciones segun criterios
            Se pueden añadir opciones al menu contextual a items que cumplan ciertas condiciones.


        3. Añadiendo opciones a todos los items
            Se pueden añadir opciones al menu contextual para todos los items

        4. Se pueden deshabilitar las opciones del menu contextual añadiendo un comando 'no_context' al item.context.
            Las opciones que Kodi, el skin u otro añadido añada al menu contextual no se pueden deshabilitar.

    @param item: elemento que contiene los menu contextuales
    @type item: item
    @param parent_item:
    @type parent_item: item
    """
    context_commands = []
    num_version_xbmc = config.get_platform(True)['num_version']

    # Creamos un list con las diferentes opciones incluidas en item.context
    if type(item.context) == str:
        context = item.context.split("|")
    elif type(item.context) == list:
        context = item.context
    else:
        context = []

    # Opciones segun item.context
    for command in context:
        # Predefinidos
        if type(command) == str:
            if command == "no_context":
                return []

        # Formato dict
        if type(command) == dict:
            # Los parametros del dict, se sobreescriben al nuevo context_item en caso de sobreescribir "action" y
            # "channel", los datos originales se guardan en "from_action" y "from_channel"
            if "action" in command:
                command["from_action"] = item.action
            if "channel" in command:
                command["from_channel"] = item.channel

            if "goto" in command:
                context_commands.append(
                    (command["title"], "XBMC.Container.Refresh (%s?%s)" %
                     (sys.argv[0], item.clone(**command).tourl())))
            else:
                context_commands.append(
                    (command["title"], "XBMC.RunPlugin(%s?%s)" %
                     (sys.argv[0], item.clone(**command).tourl())))

    # Opciones segun criterios, solo si el item no es un tag (etiqueta), ni es "Añadir a la videoteca", etc...
    if item.action and item.action not in [
            "add_pelicula_to_library", "add_serie_to_library", "buscartrailer"
    ]:
        # Mostrar informacion: si el item tiene plot suponemos q es una serie, temporada, capitulo o pelicula
        if item.infoLabels['plot'] and (num_version_xbmc < 17.0
                                        or item.contentType == 'season'):
            context_commands.append(("Información", "XBMC.Action(Info)"))

        # ExtendedInfo: Si esta instalado el addon y se cumplen una serie de condiciones
        if xbmc.getCondVisibility('System.HasAddon(script.extendedinfo)') \
                and config.get_setting("extended_info") == True:
            if item.contentType == "episode" and item.contentEpisodeNumber and item.contentSeason \
                    and (item.infoLabels['tmdb_id'] or item.contentSerieName):
                param = "tvshow_id =%s, tvshow=%s, season=%s, episode=%s" \
                        % (item.infoLabels['tmdb_id'], item.contentSerieName, item.contentSeason,
                           item.contentEpisodeNumber)
                context_commands.append((
                    "ExtendedInfo",
                    "XBMC.RunScript(script.extendedinfo,info=extendedepisodeinfo,%s)"
                    % param))

            elif item.contentType == "season" and item.contentSeason \
                    and (item.infoLabels['tmdb_id'] or item.contentSerieName):
                param = "tvshow_id =%s,tvshow=%s, season=%s" \
                        % (item.infoLabels['tmdb_id'], item.contentSerieName, item.contentSeason)
                context_commands.append(
                    ("ExtendedInfo",
                     "XBMC.RunScript(script.extendedinfo,info=seasoninfo,%s)" %
                     param))

            elif item.contentType == "tvshow" and (
                    item.infoLabels['tmdb_id'] or item.infoLabels['tvdb_id']
                    or item.infoLabels['imdb_id'] or item.contentSerieName):
                param = "id =%s,tvdb_id=%s,imdb_id=%s,name=%s" \
                        % (item.infoLabels['tmdb_id'], item.infoLabels['tvdb_id'], item.infoLabels['imdb_id'],
                           item.contentSerieName)
                context_commands.append((
                    "ExtendedInfo",
                    "XBMC.RunScript(script.extendedinfo,info=extendedtvinfo,%s)"
                    % param))

            elif item.contentType == "movie" and (item.infoLabels['tmdb_id']
                                                  or item.infoLabels['imdb_id']
                                                  or item.contentTitle):
                param = "id =%s,imdb_id=%s,name=%s" \
                        % (item.infoLabels['tmdb_id'], item.infoLabels['imdb_id'], item.contentTitle)
                context_commands.append(
                    ("ExtendedInfo",
                     "XBMC.RunScript(script.extendedinfo,info=extendedinfo,%s)"
                     % param))

        # InfoPlus
        if config.get_setting("infoplus") == True:
            if item.infoLabels['tmdb_id'] or item.infoLabels['imdb_id'] or item.infoLabels['tvdb_id'] or \
                    (item.contentTitle and item.infoLabels["year"]) or item.contentSerieName:
                context_commands.append(
                    ("InfoPlus", "XBMC.RunPlugin(%s?%s)" %
                     (sys.argv[0],
                      item.clone(channel="infoplus",
                                 action="start",
                                 from_channel=item.channel).tourl())))

        # Ir al Menu Principal (channel.mainlist)
        if parent_item.channel not in ["news", "channelselector"] and item.action != "mainlist" \
                and parent_item.action != "mainlist":
            context_commands.append(
                ("Ir al Menu Principal", "XBMC.Container.Refresh (%s?%s)" %
                 (sys.argv[0], Item(channel=item.channel,
                                    action="mainlist").tourl())))

        # Añadir a Favoritos
        if num_version_xbmc < 17.0 and \
                ((item.channel not in ["favorites", "videolibrary", "help", ""]
                  or item.action in ["update_videolibrary"]) and parent_item.channel != "favorites"):
            context_commands.append(
                (config.get_localized_string(30155), "XBMC.RunPlugin(%s?%s)" %
                 (sys.argv[0],
                  item.clone(channel="favorites",
                             action="addFavourite",
                             from_channel=item.channel,
                             from_action=item.action).tourl())))
        #Buscar en otros canales
        if item.contentType in ['movie', 'tvshow'
                                ] and item.channel != 'search':
            # Buscar en otros canales
            if item.contentSerieName != '':
                item.wanted = item.contentSerieName
            else:
                item.wanted = item.contentTitle
            context_commands.append(
                ("[COLOR yellow]Buscar en otros canales[/COLOR]",
                 "XBMC.Container.Update (%s?%s)" %
                 (sys.argv[0],
                  item.clone(channel='search',
                             action="do_search",
                             from_channel=item.channel,
                             contextual=True).tourl())))
        #Definir como Pagina de inicio
        if config.get_setting('start_page'):
            if item.action not in ['findvideos', 'play']:
                context_commands.insert(
                    0,
                    ("[COLOR 0xffccff00]Definir como pagina de inicio[/COLOR]",
                     "XBMC.RunPlugin(%s?%s)" %
                     (sys.argv[0],
                      Item(channel='side_menu',
                           action="set_custom_start",
                           parent=item.tourl()).tourl())))

        if item.channel != "videolibrary":
            # Añadir Serie a la videoteca
            if item.action in ["episodios", "get_episodios"
                               ] and item.contentSerieName:
                context_commands.append(
                    ("Añadir Serie a Videoteca", "XBMC.RunPlugin(%s?%s)" %
                     (sys.argv[0],
                      item.clone(action="add_serie_to_library",
                                 from_action=item.action).tourl())))
            # Añadir Pelicula a videoteca
            elif item.action in [
                    "detail", "findvideos"
            ] and item.contentType == 'movie' and item.contentTitle:
                context_commands.append(
                    ("Añadir Pelicula a Videoteca", "XBMC.RunPlugin(%s?%s)" %
                     (sys.argv[0],
                      item.clone(action="add_pelicula_to_library",
                                 from_action=item.action).tourl())))

        if item.channel != "downloads":
            # Descargar pelicula
            if item.contentType == "movie" and item.contentTitle:
                context_commands.append(
                    ("Descargar Pelicula", "XBMC.RunPlugin(%s?%s)" %
                     (sys.argv[0],
                      item.clone(channel="downloads",
                                 action="save_download",
                                 from_channel=item.channel,
                                 from_action=item.action).tourl())))

            elif item.contentSerieName:
                # Descargar serie
                if item.contentType == "tvshow":
                    context_commands.append(
                        ("Descargar Serie", "XBMC.RunPlugin(%s?%s)" %
                         (sys.argv[0],
                          item.clone(channel="downloads",
                                     action="save_download",
                                     from_channel=item.channel,
                                     from_action=item.action).tourl())))

                # Descargar episodio
                if item.contentType == "episode":
                    context_commands.append(
                        ("Descargar Episodio", "XBMC.RunPlugin(%s?%s)" %
                         (sys.argv[0],
                          item.clone(channel="downloads",
                                     action="save_download",
                                     from_channel=item.channel,
                                     from_action=item.action).tourl())))

                # Descargar temporada
                if item.contentType == "season":
                    context_commands.append(
                        ("Descargar Temporada", "XBMC.RunPlugin(%s?%s)" %
                         (sys.argv[0],
                          item.clone(channel="downloads",
                                     action="save_download",
                                     from_channel=item.channel,
                                     from_action=item.action).tourl())))

        # Abrir configuración
        if parent_item.channel not in ["setting", "news", "search"]:
            context_commands.append(
                ("Abrir Configuración", "XBMC.Container.Update(%s?%s)" %
                 (sys.argv[0], Item(channel="setting",
                                    action="mainlist").tourl())))

        # Buscar Trailer
        if item.action == "findvideos" or "buscar_trailer" in context:
            context_commands.append(
                ("Buscar Trailer", "XBMC.RunPlugin(%s?%s)" %
                 (sys.argv[0],
                  item.clone(channel="trailertools",
                             action="buscartrailer",
                             contextual=True).tourl())))

    # Añadir SuperFavourites al menu contextual (1.0.53 o superior necesario)
    sf_file_path = xbmc.translatePath(
        "special://home/addons/plugin.program.super.favourites/LaunchSFMenu.py"
    )
    check_sf = os.path.exists(sf_file_path)
    if check_sf and xbmc.getCondVisibility(
            'System.HasAddon("plugin.program.super.favourites")'):
        context_commands.append((
            "Super Favourites Menu",
            "XBMC.RunScript(special://home/addons/plugin.program.super.favourites/LaunchSFMenu.py)"
        ))

    context_commands = sorted(context_commands, key=lambda comand: comand[0])
    # Menu Rapido
    context_commands.insert(0, ("[COLOR 0xffccff00]<Menú Rápido>[/COLOR]",
                                "XBMC.Container.Update (%s?%s)" %
                                (sys.argv[0],
                                 Item(channel='side_menu',
                                      action="open_menu",
                                      parent=parent_item.tourl()).tourl())))
    return context_commands
예제 #12
0
    IMAGES_PATH = 'http://media.tvalacarta.info/tvalacarta/posters/'
elif thumbnail_type=="1":
    IMAGES_PATH = 'http://media.tvalacarta.info/tvalacarta/banners/'
elif thumbnail_type=="2":
    IMAGES_PATH = 'http://media.tvalacarta.info/tvalacarta/squares/'

ROOT_DIR = config.get_runtime_path()

REMOTE_VERSION_FILE = "http://descargas.tvalacarta.info/"+config.PLUGIN_NAME+"-version.xml"
LOCAL_VERSION_FILE = os.path.join( ROOT_DIR , "version.xml" )
LOCAL_FILE = os.path.join( ROOT_DIR , config.PLUGIN_NAME+"-" )

try:
    # Añadida a la opcion : si plataforma xbmcdharma es "True", no debe ser con la plataforma de la xbox
    # porque seria un falso "True", ya que el xbmc en las xbox no son dharma por lo tanto no existen los addons
    logger.info("tvalacarta.core.updater get_platform="+config.get_platform())
    logger.info("tvalacarta.core.updater get_system_platform="+config.get_system_platform())
    if config.get_platform()=="kodi-jarvis":
        import xbmc
        REMOTE_FILE = "http://descargas.tvalacarta.info/"+config.PLUGIN_NAME+"-kodi-jarvis-"
        DESTINATION_FOLDER = xbmc.translatePath( "special://home/addons")
    elif config.get_platform()=="kodi-isengard":
        import xbmc
        REMOTE_FILE = "http://descargas.tvalacarta.info/"+config.PLUGIN_NAME+"-kodi-isengard-"
        DESTINATION_FOLDER = xbmc.translatePath( "special://home/addons")
    elif config.get_platform()=="kodi-helix":
        import xbmc
        REMOTE_FILE = "http://descargas.tvalacarta.info/"+config.PLUGIN_NAME+"-kodi-helix-"
        DESTINATION_FOLDER = xbmc.translatePath( "special://home/addons")
    elif config.get_platform()=="xbmc-eden":
        import xbmc

## Full path of the remote file version.
REMOTE_VERSION_FILE = "https://raw.githubusercontent.com/Fenice82/plugin.video.streamondemand-pureita/master/version.xml"

## Full path of the local file version.
LOCAL_VERSION_FILE = os.path.join( ROOT_DIR , "version.xml" )

## Full path to the local .zip file. It includes the beginning of the file name.
## Later, the version that you correspoda, name of the platform and the extension .zip is added.
LOCAL_FILE = os.path.join( ROOT_DIR , "plugin.video."+config.PLUGIN_NAME+"-master" )

try:
    # Añadida a la opcion : si plataforma xbmcdharma es "True", no debe ser con la plataforma de la xbox
    # porque seria un falso "True", ya que el xbmc en las xbox no son dharma por lo tanto no existen los addons
    logger.info("streamondemand-pureita.core.updater get_platform="+config.get_platform())
    logger.info("streamondemand-pureita.core.updater get_system_platform="+config.get_system_platform())
    if config.get_platform()=="kodi-isengard":
        import xbmc
        REMOTE_FILE = "https://raw.githubusercontent.com/Fenice82/plugin.video.streamondemand-pureita/master/"
        DESTINATION_FOLDER = xbmc.translatePath( "special://home/addons")
    elif config.get_platform()=="kodi-helix":
        import xbmc
        REMOTE_FILE = "https://raw.githubusercontent.com/Fenice82/plugin.video.streamondemand-pureita/master/"
        DESTINATION_FOLDER = xbmc.translatePath( "special://home/addons")
    elif config.get_platform()=="xbmceden":
        import xbmc
        REMOTE_FILE = "https://raw.githubusercontent.com/Fenice82/plugin.video.streamondemand-pureita/master/"
        DESTINATION_FOLDER = xbmc.translatePath( "special://home/addons")
    elif config.get_platform()=="xbmcfrodo":
        import xbmc
예제 #14
0
    IMAGES_PATH = 'http://media.tvalacarta.info/pelisalacarta/banners/'
elif thumbnail_type == "2":
    IMAGES_PATH = 'http://media.tvalacarta.info/pelisalacarta/squares/'

ROOT_DIR = config.get_runtime_path()

REMOTE_VERSION_FILE = "http://descargas.tvalacarta.info/" + config.PLUGIN_NAME + "-version.xml"
LOCAL_VERSION_FILE = os.path.join(ROOT_DIR, "version.xml")
LOCAL_FILE = os.path.join(ROOT_DIR, config.PLUGIN_NAME + "-")

try:
    # Añadida a la opcion : si plataforma xbmcdharma es "True", no debe ser con la plataforma de la xbox
    # porque seria un falso "True", ya que el xbmc en las xbox no son dharma por lo tanto no existen los addons
    logger.info("pelisalacarta.core.updater get_platform=" +
                config.PLATFORM_NAME)
    if config.get_platform() == "kodi-isengard":
        import xbmc
        REMOTE_FILE = "http://descargas.tvalacarta.info/" + config.PLUGIN_NAME + "-kodi-isengard-"
        DESTINATION_FOLDER = xbmc.translatePath("special://home/addons")
    elif config.get_platform() == "kodi-helix":
        import xbmc
        REMOTE_FILE = "http://descargas.tvalacarta.info/" + config.PLUGIN_NAME + "-kodi-helix-"
        DESTINATION_FOLDER = xbmc.translatePath("special://home/addons")
    elif config.get_platform() == "xbmceden":
        import xbmc
        REMOTE_FILE = "http://descargas.tvalacarta.info/" + config.PLUGIN_NAME + "-xbmc-eden-"
        DESTINATION_FOLDER = xbmc.translatePath("special://home/addons")
    elif config.get_platform() == "xbmcfrodo":
        import xbmc
        REMOTE_FILE = "http://descargas.tvalacarta.info/" + config.PLUGIN_NAME + "-xbmc-frodo-"
        DESTINATION_FOLDER = xbmc.translatePath("special://home/addons")
예제 #15
0
파일: api.py 프로젝트: nosuko/tvalacarta
def plugins_get_latest_packages():
    plugintools.log("tvalacarta.core.api.plugins.get_latest_packages")

    parameters = { "plugin" : config.PLUGIN_NAME , "platform" : config.get_platform() }
    return remote_call( "plugins/get_latest_packages.php" , parameters )
예제 #16
0
def cachePage(
        url,
        post=None,
        headers=[[
            'User-Agent',
            'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; es-ES; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12'
        ]],
        modoCache=CACHE_ACTIVA):

    logger.info("[scrapertools.py] cachePage url=" + url)
    modoCache = config.get_setting("cache.mode")

    if config.get_platform() == "plex":
        from PMS import HTTP
        try:
            logger.info("url=" + url)
            data = HTTP.Request(url)
            logger.info("descargada")
        except:
            data = ""
            logger.error("Error descargando " + url)
            import sys
            for line in sys.exc_info():
                logger.error("%s" % line)

        return data

    else:
        # CACHE_NUNCA: Siempre va a la URL a descargar
        # obligatorio para peticiones POST
        if modoCache == CACHE_NUNCA or post is not None:
            logger.info("[scrapertools.py] MODO_CACHE=2 (no cachear)")

            data = downloadpage(url, post, headers)

        # CACHE_SIEMPRE: Siempre descarga de cache, sin comprobar fechas, excepto cuando no está
        elif modoCache == CACHE_SIEMPRE:
            logger.info("[scrapertools.py] MODO_CACHE=1 (cachear todo)")

            # Obtiene los handlers del fichero en la cache
            cachedFile, newFile = getCacheFileNames(url)

            # Si no hay ninguno, descarga
            if cachedFile == "":
                logger.debug("[scrapertools.py] No está en cache")

                # Lo descarga
                data = downloadpage(url, post, headers)

                # Lo graba en cache
                outfile = open(newFile, "w")
                outfile.write(data)
                outfile.flush()
                outfile.close()
                logger.info("[scrapertools.py] Grabado a " + newFile)
            else:
                logger.info("[scrapertools.py] Leyendo de cache " + cachedFile)
                infile = open(cachedFile)
                data = infile.read()
                infile.close()

        # CACHE_ACTIVA: Descarga de la cache si no ha cambiado
        else:
            logger.info("[scrapertools.py] MODO_CACHE=0 (automática)")

            # Datos descargados
            data = ""

            # Obtiene los handlers del fichero en la cache
            cachedFile, newFile = getCacheFileNames(url)

            # Si no hay ninguno, descarga
            if cachedFile == "":
                logger.debug("[scrapertools.py] No está en cache")

                # Lo descarga
                data = downloadpage(url, post, headers)

                # Lo graba en cache
                outfile = open(newFile, "w")
                outfile.write(data)
                outfile.flush()
                outfile.close()
                logger.info("[scrapertools.py] Grabado a " + newFile)

            # Si sólo hay uno comprueba el timestamp (hace una petición if-modified-since)
            else:
                # Extrae el timestamp antiguo del nombre del fichero
                oldtimestamp = time.mktime(
                    time.strptime(cachedFile[-20:-6], "%Y%m%d%H%M%S"))

                logger.info("[scrapertools.py] oldtimestamp=" +
                            cachedFile[-20:-6])
                logger.info("[scrapertools.py] oldtimestamp=" +
                            time.ctime(oldtimestamp))

                # Hace la petición
                updated, data = downloadtools.downloadIfNotModifiedSince(
                    url, oldtimestamp)

                # Si ha cambiado
                if updated:
                    # Borra el viejo
                    logger.debug("[scrapertools.py] Borrando " + cachedFile)
                    os.remove(cachedFile)

                    # Graba en cache el nuevo
                    outfile = open(newFile, "w")
                    outfile.write(data)
                    outfile.flush()
                    outfile.close()
                    logger.info("[scrapertools.py] Grabado a " + newFile)
                # Devuelve el contenido del fichero de la cache
                else:
                    logger.info("[scrapertools.py] Leyendo de cache " +
                                cachedFile)
                    infile = open(cachedFile)
                    data = infile.read()
                    infile.close()

    return data
예제 #17
0
import sys
import requests
from bs4 import BeautifulSoup

from config import (
    OUTPUT_DIR,
    get_platform,
    ensure_dir,
    get_tstamp,
)

http_req = 'http://'
https_req = 'https://'
test_url = 'https://joshsisto.com'

platform = get_platform()
if platform == 'OS X' or 'Linux':
    slash = '/'
if platform == 'Windows':
    slash = '\\'


def url_checker(url):
    """Check if URL starts with http or https"""
    if url.startswith(http_req):
        url_name = url[7:]
        # print('URL check passed. Using http')
        return url_name
    if url.startswith(https_req):
        url_name = url[8:]
        # print('URL check passed. Using https')
예제 #18
0
def cachePage(url,post=None,headers=[['User-Agent', 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; es-ES; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12']],modoCache=CACHE_ACTIVA):

    logger.info("[scrapertools.py] cachePage url="+url)
    modoCache = config.get_setting("cache.mode")
    
    if config.get_platform()=="plex":
        from PMS import HTTP
        try:
            logger.info("url="+url)
            data = HTTP.Request(url)
            logger.info("descargada")
        except:
            data = ""
            logger.error("Error descargando "+url)
            import sys
            for line in sys.exc_info():
                logger.error( "%s" % line )
        
        return data

    else:
        # CACHE_NUNCA: Siempre va a la URL a descargar
        # obligatorio para peticiones POST
        if modoCache == CACHE_NUNCA or post is not None:
            logger.info("[scrapertools.py] MODO_CACHE=2 (no cachear)")
            
            data = downloadpage(url,post,headers)
        
        # CACHE_SIEMPRE: Siempre descarga de cache, sin comprobar fechas, excepto cuando no está
        elif modoCache == CACHE_SIEMPRE:
            logger.info("[scrapertools.py] MODO_CACHE=1 (cachear todo)")
            
            # Obtiene los handlers del fichero en la cache
            cachedFile, newFile = getCacheFileNames(url)
        
            # Si no hay ninguno, descarga
            if cachedFile == "":
                logger.debug("[scrapertools.py] No está en cache")
        
                # Lo descarga
                data = downloadpage(url,post,headers)
        
                # Lo graba en cache
                outfile = open(newFile,"w")
                outfile.write(data)
                outfile.flush()
                outfile.close()
                logger.info("[scrapertools.py] Grabado a " + newFile)
            else:
                logger.info("[scrapertools.py] Leyendo de cache " + cachedFile)
                infile = open( cachedFile )
                data = infile.read()
                infile.close()
        
        # CACHE_ACTIVA: Descarga de la cache si no ha cambiado
        else:
            logger.info("[scrapertools.py] MODO_CACHE=0 (automática)")
            
            # Datos descargados
            data = ""
            
            # Obtiene los handlers del fichero en la cache
            cachedFile, newFile = getCacheFileNames(url)
        
            # Si no hay ninguno, descarga
            if cachedFile == "":
                logger.debug("[scrapertools.py] No está en cache")
        
                # Lo descarga
                data = downloadpage(url,post,headers)
                
                # Lo graba en cache
                outfile = open(newFile,"w")
                outfile.write(data)
                outfile.flush()
                outfile.close()
                logger.info("[scrapertools.py] Grabado a " + newFile)
        
            # Si sólo hay uno comprueba el timestamp (hace una petición if-modified-since)
            else:
                # Extrae el timestamp antiguo del nombre del fichero
                oldtimestamp = time.mktime( time.strptime(cachedFile[-20:-6], "%Y%m%d%H%M%S") )
        
                logger.info("[scrapertools.py] oldtimestamp="+cachedFile[-20:-6])
                logger.info("[scrapertools.py] oldtimestamp="+time.ctime(oldtimestamp))
                
                # Hace la petición
                updated,data = downloadtools.downloadIfNotModifiedSince(url,oldtimestamp)
                
                # Si ha cambiado
                if updated:
                    # Borra el viejo
                    logger.debug("[scrapertools.py] Borrando "+cachedFile)
                    os.remove(cachedFile)
                    
                    # Graba en cache el nuevo
                    outfile = open(newFile,"w")
                    outfile.write(data)
                    outfile.flush()
                    outfile.close()
                    logger.info("[scrapertools.py] Grabado a " + newFile)
                # Devuelve el contenido del fichero de la cache
                else:
                    logger.info("[scrapertools.py] Leyendo de cache " + cachedFile)
                    infile = open( cachedFile )
                    data = infile.read()
                    infile.close()

    return data
예제 #19
0
# along with streamondemand 5.  If not, see <http://www.gnu.org/licenses/>.
#------------------------------------------------------------
# Client for api.tvalacarta.info
#------------------------------------------------------------

import urllib

import config
import jsontools
import logger
import scrapertools

MAIN_URL = "http://api.tvalacarta.info/v2"
API_KEY = "nzgJy84P9w54H2w"
DEFAULT_HEADERS = [[
    "User-Agent", config.PLUGIN_NAME + " " + config.get_platform()
]]

# ---------------------------------------------------------------------------------------------------------
#  Common function for API calls
# ---------------------------------------------------------------------------------------------------------


# Make a remote call using post, ensuring api key is here
def remote_call(url, parameters={}, require_session=True):
    logger.info("url=" + url + ", parameters=" + repr(parameters))

    if not url.startswith("http"):
        url = MAIN_URL + "/" + url

    if not "api_key" in parameters:
예제 #20
0
#------------------------------------------------------------

import os
import sys
import urlparse
import jsontools
import config
import logger
import scrapertools

import urllib
from item import Item

MAIN_URL = "http://api.tvalacarta.info/v2"
API_KEY = "nzgJy84P9w54H2w"
DEFAULT_HEADERS = [ ["User-Agent",config.PLUGIN_NAME+" "+config.get_platform()] ]

# ---------------------------------------------------------------------------------------------------------
#  Common function for API calls
# ---------------------------------------------------------------------------------------------------------

# Make a remote call using post, ensuring api key is here
def remote_call(url,parameters={},require_session=True):
    logger.info("streamondemand.core.api.remote_call url="+url+", parameters="+repr(parameters))

    if not url.startswith("http"):
        url = MAIN_URL + "/" + url

    if not "api_key" in parameters:
        parameters["api_key"] = API_KEY
예제 #21
0
import config
import logger
import scrapertools

ROOT_DIR = config.get_runtime_path()

REMOTE_VERSION_FILE = "http://descargas.tvalacarta.info/"+config.PLUGIN_NAME+"-version.xml"
LOCAL_VERSION_FILE = os.path.join( ROOT_DIR , "version.xml" )
LOCAL_FILE = os.path.join( ROOT_DIR , config.PLUGIN_NAME+"-" )

#DESTINATION_FOLDER sera siempre el lugar donde este la carpeta del plugin,
#No hace falta "xbmc.translatePath", get_runtime_path() ya tiene que devolver la ruta correcta
DESTINATION_FOLDER = os.path.join(config.get_runtime_path(),"..")

#Todas las plataformas son "pelisalacarta-nombre-plataforma-version.zip" excepto para xbmc que es "pelisalacarta-xbmc-plugin-version.zip"
if config.get_platform()=="xbmc":
  REMOTE_FILE = "http://descargas.tvalacarta.info/%s-%s-" % (config.PLUGIN_NAME, "xbmc-plugin")

else:
  REMOTE_FILE = "http://descargas.tvalacarta.info/%s-%s-" % (config.PLUGIN_NAME, config.get_platform())
  


def checkforupdates():
    logger.info("pelisalacarta.core.updater checkforupdates")

    # Descarga el fichero con la versión en la web
    logger.info("pelisalacarta.core.updater Verificando actualizaciones...")
    logger.info("pelisalacarta.core.updater Version remota: "+REMOTE_VERSION_FILE)
    data = scrapertools.cachePage( REMOTE_VERSION_FILE )
예제 #22
0

## Full path of the remote file version.
REMOTE_VERSION_FILE = "https://raw.githubusercontent.com/orione7/plugin.video.streamondemand-pureita/master/version.xml"

## Full path of the local file version.
LOCAL_VERSION_FILE = os.path.join( ROOT_DIR , "version.xml" )

## Full path to the local .zip file. It includes the beginning of the file name.
## Later, the version that you correspoda, name of the platform and the extension .zip is added.
LOCAL_FILE = os.path.join( ROOT_DIR , "plugin.video."+config.PLUGIN_NAME+"-master" )

try:
    # Añadida a la opcion : si plataforma xbmcdharma es "True", no debe ser con la plataforma de la xbox
    # porque seria un falso "True", ya que el xbmc en las xbox no son dharma por lo tanto no existen los addons
    logger.info("streamondemand-pureita.core.updater get_platform="+config.get_platform())
    logger.info("streamondemand-pureita.core.updater get_system_platform="+config.get_system_platform())
    if config.get_platform()=="kodi-isengard":
        import xbmc
        REMOTE_FILE = "https://raw.githubusercontent.com/orione7/plugin.video.streamondemand-pureita/master/"
        DESTINATION_FOLDER = xbmc.translatePath( "special://home/addons")
    elif config.get_platform()=="kodi-helix":
        import xbmc
        REMOTE_FILE = "https://raw.githubusercontent.com/orione7/plugin.video.streamondemand-pureita/master/"
        DESTINATION_FOLDER = xbmc.translatePath( "special://home/addons")
    elif config.get_platform()=="xbmceden":
        import xbmc
        REMOTE_FILE = "https://raw.githubusercontent.com/orione7/plugin.video.streamondemand-pureita/master/"
        DESTINATION_FOLDER = xbmc.translatePath( "special://home/addons")
    elif config.get_platform()=="xbmcfrodo":
        import xbmc
from distutils.version import StrictVersion


PLUGIN_NAME = "pelisalacarta-3-9X"
ROOT_DIR = config.get_runtime_path()
REMOTE_VERSION_FILE = "http://blog.tvalacarta.info/descargas/" + PLUGIN_NAME + "-version.xml"
LOCAL_VERSION_FILE = os.path.join(ROOT_DIR, "version.xml")
URL_BASE_REPOSITORIO = "http://xbmc-tvalacarta.googlecode.com/svn/trunk/" + PLUGIN_NAME
LOCAL_FILE = os.path.join(ROOT_DIR, PLUGIN_NAME + "-")
DIRECTORIO_PATH_CONFIG = os.path.join(config.get_data_path(), "channels")
PATH_LIST_CHANNELS_JSON = os.path.join(config.get_data_path(), "list_channels.json")
PATH_LIST_SERVERS_JSON = os.path.join(config.get_data_path(), "list_servers.json")


try:
    logger.info("[updater.py] get_platform=" + config.get_platform())
    logger.info("[updater.py] get_system_platform=" + config.get_system_platform())

    REMOTE_FILE = "http://blog.tvalacarta.info/descargas/" + PLUGIN_NAME
    if config.get_platform() == "xbmcdharma" and config.get_system_platform() == "xbox":
        # Añadida a la opcion : si plataforma xbmcdharma es "True", no debe ser con la plataforma de la xbox
        # porque seria un falso "True", ya que el xbmc en las xbox no son dharma por lo tanto no existen los addons
        REMOTE_FILE = ""
    elif config.get_platform() == "xbmc":
        REMOTE_FILE += "-xbmc-plugin-"
        import xbmc

        DESTINATION_FOLDER = xbmc.translatePath("special://home/plugins/video")
    elif config.get_platform().startswith("xbmc"):
        REMOTE_FILE += config.get_platform().replace("xbmc", "-xbmc-addon-") + "-"
        import xbmc
from distutils.version import StrictVersion

PLUGIN_NAME = "pelisalacarta"
ROOT_DIR = config.get_runtime_path()
REMOTE_VERSION_FILE = "http://blog.tvalacarta.info/descargas/" + PLUGIN_NAME + "-version.xml"
LOCAL_VERSION_FILE = os.path.join(ROOT_DIR, "version.xml")
URL_BASE_REPOSITORIO = "http://xbmc-tvalacarta.googlecode.com/svn/trunk/" + PLUGIN_NAME
LOCAL_FILE = os.path.join(ROOT_DIR, PLUGIN_NAME + "-")
DIRECTORIO_PATH_CONFIG = os.path.join(config.get_data_path(), 'channels')
PATH_LIST_CHANNELS_JSON = os.path.join(config.get_data_path(),
                                       "list_channels.json")
PATH_LIST_SERVERS_JSON = os.path.join(config.get_data_path(),
                                      "list_servers.json")

try:
    logger.info("[updater.py] get_platform=" + config.get_platform())
    logger.info("[updater.py] get_system_platform=" +
                config.get_system_platform())

    REMOTE_FILE = "http://blog.tvalacarta.info/descargas/" + PLUGIN_NAME
    if config.get_platform() == "xbmcdharma" and config.get_system_platform(
    ) == "xbox":
        # Añadida a la opcion : si plataforma xbmcdharma es "True", no debe ser con la plataforma de la xbox
        # porque seria un falso "True", ya que el xbmc en las xbox no son dharma por lo tanto no existen los addons
        REMOTE_FILE = ""
    elif config.get_platform() == "xbmc":
        REMOTE_FILE += "-xbmc-plugin-"
        import xbmc
        DESTINATION_FOLDER = xbmc.translatePath("special://home/plugins/video")
    elif config.get_platform().startswith("xbmc"):
        REMOTE_FILE += config.get_platform().replace("xbmc",
예제 #25
0
def plugins_get_latest_packages():
    logger.info("streamondemand.core.api.plugins.get_latest_packages")

    parameters = { "plugin" : config.PLUGIN_NAME , "platform" : config.get_platform() }
    return remote_call( "plugins/get_latest_packages.php" , parameters )
예제 #26
0
def plugins_get_all_packages():
    logger.info("pelisalacarta.core.api.plugins.get_all_packages")

    parameters = { "plugin" : config.PLUGIN_NAME , "platform" : config.get_platform() }
    return remote_call( "plugins/get_all_packages.php" , parameters )
예제 #27
0
elif thumbnail_type=="1":
    IMAGES_PATH = 'http://media.tvalacarta.info/pelisalacarta/banners/'
elif thumbnail_type=="2":
    IMAGES_PATH = 'http://media.tvalacarta.info/pelisalacarta/squares/'

ROOT_DIR = config.get_runtime_path()

REMOTE_VERSION_FILE = "http://descargas.tvalacarta.info/"+config.PLUGIN_NAME+"-version.xml"
LOCAL_VERSION_FILE = os.path.join( ROOT_DIR , "version.xml" )
LOCAL_FILE = os.path.join( ROOT_DIR , config.PLUGIN_NAME+"-" )

try:
    # Añadida a la opcion : si plataforma xbmcdharma es "True", no debe ser con la plataforma de la xbox
    # porque seria un falso "True", ya que el xbmc en las xbox no son dharma por lo tanto no existen los addons
    logger.info("pelisalacarta.core.updater get_platform="+config.PLATFORM_NAME)
    if config.get_platform()=="kodi-isengard":
        import xbmc
        REMOTE_FILE = "http://descargas.tvalacarta.info/"+config.PLUGIN_NAME+"-kodi-isengard-"
        DESTINATION_FOLDER = xbmc.translatePath( "special://home/addons")
    elif config.get_platform()=="kodi-helix":
        import xbmc
        REMOTE_FILE = "http://descargas.tvalacarta.info/"+config.PLUGIN_NAME+"-kodi-helix-"
        DESTINATION_FOLDER = xbmc.translatePath( "special://home/addons")
    elif config.get_platform()=="xbmceden":
        import xbmc
        REMOTE_FILE = "http://descargas.tvalacarta.info/"+config.PLUGIN_NAME+"-xbmc-eden-"
        DESTINATION_FOLDER = xbmc.translatePath( "special://home/addons")
    elif config.get_platform()=="xbmcfrodo":
        import xbmc
        REMOTE_FILE = "http://descargas.tvalacarta.info/"+config.PLUGIN_NAME+"-xbmc-frodo-"
        DESTINATION_FOLDER = xbmc.translatePath( "special://home/addons")
예제 #28
0
import config
import logger
import scrapertools

ROOT_DIR = config.get_runtime_path()

REMOTE_VERSION_FILE = "http://descargas.tvalacarta.info/"+config.PLUGIN_NAME+"-version.xml"
LOCAL_VERSION_FILE = os.path.join( ROOT_DIR , "version.xml" )
LOCAL_FILE = os.path.join( ROOT_DIR , config.PLUGIN_NAME+"-" )

#DESTINATION_FOLDER sera siempre el lugar donde este la carpeta del plugin,
#No hace falta "xbmc.translatePath", get_runtime_path() ya tiene que devolver la ruta correcta
DESTINATION_FOLDER = os.path.join(config.get_runtime_path(),"..")

#Todas las plataformas son "pelisalacarta-nombre-plataforma-version.zip" excepto para xbmc que es "pelisalacarta-xbmc-plugin-version.zip"
if config.get_platform()=="xbmc":
  REMOTE_FILE = "http://descargas.tvalacarta.info/%s-%s-" % (config.PLUGIN_NAME, "xbmc-plugin")

else:
  REMOTE_FILE = "http://descargas.tvalacarta.info/%s-%s-" % (config.PLUGIN_NAME, config.get_platform())
  


def checkforupdates():
    logger.info("pelisalacarta.core.updater checkforupdates")

    # Descarga el fichero con la versión en la web
    logger.info("pelisalacarta.core.updater Verificando actualizaciones...")
    logger.info("pelisalacarta.core.updater Version remota: "+REMOTE_VERSION_FILE)
    data = scrapertools.cachePage( REMOTE_VERSION_FILE )
예제 #29
0
def play_video(item, strm=False, force_direct=False):
    logger.info()
    # logger.debug(item.tostring('\n'))

    if item.channel == 'downloads':
        logger.info("Reproducir video local: %s [%s]" % (item.title, item.url))
        xlistitem = xbmcgui.ListItem(path=item.url)
        if config.get_platform(True)['num_version'] >= 16.0:
            xlistitem.setArt({"thumb": item.thumbnail})
        else:
            xlistitem.setThumbnailImage(item.thumbnail)

        set_infolabels(xlistitem, item, True)
        xbmc.Player().play(item.url, xlistitem)
        return

    default_action = config.get_setting("default_action")
    logger.info("default_action=%s" % default_action)

    # Abre el diálogo de selección para ver las opciones disponibles
    opciones, video_urls, seleccion, salir = get_dialogo_opciones(
        item, default_action, strm)
    if salir:
        return

    # se obtienen la opción predeterminada de la configuración del addon
    seleccion = get_seleccion(default_action, opciones, seleccion, video_urls)
    if seleccion < 0:  # Cuadro cancelado
        return

    logger.info("seleccion=%d" % seleccion)
    logger.info("seleccion=%s" % opciones[seleccion])

    # se ejecuta la opcion disponible, jdwonloader, descarga, favoritos, añadir a la videoteca... SI NO ES PLAY
    salir = set_opcion(item, seleccion, opciones, video_urls)
    if salir:
        return

    # obtenemos el video seleccionado
    mediaurl, view, mpd = get_video_seleccionado(item, seleccion, video_urls)
    if mediaurl == "":
        return

    # se obtiene la información del video.
    if not item.contentThumbnail:
        thumb = item.thumbnail
    else:
        thumb = item.contentThumbnail

    xlistitem = xbmcgui.ListItem(path=item.url)
    if config.get_platform(True)['num_version'] >= 16.0:
        xlistitem.setArt({"thumb": thumb})
    else:
        xlistitem.setThumbnailImage(thumb)

    set_infolabels(xlistitem, item, True)

    # si se trata de un vídeo en formato mpd, se configura el listitem para reproducirlo
    # con el addon inpustreamaddon implementado en Kodi 17
    if mpd:
        xlistitem.setProperty('inputstreamaddon', 'inputstream.adaptive')
        xlistitem.setProperty('inputstream.adaptive.manifest_type', 'mpd')

    # se lanza el reproductor
    if force_direct:  # cuando viene de una ventana y no directamente de la base del addon
        # Añadimos el listitem a una lista de reproducción (playlist)
        playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
        playlist.clear()
        playlist.add(mediaurl, xlistitem)

        # Reproduce
        xbmc_player = xbmc.Player()
        xbmc_player.play(playlist, xlistitem)
    else:
        set_player(item, xlistitem, mediaurl, view, strm)
예제 #30
0
    IMAGES_PATH = 'http://pelisalacarta.mimediacenter.info/posters/'
elif thumbnail_type=="1":
    IMAGES_PATH = 'http://pelisalacarta.mimediacenter.info/banners/'
elif thumbnail_type=="2":
    IMAGES_PATH = 'http://pelisalacarta.mimediacenter.info/squares/'

ROOT_DIR = config.get_runtime_path()

REMOTE_VERSION_FILE = "http://blog.tvalacarta.info/descargas/"+PLUGIN_NAME+"-version.xml"
LOCAL_VERSION_FILE = os.path.join( ROOT_DIR , "version.xml" )
LOCAL_FILE = os.path.join( ROOT_DIR , PLUGIN_NAME+"-" )

try:
    # Añadida a la opcion : si plataforma xbmcdharma es "True", no debe ser con la plataforma de la xbox
    # porque seria un falso "True", ya que el xbmc en las xbox no son dharma por lo tanto no existen los addons
    logger.info("[updater.py] get_platform="+config.get_platform())
    logger.info("[updater.py] get_system_platform="+config.get_system_platform())
    if config.get_platform()=="xbmcdharma" and not config.get_system_platform() == "xbox":
        import xbmc
        REMOTE_FILE = "http://blog.tvalacarta.info/descargas/"+PLUGIN_NAME+"-xbmc-addon-dharma-"
        DESTINATION_FOLDER = xbmc.translatePath( "special://home/addons")
    elif config.get_platform()=="xbmceden":
        import xbmc
        REMOTE_FILE = "http://blog.tvalacarta.info/descargas/"+PLUGIN_NAME+"-xbmc-addon-eden-"
        DESTINATION_FOLDER = xbmc.translatePath( "special://home/addons")
    elif config.get_platform()=="xbmc":
        import xbmc
        REMOTE_FILE = "http://blog.tvalacarta.info/descargas/"+PLUGIN_NAME+"-xbmc-plugin-"
        DESTINATION_FOLDER = xbmc.translatePath( "special://home/plugins/video")
    elif config.get_platform()=="wiimc":
        REMOTE_FILE = "http://blog.tvalacarta.info/descargas/"+PLUGIN_NAME+"-wiimc-"
예제 #31
0
elif thumbnail_type == "1":
    IMAGES_PATH = 'http://media.tvalacarta.info/pelisalacarta/banners/'
elif thumbnail_type == "2":
    IMAGES_PATH = 'http://media.tvalacarta.info/pelisalacarta/squares/'

ROOT_DIR = config.get_runtime_path()

REMOTE_VERSION_FILE = "https://raw.githubusercontent.com/streamondemand/plugin.video.streamondemand/master/version.xml"
LOCAL_VERSION_FILE = os.path.join(ROOT_DIR, "version.xml")
LOCAL_FILE = os.path.join(ROOT_DIR, config.PLUGIN_NAME + "-")

try:
    # Añadida a la opcion : si plataforma xbmcdharma es "True", no debe ser con la plataforma de la xbox
    # porque seria un falso "True", ya que el xbmc en las xbox no son dharma por lo tanto no existen los addons
    logger.info("streamondemand.core.updater get_platform=" +
                config.get_platform())
    logger.info("streamondemand.core.updater get_system_platform=" +
                config.get_system_platform())
    if config.get_platform() == "kodi-jarvis":
        import xbmc
        REMOTE_FILE = "https://github.com/streamondemand/plugin.video.streamondemand/archive/master.zip"
        DESTINATION_FOLDER = xbmc.translatePath("special://home/addons")
    elif config.get_platform() == "kodi-isengard":
        import xbmc
        REMOTE_FILE = "https://github.com/streamondemand/plugin.video.streamondemand/archive/master.zip"
        DESTINATION_FOLDER = xbmc.translatePath("special://home/addons")
    elif config.get_platform() == "kodi-helix":
        import xbmc
        REMOTE_FILE = "https://github.com/streamondemand/plugin.video.streamondemand/archive/master.zip"
        DESTINATION_FOLDER = xbmc.translatePath("special://home/addons")
    elif config.get_platform() == "xbmc-eden":
예제 #32
0
    IMAGES_PATH = 'http://media.tvalacarta.info/pelisalacarta/posters/'
elif thumbnail_type=="1":
    IMAGES_PATH = 'http://media.tvalacarta.info/pelisalacarta/banners/'
elif thumbnail_type=="2":
    IMAGES_PATH = 'http://media.tvalacarta.info/pelisalacarta/squares/'

ROOT_DIR = config.get_runtime_path()

REMOTE_VERSION_FILE = "http://descargas.tvalacarta.info/"+config.PLUGIN_NAME+"-version.xml"
LOCAL_VERSION_FILE = os.path.join( ROOT_DIR , "version.xml" )
LOCAL_FILE = os.path.join( ROOT_DIR , config.PLUGIN_NAME+"-" )

try:
    # Añadida a la opcion : si plataforma xbmcdharma es "True", no debe ser con la plataforma de la xbox
    # porque seria un falso "True", ya que el xbmc en las xbox no son dharma por lo tanto no existen los addons
    logger.info("pelisalacarta.core.updater get_platform="+config.get_platform())
    logger.info("pelisalacarta.core.updater get_system_platform="+config.get_system_platform())
    if config.get_platform()=="kodi-jarvis":
        import xbmc
        REMOTE_FILE = "http://descargas.tvalacarta.info/"+config.PLUGIN_NAME+"-kodi-jarvis-"
        DESTINATION_FOLDER = xbmc.translatePath( "special://home/addons")
    elif config.get_platform()=="kodi-isengard":
        import xbmc
        REMOTE_FILE = "http://descargas.tvalacarta.info/"+config.PLUGIN_NAME+"-kodi-isengard-"
        DESTINATION_FOLDER = xbmc.translatePath( "special://home/addons")
    elif config.get_platform()=="kodi-helix":
        import xbmc
        REMOTE_FILE = "http://descargas.tvalacarta.info/"+config.PLUGIN_NAME+"-kodi-helix-"
        DESTINATION_FOLDER = xbmc.translatePath( "special://home/addons")
    elif config.get_platform()=="xbmc-eden":
        import xbmc