Python xbmcplugin 模块,SORT_METHOD_NONE 实例源码

我们从Python开源项目中,提取了以下20个代码示例,用于说明如何使用xbmcplugin.SORT_METHOD_NONE

项目:tvalacarta    作者:tvalacarta    | 项目源码 | 文件源码
def channeltypes(params,url,category):
    logger.info("channelselector.channeltypes")

    lista = getchanneltypes()
    for item in lista:
        addfolder(item.title,item.channel,item.action,category=item.category,thumbnailname=item.thumbnail)

    if config.get_platform()=="kodi-krypton":
        import plugintools
        plugintools.set_view( plugintools.TV_SHOWS )

    # Label (top-right)...
    import xbmcplugin
    xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category="" )
    xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE )
    xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )

    if config.get_setting("forceview")=="true":
        # Confluence - Thumbnail
        import xbmc
        xbmc.executebuiltin("Container.SetViewMode(500)")
项目:tvalacarta    作者:tvalacarta    | 项目源码 | 文件源码
def listchannels(params,url,category):
    logger.info("channelselector.listchannels")

    lista = filterchannels(category)
    for channel in lista:
        if config.is_xbmc() and (channel.type=="xbmc" or channel.type=="generic"):
            addfolder(channel.title , channel.channel , "mainlist" , channel.channel)

        elif config.get_platform()=="boxee" and channel.extra!="rtmp":
            addfolder(channel.title , channel.channel , "mainlist" , channel.channel)

    if config.get_platform()=="kodi-krypton":
        import plugintools
        plugintools.set_view( plugintools.TV_SHOWS )

    # Label (top-right)...
    import xbmcplugin
    xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category=category )
    xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE )
    xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )

    if config.get_setting("forceview")=="true":
        # Confluence - Thumbnail
        import xbmc
        xbmc.executebuiltin("Container.SetViewMode(500)")
项目:plugin.video.streamondemand-pureita    作者:orione7    | 项目源码 | 文件源码
def channeltypes(params,url,category):
    logger.info("channelselector.mainlist channeltypes")
    categoria=category.decode('latin1').encode('utf-8')
    if config.get_localized_string(30119) in categoria:
        lista = getchanneltypes()
        for item in lista:
            addfolder(item.title,item.channel,item.action,item.category,item.thumbnail,item.thumbnail)

        # Label (top-right)...
        import xbmcplugin
        xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category="" )
        xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE )
        xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )

        if config.get_setting("forceview")=="true":
            # Confluence - Thumbnail
            import xbmc
            xbmc.executebuiltin("Container.SetViewMode(500)")
    else:
        listchannels({'action': 'listchannels', 'category': '%2a', 'channel': 'channelselector'},'','*')
项目:plugin.video.skygo    作者:trummerjo    | 项目源码 | 文件源码
def rootDir():
    print sys.argv
    nav = getNav()
    #Livesender
    liveChannelsDir()
    #Navigation der Ipad App
    for item in nav:
        if item.attrib['hide'] == 'true' or item.tag == 'item':
            continue
        url = common.build_url({'action': 'listPage', 'id': item.attrib['id']})
        addDir(item.attrib['label'], url)
        li = xbmcgui.ListItem(item.attrib['label'])

    #Merkliste
    watchlistDir()
    #Suchfunktion
    url = common.build_url({'action': 'search'})
    addDir('Suche', url)

    xbmcplugin.addSortMethod(handle=addon_handle, sortMethod=xbmcplugin.SORT_METHOD_NONE)
    xbmcplugin.addSortMethod(handle=addon_handle, sortMethod=xbmcplugin.SORT_METHOD_LABEL)
    xbmcplugin.endOfDirectory(addon_handle, cacheToDisc=True)
