Esempio n. 1
0
 def extract_item(self,path):
     if path:
       item = Item()
       item.fromurl(path)
     else:
       item = Item(channel="channelselector", action="mainlist")
     return item
Esempio n. 2
0
def load_results(item):

    cache_node = jsontools.get_node_from_file('menu_cache_data.json', 'cached')
    itemlist = list()

    for cached_item in cache_node[item.news]:
        new_item = Item()
        new_item = new_item.fromurl(cached_item)
        itemlist.append(new_item)
    itemlist = group_results(itemlist)

    return itemlist
Esempio n. 3
0
def ver_canales(item):
    logger.info("pelisalacarta.channels.novedades ver_canales")
    itemlist = []
    for i in item.sub_list:
        newItem = Item()
        newItem = newItem.fromurl(i)
        logger.debug(newItem.tostring())
        if 'contentCalidad' in newItem:  newItem.title += ' (%s)' % newItem.contentCalidad
        if newItem.language: newItem.title += ' [%s]' % newItem.language
        newItem.title += ' (%s)' % newItem.channel
        itemlist.append(newItem.clone())

    return itemlist
Esempio n. 4
0
def get_input(query, dkitem):
    Log.Info(query)
    if type(dkitem) == str:
        caller_item_serialized = dkitem
        dkitem = Item()
        dkitem.fromurl(caller_item_serialized)
    Log.Info("#########################################################")
    Log.Info(dkitem.tostring())
    
    if '.' in dkitem.channel:
        pack,modulo = dkitem.channel.split('.') #ejemplo: platformcode.platformtools
        channelmodule = channeltools.get_channel_module(modulo,pack)
    else:
        channelmodule = channeltools.get_channel_module(dkitem.channel)
    itemlist = getattr(channelmodule, dkitem.action)(dkitem, query)
    
    return canal(channel_name = dkitem.channel, action= "", itemlist = itemlist )

    
#return MessageContainer("Empty", "There aren't any speakers whose name starts with " + char)
#return ObjectContainer(header="Empty", message="There aren't any items")
#oc.add(SearchDirectoryObject(identifier='com.plexapp.plugins.amt', title='Search Trailers', prompt='Search for movie trailer', term=L('Trailers')))
Esempio n. 5
0
def ver_canales(item):
    logger.info("streamondemand.channels.novedades ver_canales")
    itemlist = []
    for i in item.sub_list:
        newItem = Item()
        newItem = newItem.fromurl(i)
        logger.debug(newItem.tostring())
        if 'contentCalidad' in newItem:  newItem.title += ' (%s)' % newItem.contentCalidad
        if newItem.language: newItem.title += ' [%s]' % newItem.language
        newItem.title += ' (%s)' % newItem.channel
        itemlist.append(newItem.clone())

    return itemlist
Esempio n. 6
0
def get_input(query, dkitem):
    Log.Info(query)
    if type(dkitem) == str:
        caller_item_serialized = dkitem
        dkitem = Item()
        dkitem.fromurl(caller_item_serialized)
    Log.Info("#########################################################")
    Log.Info(dkitem.tostring())

    if '.' in dkitem.channel:
        pack, modulo = dkitem.channel.split(
            '.')  #ejemplo: platformcode.platformtools
        channelmodule = channeltools.get_channel_module(modulo, pack)
    else:
        channelmodule = channeltools.get_channel_module(dkitem.channel)
    itemlist = getattr(channelmodule, dkitem.action)(dkitem, query)

    return canal(channel_name=dkitem.channel, action="", itemlist=itemlist)


#return MessageContainer("Empty", "There aren't any speakers whose name starts with " + char)
#return ObjectContainer(header="Empty", message="There aren't any items")
#oc.add(SearchDirectoryObject(identifier='com.plexapp.plugins.amt', title='Search Trailers', prompt='Search for movie trailer', term=L('Trailers')))
Esempio n. 7
0
def ver_canales(item):
    logger.info()
    channels_ID_name = item.extra
    itemlist = []

    for i in item.sub_list:
        newItem = Item()
        newItem = newItem.fromurl(i)
        #logger.debug(newItem.tostring())
        if newItem.contentQuality:  newItem.title += ' (%s)' % newItem.contentQuality
        if newItem.language: newItem.title += ' [%s]' % newItem.language
        newItem.title += ' (%s)' % channels_ID_name[newItem.channel]
        newItem.text_color = color1

        itemlist.append(newItem.clone())

    return itemlist
Esempio n. 8
0
def ver_canales(item):
    logger.info()
    channels_ID_name = item.extra
    itemlist = []

    for i in item.sub_list:
        newItem = Item()
        newItem = newItem.fromurl(i)
        # logger.debug(newItem.tostring())
        if newItem.contentQuality:  newItem.title += ' (%s)' % newItem.contentQuality
        if newItem.language: newItem.title += ' [%s]' % newItem.language
        newItem.title += ' (%s)' % channels_ID_name[newItem.channel]
        newItem.text_color = color1

        itemlist.append(newItem.clone())

    return itemlist