项目:plugin.video.skygo    作者:trummerjo    | 项目源码 | 文件源码
def listSeasonsFromSeries(series_id):
    url = skygo.baseUrl + '/sg/multiplatform/web/json/details/series/' + str(series_id) + '_global.json'
    r = requests.get(url)
    data = r.json()['serieRecap']['serie']
    xbmcplugin.setContent(addon_handle, 'seasons')
    for season in data['seasons']['season']:
        url = common.build_url({'action': 'listSeason', 'id': season['id'], 'series_id': data['id']})
        label = '%s - Staffel %02d' % (data['title'], season['nr'])
        li = xbmcgui.ListItem(label=label)
        li.setProperty('IsPlayable', 'false')
        li.setArt({'poster': skygo.baseUrl + season['path'], 
                   'fanart': getHeroImage(data)})
        li.setInfo('video', {'plot': data['synopsis'].replace('\n', '').strip()})
        xbmcplugin.addDirectoryItem(handle=addon_handle, url=url,
                                        listitem=li, isFolder=True)

    xbmcplugin.addSortMethod(handle=addon_handle, sortMethod=xbmcplugin.SORT_METHOD_NONE)
    xbmcplugin.addSortMethod(handle=addon_handle, sortMethod=xbmcplugin.SORT_METHOD_TITLE)
    xbmcplugin.addSortMethod(handle=addon_handle, sortMethod=xbmcplugin.SORT_METHOD_LABEL)
    xbmcplugin.addSortMethod(handle=addon_handle, sortMethod=xbmcplugin.SORT_METHOD_VIDEO_YEAR)   
    xbmcplugin.endOfDirectory(addon_handle, cacheToDisc=True)
项目:plugin.video.telekom-sport    作者:asciidisco    | 项目源码 | 文件源码
def show_matches_list(self, game_date, _for):
        """
        Creates the KODI list items with the contents of available matches
        for a given date

        :param game_date: Chosen event-lane
        :type game_date: string
        :param _for: Chosen sport
        :type _for: string
        """
        self.utils.log('Matches list: ' + _for)
        addon_data = self.utils.get_addon_data()
        plugin_handle = self.plugin_handle
        epg = self.get_epg(_for)
        items = epg.get(game_date)
        for item in items:
            url = self.utils.build_url(
                {'hash': item.get('hash'), 'date': game_date, 'for': _for})
            list_item = xbmcgui.ListItem(label=item.get('title'))
            list_item.setProperty('fanart_image', addon_data.get('fanart'))
            xbmcplugin.addDirectoryItem(
                handle=plugin_handle,
                url=url,
                listitem=list_item,
                isFolder=True)
            xbmcplugin.addSortMethod(
                handle=plugin_handle,
                sortMethod=xbmcplugin.SORT_METHOD_NONE)
        xbmcplugin.endOfDirectory(plugin_handle)
项目:tvalacarta    作者:tvalacarta    | 项目源码 | 文件源码
def mainlist(params,url,category):
    logger.info("channelselector.mainlist")

    # Verifica actualizaciones solo en el primer nivel
    if config.get_platform()!="boxee":
        try:
            from core import updater
        except ImportError:
            logger.info("channelselector.mainlist No disponible modulo actualizaciones")
        else:
            if config.get_setting("updatecheck2") == "true":
                logger.info("channelselector.mainlist Verificar actualizaciones activado")
                updater.checkforupdates()
            else:
                logger.info("channelselector.mainlist Verificar actualizaciones desactivado")

    itemlist = getmainlist("squares")
    for elemento in itemlist:
        logger.info("channelselector item="+elemento.tostring())
        addfolder(elemento.title , elemento.channel , elemento.action , thumbnailname=elemento.thumbnail, folder=elemento.folder)

    if config.get_platform()=="kodi-krypton":
        import plugintools
        plugintools.set_view( plugintools.TV_SHOWS )

    # Label (top-right)...
    import xbmcplugin
    #xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category="" )
    #xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE )
    xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )

    if config.get_setting("forceview")=="true":
        # Confluence - Thumbnail
        import xbmc
        xbmc.executebuiltin("Container.SetViewMode(500)")
项目:plugin.video.streamondemand-pureita    作者:orione7    | 项目源码 | 文件源码
def mainlist(params,url,category):
    logger.info("[trailertools.py] mainlist")
    titulo = ""
    listavideos = GetTrailerbyKeyboard(titulo,category)
    if len(listavideos)>0:
        for video in listavideos:
            titulo = video[1]
            url        = video[0]
            thumbnail  = video[2]
            xbmctools.addnewvideo( "trailertools" , "youtubeplay" , category , "Directo" ,  titulo , url , thumbnail , "Ver Video" )

    xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category=category )
    xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE )
    xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
项目:plugin.video.streamondemand-pureita    作者:orione7    | 项目源码 | 文件源码
def buscartrailer(params,url,category):
    print "[trailertools.py] Modulo: buscartrailer()"
    thumbnail = ""
    solo = "false"
    videotitle = title = urllib.unquote_plus( params.get("title") ).strip()
    if ":]" in videotitle:
        solo = "true"
        videotitle = re.sub("\[[^\]]+\]","",videotitle).strip()
    if config.get_localized_string(30110) in videotitle: #"Buscar trailer para"
        videotitle = videotitle.replace(config.get_localized_string(30110),"").strip()
    if config.get_localized_string(30111) in videotitle: #"Insatisfecho?, busca otra vez : "
        videotitle = videotitle.replace(config.get_localized_string(30111),"").strip()

        listavideos = GetTrailerbyKeyboard(videotitle.strip(),category)
    else:
        listavideos = gettrailer(videotitle.strip().strip(),category,solo)

    if len(listavideos)>0:
        for video in listavideos:
            titulo = video[1]
            url        = video[0]
            thumbnail  = video[2]
            duracion = video[3]
            xbmctools.addnewvideo( "trailertools" , "youtubeplay" , category , "youtube" ,  titulo , url , thumbnail , "Ver Video","",duracion )

    xbmctools.addnewfolder( CHANNELNAME , "buscartrailer" , category , config.get_localized_string(30111)+" "+videotitle , url , os.path.join(IMAGES_PATH, 'trailertools.png'), "" ) #"Insatisfecho?, busca otra vez : "        
    # Propiedades
    xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category=category )
    xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE )
    xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
项目:plugin.video.streamondemand-pureita    作者:orione7    | 项目源码 | 文件源码
def mainlist(params,url,category):
    logger.info("channelselector.mainlist")

    # Verifica actualizaciones solo en el primer nivel
    if config.get_platform()!="boxee":
        try:
            from core import updater
        except ImportError:
            logger.info("channelselector.mainlist No disponible modulo actualizaciones")
        else:
            if config.get_setting("updatecheck2") == "true":
                logger.info("channelselector.mainlist Verificar actualizaciones activado")
                try:
                    updater.checkforupdates()
                except:
                    import xbmcgui
                    dialog = xbmcgui.Dialog()
                    dialog.ok("Impossibile connettersi","Non è stato possibile verificare","la disponibilità di aggiornamenti")
                    logger.info("channelselector.mainlist Fallo al verificar la actualización")
                    pass
            else:
                logger.info("channelselector.mainlist Verificar actualizaciones desactivado")

    itemlist = getmainlist()
    for elemento in itemlist:
        logger.info("channelselector.mainlist item="+elemento.title)
        addfolder(elemento.title , elemento.channel , elemento.action , thumbnail=elemento.thumbnail, folder=elemento.folder)

    # Label (top-right)...
    import xbmcplugin
    xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category="" )
    xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE )
    xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )

    if config.get_setting("forceview")=="true":
        # Confluence - Thumbnail
        import xbmc
        xbmc.executebuiltin("Container.SetViewMode(500)")