Esempio n. 9
0
def show_channels(item):
    logger.info()
    global channels_id_name
    channels_id_name = item.extra
    itemlist = []

    for i in item.sub_list:
        new_item = Item()
        new_item = new_item.fromurl(i)
        # logger.debug(new_item.tostring())
        ##        if new_item.contentQuality:
        ##            new_item.title += ' (%s)' % new_item.contentQuality
        ##        if new_item.language:
        ##            new_item.title += ' [%s]' % new_item.language
        ##        new_item.title += ' (%s)' % channels_id_name[new_item.channel]
        new_item.text_color = color1

        itemlist.append(new_item.clone())

    return itemlist
Esempio n. 10
0
def get_from_cache(item):
    logger.info()
    itemlist = []
    cache_node = jsontools.get_node_from_file('menu_cache_data.json', 'cached')
    first = item.last
    last = first + 40
    #if last >=len(cache_node[item.extra]):
    #    last = len(cache_node[item.extra])

    for cached_item in cache_node[item.extra][first:last]:
        new_item = Item()
        new_item = new_item.fromurl(cached_item)
        itemlist.append(new_item)
    if item.mode == 'silent':
        set_cache(item)
    if last >= len(cache_node[item.extra]):
        item.mode = 'finish'
        itemlist = add_menu_items(item, itemlist)
    else:
        item.mode = 'get_cached'
        item.last = last
        itemlist = add_menu_items(item, itemlist)

    return itemlist
Esempio n. 11
0
def canal(channel_name="",
          action="",
          caller_item_serialized=None,
          itemlist=""):
    oc = ObjectContainer(view_group="List")

    try:
        if caller_item_serialized is None:
            Log.Info("caller_item_serialized=None")
            caller_item = Item()
        else:
            Log.Info("caller_item_serialized=" + caller_item_serialized)
            caller_item = Item()
            caller_item.fromurl(caller_item_serialized)
        Log.Info("caller_item=" + str(caller_item))

        Log.Info("Importando...")
        channelmodule = servertools.get_channel_module(channel_name)
        Log.Info("Importado")

        Log.Info("Antes de hasattr")
        if hasattr(channelmodule, action):
            Log.Info("El módulo " + caller_item.channel +
                     " tiene una funcion " + action)

            itemlist = getattr(channelmodule, action)(caller_item)

            if action == "play" and len(itemlist) > 0 and isinstance(
                    itemlist[0], Item):
                itemlist = play_video(itemlist[0])
            if action == "play" and len(itemlist) > 0 and isinstance(
                    itemlist[0], list):
                item.video_urls = itemlist
                itemlist = play_video(item)

        else:
            Log.Info("El módulo " + caller_item.channel +
                     " *NO* tiene una funcion " + action)

            if action == "findvideos":
                Log.Info("Llamando a la funcion findvideos comun")
                itemlist = findvideos(caller_item)
            elif action == "play":
                itemlist = play_video(caller_item)
            elif action == "menu_principal":
                return mainlist()

        Log.Info("Tengo un itemlist con %d elementos" % len(itemlist))

        for item in itemlist:
            if item.action == "search" and item.thumbnail == "":
                item.thumbnail = "http://media.tvalacarta.info/pelisalacarta/squares/thumb_buscar.png"

            try:
                Log.Info("item=" +
                         unicode(item.tostring(), "utf-8", errors="replace"))
            except:
                pass

            if action != "play":
                #if "type" in item and item.type == "input":
                if item.action == "control_text_click" or item.action == "search":
                    Log.Info("Canal: item tipo input")
                    if 'value' in item:
                        value = item.value
                    else:
                        value = ""

                    if Client.Product in DumbKeyboard.clients:
                        DumbKeyboard("/video/pelisalacarta",
                                     oc,
                                     get_input,
                                     dktitle=unicode(item.title,
                                                     "utf-8",
                                                     errors="replace"),
                                     dkitem=item,
                                     dkplaceholder=value,
                                     dkthumb=item.thumbnail)
                    else:
                        dkitem = item.tourl()
                        oc.add(
                            InputDirectoryObject(key=Callback(get_input,
                                                              dkitem=dkitem),
                                                 title=unicode(
                                                     item.title,
                                                     "utf-8",
                                                     errors="replace"),
                                                 prompt=value,
                                                 thumb=item.thumbnail))
                else:
                    oc.add(
                        DirectoryObject(key=Callback(
                            canal,
                            channel_name=item.channel,
                            action=item.action,
                            caller_item_serialized=item.tourl()),
                                        title=unicode(item.title,
                                                      "utf-8",
                                                      errors="replace"),
                                        thumb=item.thumbnail))
            else:
                Log.Info("Llamando a la funcion play comun")
                videoClipObject = VideoClipObject(
                    title=unicode(item.title, "utf-8", errors="replace"),
                    thumb=item.thumbnail,
                    url="pelisalacarta://" + item.url)
                oc.add(videoClipObject)

    except:
        Log.Info("Excepcion al ejecutar " + channel_name + "." + action)
        import traceback
        Log.Info("Detalles: " + traceback.format_exc())

    return oc