项目:plugin.video.areena    作者:hirsivaja    | 项目源码 | 文件源码
def show_menu():
    if get_app_id() == '' or get_app_key() == '' or get_secret_key() == '':
        return show_credentials_needed_menu()
    listing = []
    tv_list_item = xbmcgui.ListItem(label='[COLOR {0}]{1}[/COLOR]'.format(
        get_color('menuItemColor'), get_translation(32031)))
    tv_url = '{0}?action=categories&base=5-130'.format(_url)
    listing.append((tv_url, tv_list_item, True))
    live_tv_list_item = xbmcgui.ListItem(label='[COLOR {0}]{1}[/COLOR]'.format(
        get_color('menuItemColor'), get_translation(32067)))
    live_tv_url = '{0}?action=live'.format(_url)
    listing.append((live_tv_url, live_tv_list_item, True))
    radio_list_item = xbmcgui.ListItem(label='[COLOR {0}]{1}[/COLOR]'.format(
        get_color('menuItemColor'), get_translation(32032)))
    radio_url = '{0}?action=categories&base=5-200'.format(_url)
    listing.append((radio_url, radio_list_item, True))
    search_list_item = xbmcgui.ListItem(label='[COLOR {0}]{1}[/COLOR]'.format(
        get_color('menuItemColor'), get_translation(32007)))
    search_url = '{0}?action=search'.format(_url)
    listing.append((search_url, search_list_item, True))
    favourites_list_item = xbmcgui.ListItem(label='[COLOR {0}]{1}[/COLOR]'.format(
        get_color('menuItemColor'), get_translation(32025)))
    favourites_url = '{0}?action=favourites'.format(_url)
    listing.append((favourites_url, favourites_list_item, True))
    open_settings_list_item = xbmcgui.ListItem(label='[COLOR {0}]{1}[/COLOR]'.format(
        get_color('menuItemColor'), get_translation(32040)))
    open_settings_url = '{0}?action=settings'.format(_url)
    listing.append((open_settings_url, open_settings_list_item, True))
    # Add our listing to Kodi.
    xbmcplugin.addDirectoryItems(_handle, listing, len(listing))
    # Add a sort method for the virtual folder items (alphabetically, ignore articles)
    xbmcplugin.addSortMethod(_handle, xbmcplugin.SORT_METHOD_NONE)
    # Finish creating a virtual folder.
    xbmcplugin.endOfDirectory(_handle)
项目:plugin.video.areena    作者:hirsivaja    | 项目源码 | 文件源码
def show_credentials_needed_menu():
    listing = []
    missing_credentials_list_item = xbmcgui.ListItem(label=get_translation(32038))
    missing_credentials_url = '{0}'.format(_url)
    listing.append((missing_credentials_url, missing_credentials_list_item, True))
    open_settings_list_item = xbmcgui.ListItem(label=get_translation(32039))
    open_settings_url = '{0}?action=settings'.format(_url)
    listing.append((open_settings_url, open_settings_list_item, True))
    # Add our listing to Kodi.
    xbmcplugin.addDirectoryItems(_handle, listing, len(listing))
    # Add a sort method for the virtual folder items (alphabetically, ignore articles)
    xbmcplugin.addSortMethod(_handle, xbmcplugin.SORT_METHOD_NONE)
    # Finish creating a virtual folder.
    xbmcplugin.endOfDirectory(_handle)
项目:plugin.video.skygo    作者:trummerjo    | 项目源码 | 文件源码
def listLiveTvChannelDirs():
    data = getlistLiveChannelData()
    for tab in data:
        url = common.build_url({'action': 'listLiveTvChannels', 'channeldir_name': tab['tabName']})
        li = xbmcgui.ListItem(label=tab['tabName'].title(), iconImage=icon_file)
        xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True)

    xbmcplugin.addSortMethod(handle=addon_handle, sortMethod=xbmcplugin.SORT_METHOD_NONE)
    xbmcplugin.addSortMethod(handle=addon_handle, sortMethod=xbmcplugin.SORT_METHOD_LABEL)
    xbmcplugin.endOfDirectory(addon_handle, cacheToDisc=True)
项目:plugin.video.skygo    作者:trummerjo    | 项目源码 | 文件源码
def listEpisodesFromSeason(series_id, season_id):
    url = skygo.baseUrl + '/sg/multiplatform/web/json/details/series/' + str(series_id) + '_global.json'
    r = requests.get(url)
    data = r.json()['serieRecap']['serie']
    xbmcplugin.setContent(addon_handle, 'episodes')
    for season in data['seasons']['season']:
        if str(season['id']) == str(season_id):
            for episode in season['episodes']['episode']:
                #Check Altersfreigabe / Jugendschutzeinstellungen
                if 'parental_rating' in episode:
                    if js_showall == 'false':
                        if not skygo.parentalCheck(episode['parental_rating']['value'], play=False):   
                            continue
                url = common.build_url({'action': 'playVod', 'vod_id': episode['id']})
                li = xbmcgui.ListItem()
                li.setProperty('IsPlayable', 'true')
                li.addContextMenuItems(getWatchlistContextItem({'type': 'Episode', 'data': episode}), replaceItems=False)
                info, episode = getInfoLabel('Episode', episode)
                li.setInfo('video', info)
                li.setLabel('%02d. %s' % (info['episode'], info['title']))
                li.setArt({'poster': skygo.baseUrl + season['path'], 
                           'fanart': getHeroImage(data),
                           'thumb': skygo.baseUrl + episode['webplayer_config']['assetThumbnail']})
                xbmcplugin.addDirectoryItem(handle=addon_handle, url=url,
                                            listitem=li, isFolder=False)

    xbmcplugin.addSortMethod(addon_handle, sortMethod=xbmcplugin.SORT_METHOD_EPISODE)
    xbmcplugin.addSortMethod(addon_handle, sortMethod=xbmcplugin.SORT_METHOD_LABEL)
    xbmcplugin.addSortMethod(addon_handle, sortMethod=xbmcplugin.SORT_METHOD_TITLE)
    xbmcplugin.addSortMethod(addon_handle, sortMethod=xbmcplugin.SORT_METHOD_VIDEO_YEAR) 
    xbmcplugin.addSortMethod(addon_handle, sortMethod=xbmcplugin.SORT_METHOD_DURATION)
    xbmcplugin.addSortMethod(addon_handle, sortMethod=xbmcplugin.SORT_METHOD_NONE)
    xbmcplugin.endOfDirectory(addon_handle, cacheToDisc=True)
项目:tvalacarta    作者:tvalacarta    | 项目源码 | 文件源码
def add_items_to_kodi_directory(itemlist,parent_item):
    logger.info("tvalacarta.platformcode.xbmctools add_items_to_kodi_directory")

    pluginhandle = int( sys.argv[ 1 ] )

    # Checks if channel provides context menu for items
    exec "import channels."+parent_item.channel+" as channelmodule"
    channel_provides_context_menu = hasattr(channelmodule, 'get_context_menu_for_item')

    for item in itemlist:

        # If video has no fanart, here is assigned a new one
        if item.fanart=="":
            channel_fanart = os.path.join( config.get_runtime_path(), 'resources', 'images', 'fanart', item.channel+'.jpg')

            if os.path.exists(channel_fanart):
                item.fanart = channel_fanart
            else:
                item.fanart = os.path.join(config.get_runtime_path(),"fanart.jpg")

        # Add item to kodi directory
        add_item_to_kodi_directory(item,itemlist,channel_provides_context_menu)

    # Closes the XBMC directory
    xbmcplugin.setPluginCategory( handle=pluginhandle, category=parent_item.category )
    xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE )

    # Forces the view mode
    if config.get_setting("forceview")=="true":

        import plugintools

        if parent_item.view=="list":
            plugintools.set_view( plugintools.LIST )
        elif parent_item.view=="programs":
            plugintools.set_view( plugintools.TV_SHOWS )
        elif parent_item.view=="channels" or parent_item.view=="thumbnails":

            if config.get_platform()=="kodi-krypton":
                plugintools.set_view( plugintools.TV_SHOWS )
            else:
                plugintools.set_view( plugintools.THUMBNAIL )
        elif parent_item.view=="videos":
            plugintools.set_view( plugintools.EPISODES )

    xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
项目:plugin.video.netflix    作者:asciidisco    | 项目源码 | 文件源码
def build_season_listing(self, seasons_sorted, build_url):
        """Builds the season list screen for a show

        Parameters
        ----------
        seasons_sorted : :obj:`list` of :obj:`dict` of :obj:`str`
            Sorted list of season entries

        build_url : :obj:`fn`
            Function to build the subsequent routes

        Returns
        -------
        bool
            List could be build
        """
        for season in seasons_sorted:
            li = xbmcgui.ListItem(label=season['text'])
            # add some art to the item
            li = self._generate_art_info(entry=season, li=li)
            # add list item info
            li, infos = self._generate_entry_info(
                entry=season,
                li=li,
                base_info={'mediatype': 'season'})
            li = self._generate_context_menu_items(entry=season, li=li)
            params = {'action': 'episode_list', 'season_id': season['id']}
            if 'tvshowtitle' in infos:
                title = infos.get('tvshowtitle', '').encode('utf-8')
                params['tvshowtitle'] = base64.urlsafe_b64encode(title)
            url = build_url(params)
            xbmcplugin.addDirectoryItem(
                handle=self.plugin_handle,
                url=url,
                listitem=li,
                isFolder=True)

        xbmcplugin.addSortMethod(
            handle=self.plugin_handle,
            sortMethod=xbmcplugin.SORT_METHOD_NONE)
        xbmcplugin.addSortMethod(
            handle=self.plugin_handle,
            sortMethod=xbmcplugin.SORT_METHOD_VIDEO_YEAR)
        xbmcplugin.addSortMethod(
            handle=self.plugin_handle,
            sortMethod=xbmcplugin.SORT_METHOD_LABEL)
        xbmcplugin.addSortMethod(
            handle=self.plugin_handle,
            sortMethod=xbmcplugin.SORT_METHOD_LASTPLAYED)
        xbmcplugin.addSortMethod(
            handle=self.plugin_handle,
            sortMethod=xbmcplugin.SORT_METHOD_TITLE)
        xbmcplugin.endOfDirectory(self.plugin_handle)
        self.set_custom_view(VIEW_SEASON)
        return True