Esempio n. 12
0
def canal(channel_name="", action="", caller_item_serialized=None):
    Log.Info("Entrando en canal para ejectuar " + channel_name + "." + action)
    oc = ObjectContainer(view_group="List")

    try:
        if caller_item_serialized is None:
            Log.Info("caller_item_serialized=None")
            caller_item = Item()
        else:
            Log.Info("caller_item_serialized=" + caller_item_serialized)
            caller_item = Item()
            caller_item.fromurl(caller_item_serialized)
        Log.Info("caller_item=" + str(caller_item))

        Log.Info("Importando...")
        from servers import servertools
        channelmodule = servertools.get_channel_module(channel_name)
        Log.Info("Importado")

        Log.Info("Antes de hasattr")
        if hasattr(channelmodule, action):
            Log.Info("El módulo " + channel_name + " tiene una funcion " +
                     action)
            itemlist = getattr(channelmodule, action)(caller_item)

            if action == "play" and len(itemlist) > 0:
                itemlist = play_video(itemlist[0])

        else:
            Log.Info("El módulo " + channel_name + " *NO* tiene una funcion " +
                     action)

            if action == "findvideos":
                Log.Info("Llamando a la funcion findvideos comun")
                itemlist = findvideos(caller_item)
            elif action == "play":
                itemlist = play_video(caller_item)

        Log.Info("Tengo un itemlist con %d elementos" % len(itemlist))

        for item in itemlist:
            try:
                Log.Info("item=" +
                         unicode(item.tostring(), "utf-8", errors="replace"))
            except:
                pass
            try:
                item.title = unicode(item.title, "utf-8", errors="replace")
            except:
                pass

            if action != "play":
                oc.add(
                    DirectoryObject(key=Callback(
                        canal,
                        channel_name=channel_name,
                        action=item.action,
                        caller_item_serialized=item.tourl()),
                                    title=item.title,
                                    thumb=item.thumbnail))

            else:
                Log.Info("Llamando a la funcion play comun")
                '''
                partObject = PartObject( key = Callback(resuelve, url=item.url) )
                Log.Info("partObject="+str(partObject))
                
                mediaObject = MediaObject( parts = [ partObject ] , container = 'mp4', video_codec = VideoCodec.H264, audio_codec = AudioCodec.AAC )
                Log.Info("mediaObject="+str(mediaObject))

                videoClipObject = VideoClipObject(title=item.title,thumb=item.thumbnail, url=item.url, key=item.url, rating_key=item.url, items = [ mediaObject ] )
                Log.Info("videoClipObject="+str(mediaObject))
                '''

                videoClipObject = VideoClipObject(title=item.title,
                                                  thumb=item.thumbnail,
                                                  url="pelisalacarta://" +
                                                  item.url)

                oc.add(videoClipObject)

    except:
        Log.Info("Excepcion al ejecutar " + channel_name + "." + action)
        import traceback
        Log.Info("Detalles: " + traceback.format_exc())

    return oc