项目:plugin.video.streamondemand-pureita    作者:orione7    | 项目源码 | 文件源码
def gettrailer(titulovideo,category,solo="false"):

    print "[trailertools.py] Modulo: gettrailer(titulo = %s , category = %s)"  % (titulovideo,category)

    if not solo=="true":
        titulo = re.sub('\([^\)]+\)','',titulovideo)
        titulo = title = re.sub('\[[^\]]+\]','',titulo)

        sopa_palabras_invalidas = ("dvdrip" ,  "dvdscreener2" ,"tsscreener" , "latino" ,     # Esto es para peliculasyonkis o parecidos
                                   "dvdrip1",  "dvdscreener"  ,"tsscreener1", "latino1",
                                   "latino2",  "dvdscreener1" ,"screener"    ,
                                   "mirror" ,  "megavideo"    ,"vose"        , "subtitulada"
                                   )

        titulo = LimpiarTitulo(titulo)
        print "el tituloooo es :%s" %titulo

        trozeado = titulo.split()
        for trozo in trozeado:
            if trozo in sopa_palabras_invalidas:
                titulo = titulo.replace(trozo ,"")
        titulo = re.sub(' $','',titulo)
        titulo = titulo.replace("ver pelicula online vos","").strip()
        titulo = titulo.replace("ver pelicula online","").strip()
        titulo = titulo.replace("mirror 1","").strip()
        titulo = titulo.replace("parte 1","").strip()
        titulo = titulo.replace("part 1","").strip()
        titulo = titulo.replace("pt 1","").strip()        
        titulo = titulo.replace("peliculas online","").strip()
        encontrados = []
        if len(titulo)==0:
            titulo = "El_video_no_tiene_titulo"

        encontrados = GetFrom_Trailersdepeliculas(titulo)      # Primero busca en www.trailerdepeliculas.org
        encontrados  = encontrados + GetVideoFeed(titulo)      # luego busca con el API de youtube 
    else:
        titulo = titulovideo
        encontrados = []
        if len(titulo)==0:
            titulo = "El_video_no_tiene_titulo"
        encontrados  = encontrados + GetVideoFeed(titulo,"true")
    if len(encontrados)>0:                                   # si encuentra algo, termina
        return encontrados
    else:
        encontrados = GetFromYoutubePlaylist(titulo)       # si no encuentra, busca en las listas de la web de youtube
        if len(encontrados)>0:
            return encontrados
        else:
            respuesta = alertnoencontrado(titulo)          # si aun no encuentra,lanza mensaje de alerta y pregunta si quiere 
            if respuesta:                                  # buscar, modificando el titulo, con el teclado 
                encontrados = GetTrailerbyKeyboard(titulo,category) # si respuesta es afirmativa este entrara en un bucle 
                if len(encontrados)>0:                       # de autollamadas hasta encontrar el trailer o la respuesta 
                    return encontrados                       # del mensaje alerta sea negativo.
                else:return []
            else:
                xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category=category )
                xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE )
                xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )

    return encontrados
项目:kodi-addons    作者:leonardoxiao    | 项目源码 | 文件源码
def list_categories():
    """
    Create the list of video categories in the Kodi interface.
    """
    # Get video categories
    categories = get_categories()
    # Create a list for our items.
    listing = []
    # Iterate through categories
    for category in categories:
        category_name = category['name']
        category_url = category['url']
        # Create a list item with a text label and a thumbnail image.
        list_item = xbmcgui.ListItem(label=category_name, thumbnailImage=THUMBNAIL)
        # Set graphics (thumbnail, fanart, banner, poster, landscape etc.) for the list item.
        # Here we use the same image for all items for simplicity's sake.
        # In a real-life plugin you need to set each image accordingly.
        list_item.setArt({'thumb': THUMBNAIL,
                          'icon': THUMBNAIL,
                          'fanart': THUMBNAIL})
        # Set additional info for the list item.
        # Here we use a category name for both properties for for simplicity's sake.
        # setInfo allows to set various information for an item.
        # For available properties see the following link:
        # http://mirrors.xbmc.org/docs/python-docs/15.x-isengard/xbmcgui.html#ListItem-setInfo
        list_item.setInfo('video', {'title': category_name, 'genre': category_name})
        # Create a URL for the plugin recursive callback.
        # Example: plugin://plugin.video.example/?action=listing&category=Animals
        url = '{0}?action=list&category_name={1}&category_url={2}'.format(_url, category_name, category_url)
        # is_folder = True means that this item opens a sub-list of lower level items.
        is_folder = True
        # Add our item to the listing as a 3-element tuple.
        listing.append((url, list_item, is_folder))

    # Add our listing to Kodi.
    # Large lists and/or slower systems benefit from adding all items at once via addDirectoryItems
    # instead of adding one by ove via addDirectoryItem.
    xbmcplugin.addDirectoryItems(_handle, listing, len(listing))
    # Add a sort method for the virtual folder items (alphabetically, ignore articles)
    #xbmcplugin.addSortMethod(_handle, xbmcplugin.SORT_METHOD_LABEL_IGNORE_THE)
    xbmcplugin.addSortMethod(_handle, xbmcplugin.SORT_METHOD_NONE)
    # Finish creating a virtual folder.
    xbmcplugin.endOfDirectory(_handle)
项目:kodi-addons    作者:leonardoxiao    | 项目源码 | 文件源码
def list_matches(videos):
    """
    Create the list of matches in the Kodi interface.
    """
    print("=====list_matches()")

    # Create a list for our items.
    listing = []
    # Iterate through videos.
    for video in videos:
        # Create a list item with a text label and a thumbnail image.
        list_item = xbmcgui.ListItem(label=video['name'])

        if video['video'] == None:
            # Non-video item: next page
            url = video['url']

            list_item.setProperty('IsPlayable', 'false')

            # Add the list item to a virtual Kodi folder.
            is_folder = True

        else:
            # Set additional info for the list item.
            list_item.setInfo('video', {'title': video['name'], 'genre': video['genre']})
            # Set graphics (thumbnail, fanart, banner, poster, landscape etc.) for the list item.
            # Here we use the same image for all items for simplicity's sake.
            # In a real-life plugin you need to set each image accordingly.
            list_item.setArt({'thumb': video['thumb'], 'icon': video['thumb'], 'fanart': video['thumb']})

            # Create a URL for the plugin recursive callback.
            url = u'{0}?action=view&match={1}'.format(_url, video['video'])

            # Set 'IsPlayable' property to 'true'.
            # This is mandatory for playable items!
            list_item.setProperty('IsPlayable', 'true')

            # Add the list item to a virtual Kodi folder.
            # is_folder = False means that this item won't open any sub-list.
            is_folder = False

        # Add our item to the listing as a 3-element tuple.
        listing.append((url, list_item, is_folder))

    # Add our listing to Kodi.
    # Large lists and/or slower systems benefit from adding all items at once via addDirectoryItems
    # instead of adding one by ove via addDirectoryItem.
    xbmcplugin.addDirectoryItems(_handle, listing, len(listing))
    # Add a sort method for the virtual folder items (alphabetically, ignore articles)
    #xbmcplugin.addSortMethod(_handle, xbmcplugin.SORT_METHOD_LABEL_IGNORE_THE)
    xbmcplugin.addSortMethod(_handle, xbmcplugin.SORT_METHOD_NONE)
    # Finish creating a virtual folder.
    xbmcplugin.endOfDirectory(_handle)