Esempio n. 13
0
def canal(channel_name="",action="",caller_item_serialized=None, itemlist=""):
    oc = ObjectContainer(view_group="List")

    try:
        if caller_item_serialized is None:
            Log.Info("caller_item_serialized=None")
            caller_item = Item()
        else:
            Log.Info("caller_item_serialized="+caller_item_serialized)
            caller_item = Item()
            caller_item.fromurl(caller_item_serialized)
        Log.Info("caller_item="+str(caller_item))

        Log.Info("Importando...")
        channelmodule = servertools.get_channel_module(channel_name)
        Log.Info("Importado")

        Log.Info("Antes de hasattr")
        if hasattr(channelmodule, action):
            Log.Info("El módulo "+caller_item.channel+" tiene una funcion "+action)
            
            itemlist = getattr(channelmodule, action)(caller_item)

            if action=="play" and len(itemlist)>0:
                itemlist=play_video(itemlist[0])

        else:
            Log.Info("El módulo "+caller_item.channel+" *NO* tiene una funcion "+action)

            if action=="findvideos":
                Log.Info("Llamando a la funcion findvideos comun")
                itemlist=findvideos(caller_item)
            elif action=="play":
                itemlist=play_video(caller_item)
            elif action=="menu_principal":
                return mainlist()
             
        Log.Info("Tengo un itemlist con %d elementos" % len(itemlist))

        for item in itemlist:
            if item.action == "search"  and item.thumbnail == "":
              item.thumbnail = "http://media.tvalacarta.info/pelisalacarta/squares/thumb_buscar.png"
             
            try:
                Log.Info("item="+unicode( item.tostring(), "utf-8" , errors="replace" ))
            except:
                pass
            try:
                item.title = unicode( item.title, "utf-8" , errors="replace" )
            except:
                pass
            
            if action!="play":
                #if "type" in item and item.type == "input":
                if item.action == "control_text_click" or item.action == "search":
                    Log.Info("Canal: item tipo input")
                    if 'value' in item:
                        value = item.value
                    else:
                        value = ""
                        
                    if Client.Product in DumbKeyboard.clients:
                        DumbKeyboard("/video/pelisalacarta", oc, get_input,
                                dktitle = item.title,
                                dkitem = item,
                                dkplaceholder = value,
                                dkthumb = item.thumbnail
                            )
                    else:
                        dkitem = item.tourl()
                        oc.add(InputDirectoryObject(
                                key    = Callback(get_input, dkitem = dkitem),
                                title  = item.title,
                                prompt = value,
                                thumb = item.thumbnail
                            ))
                else:
                    oc.add(DirectoryObject(key=Callback(canal, channel_name=channel_name, action=item.action, caller_item_serialized=item.tourl()), title=item.title, thumb=item.thumbnail))
            else:
                Log.Info("Llamando a la funcion play comun")
                videoClipObject = VideoClipObject(title=item.title,thumb=item.thumbnail, url="pelisalacarta://"+item.url )
                oc.add(videoClipObject)

    except:
        Log.Info("Excepcion al ejecutar "+channel_name+"."+action)
        import traceback
        Log.Info("Detalles: "+traceback.format_exc())

    return oc
Esempio n. 14
0
def canal(channel_name="",action="",caller_item_serialized=None):
    Log.Info("Entrando en canal para ejectuar "+channel_name+"."+action)
    oc = ObjectContainer(view_group="List")

    try:
        if caller_item_serialized is None:
            Log.Info("caller_item_serialized=None")
            caller_item = Item()
        else:
            Log.Info("caller_item_serialized="+caller_item_serialized)
            caller_item = Item()
            caller_item.fromurl(caller_item_serialized)
        
        Log.Info("caller_item="+str(caller_item))

        Log.Info("Importando...")
        from servers import servertools
        channelmodule = servertools.get_channel_module(channel_name)
        Log.Info("Importado")

        Log.Info("Antes de hasattr")
        if hasattr(channelmodule, action):
            Log.Info("El módulo "+channel_name+" tiene una funcion "+action)
            itemlist = getattr(channelmodule, action)(caller_item)

            if action=="play" and len(itemlist)>0:
                itemlist=play_video(itemlist[0])

        else:
            Log.Info("El módulo "+channel_name+" *NO* tiene una funcion "+action)

            if action=="findvideos":
                Log.Info("Llamando a la funcion findvideos comun")
                itemlist=findvideos(caller_item)
            elif action=="play":
                itemlist=play_video(caller_item)

        Log.Info("Tengo un itemlist con %d elementos" % len(itemlist))

        for item in itemlist:
            try:
                Log.Info("item="+unicode( item.tostring(), "utf-8" , errors="replace" ))
            except:
                pass
            try:
                item.title = unicode( item.title, "utf-8" , errors="replace" )
            except:
                pass
            
            if action!="play":
                cb = Callback(canal, channel_name=channel_name, action=item.action, caller_item_serialized=item.tourl())
                do = DirectoryObject(key=cb, title=item.title, thumb=item.thumbnail)
                oc.add(do)

            else:
                Log.Info("Llamando a la funcion play comun")

                '''
                partObject = PartObject( key = Callback(resuelve, url=item.url) )
                Log.Info("partObject="+str(partObject))
                
                mediaObject = MediaObject( parts = [ partObject ] , container = 'mp4', video_codec = VideoCodec.H264, audio_codec = AudioCodec.AAC )
                Log.Info("mediaObject="+str(mediaObject))

                videoClipObject = VideoClipObject(title=item.title,thumb=item.thumbnail, url=item.url, key=item.url, rating_key=item.url, items = [ mediaObject ] )
                Log.Info("videoClipObject="+str(mediaObject))
                '''

                videoClipObject = VideoClipObject(title=item.title,thumb=item.thumbnail, url="tvalacarta://"+item.url )

                oc.add(videoClipObject)

    except:
        Log.Info("Excepcion al ejecutar "+channel_name+"."+action)
        import traceback
        Log.Info("Detalles: "+traceback.format_exc())

    return oc