项目:plugin.video.skygo    作者:trummerjo    | 项目源码 | 文件源码
def listAssets(asset_list, isWatchlist=False):
    for item in asset_list:
        isPlayable = False
        li = xbmcgui.ListItem(label=item['label'], iconImage=icon_file)
        if item['type'] in ['Film', 'Episode', 'Sport', 'Clip', 'Series', 'live', 'searchresult']:
            isPlayable = True
            #Check Altersfreigabe / Jugendschutzeinstellungen
            if 'parental_rating' in item['data']:
                if js_showall == 'false':
                    if not skygo.parentalCheck(item['data']['parental_rating']['value'], play=False):   
                        continue
            info, item['data'] = getInfoLabel(item['type'], item['data'])
            # xbmc.log( "Debug_Info Current item Element: %s" % (item) ) 
            li.setInfo('video', info)
            li.setLabel(info['title'])         
            li.setArt({'poster': getPoster(item['data']), 'fanart': getHeroImage(item['data'])})           
        if item['type'] in ['Film']:
            xbmcplugin.setContent(addon_handle, 'movies')
            if xbmcaddon.Addon().getSetting('lookup_tmdb_data') == 'true' and 'TMDb_poster_path' in item['data']:
                poster_path = item['data']['TMDb_poster_path'] 
            else:
                poster_path = getPoster(item['data'])
            # xbmc.log('Debug-Info: Current Poster in item: %s' % getPoster(item['data']) ) 
            # xbmc.log('Debug-Info: Current Poster in info: %s' % item['data']['TMDb_poster_path'] )    
            li.setArt({'poster': poster_path})
        elif item['type'] in ['Series']:
            xbmcplugin.setContent(addon_handle, 'tvshows')
            isPlayable = False
        elif item['type'] in ['Episode']:
            xbmcplugin.setContent(addon_handle, 'episodes')
        elif item['type'] in ['Sport', 'Clip']:
            xbmcplugin.setContent(addon_handle, 'files')
            li.setArt({'thumb': getHeroImage(item['data'])})
        elif item['type'] == 'searchresult':          
            xbmcplugin.setContent(addon_handle, 'movies')
        elif item['type'] == ('live'):
            xbmcplugin.setContent(addon_handle, 'files')
            if 'TMDb_poster_path' in item['data']:
                poster = item['data']['TMDb_poster_path']
            elif 'mediainfo' in item['data']:
                poster = getPoster(item['data']['mediainfo'])
            else:
                poster = getPoster(item['data']['channel'])
            fanart = skygo.baseUrl + item['data']['event']['image'] if item['data']['channel']['name'].find('News') == -1 else skygo.baseUrl + '/bin/Picture/817/C_1_Picture_7179_content_4.jpg'
            thumb = skygo.baseUrl + item['data']['event']['image'] if item['data']['channel']['name'].find('News') == -1 else getChannelLogo(item['data']['channel'])
            li.setArt({'poster': poster, 'fanart': fanart, 'thumb': thumb})

        #add contextmenu item for watchlist to playable content - not for live and clip content
        if isPlayable and not item['type'] in ['live', 'Clip']:
            li.addContextMenuItems(getWatchlistContextItem(item, isWatchlist), replaceItems=False)
        li.setProperty('IsPlayable', str(isPlayable).lower())
        xbmcplugin.addDirectoryItem(handle=addon_handle, url=item['url'],
                                    listitem=li, isFolder=(not isPlayable))

    xbmcplugin.addSortMethod(handle=addon_handle, sortMethod=xbmcplugin.SORT_METHOD_NONE)
    xbmcplugin.addSortMethod(handle=addon_handle, sortMethod=xbmcplugin.SORT_METHOD_LABEL)
    xbmcplugin.addSortMethod(handle=addon_handle, sortMethod=xbmcplugin.SORT_METHOD_TITLE)
    xbmcplugin.addSortMethod(handle=addon_handle, sortMethod=xbmcplugin.SORT_METHOD_VIDEO_YEAR)
    xbmcplugin.addSortMethod(handle=addon_handle, sortMethod=xbmcplugin.SORT_METHOD_DURATION)
    xbmcplugin.endOfDirectory(addon_handle, cacheToDisc=True)