• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python regexUtils.parseText函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中utils.regexUtils.parseText函数的典型用法代码示例。如果您正苦于以下问题:Python parseText函数的具体用法?Python parseText怎么用?Python parseText使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了parseText函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: executeItem

 def executeItem(self, item):
     url = item["url"]
     if "(" in url:
         xbmcCommand = parseText(url, "([^\(]*).*")
         if xbmcCommand.lower() in ["activatewindow", "runscript", "runplugin", "playmedia"]:
             if xbmcCommand.lower() == "activatewindow":
                 params = parseText(url, ".*\(\s*(.+?)\s*\).*").split(",")
                 for i in range(len(params) - 1, -1, -1):
                     p = params[i]
                     if p == "return":
                         params.remove(p)
                 path = enc.unescape(params[len(params) - 1])
                 xbmc.executebuiltin("Container.Update(" + path + ")")
                 return
             xbmc.executebuiltin(enc.unescape(url))
开发者ID:Mendim,项目名称:tdbaddon,代码行数:15,代码来源:main.py


示例2: executeItem

 def executeItem(self, item):
     url = item['url']
     if '(' in url:
         xbmcCommand = parseText(url,'([^\(]*).*')
         if xbmcCommand.lower() in ['activatewindow', 'runscript', 'runplugin', 'playmedia']:
             if xbmcCommand.lower() == 'activatewindow':
                 params = parseText(url, '.*\(\s*(.+?)\s*\).*').split(',')
                 for i in range(len(params)-1,-1,-1):
                     p = params[i]
                     if p == 'return':
                         params.remove(p)
                 path = enc.unescape(params[len(params)-1])
                 xbmc.executebuiltin('Container.Update(' + path + ')')
                 return
             xbmc.executebuiltin(enc.unescape(url))
开发者ID:hackur,项目名称:SportsDevil-Fixes,代码行数:15,代码来源:main.py


示例3: getInfo

def getInfo(item, params, src):
    src = enc.smart_unicode(src).encode('utf-8')
    paramArr = __parseParams(params)
    paramPage = paramArr[0].replace('%s', src)

    paramPage = urllib.unquote(paramPage)
    if paramPage.startswith('@') and paramPage.endswith('@'):
        paramPage = item.getInfo(paramPage.strip('@'))

    
    paramRegex = paramArr[1].replace('%s', src)
    if paramRegex.startswith('@') and paramRegex.endswith('@'):
        paramRegex = item.getInfo(paramRegex.strip('@'))
        
    referer = ''
    variables=[]
    if len(paramArr) > 2:
        referer = paramArr[2]
        referer = referer.replace('%s', src)
        if referer.startswith('@') and referer.endswith('@'):
            referer = item.getInfo(referer.strip('@'))
    if len(paramArr) > 3:
        variables = paramArr[3].strip("'").split('|')
    common.log('Get Info from: "'+ paramPage + '" from "' + referer + '"')
    data = common.getHTML(paramPage, referer, referer!='')
    return reg.parseText(data, paramRegex, variables)
开发者ID:Gemini88,项目名称:addons,代码行数:26,代码来源:customConversions.py


示例4: getInfo

def getInfo(item, params, src):
    src = enc.smart_unicode(src).encode('utf-8')
    paramArr = __parseParams(params)
    paramPage = paramArr[0].replace('%s', src)

    if paramPage.startswith('@') and paramPage.endswith('@'):
        paramPage = item.getInfo(paramPage.strip('@'))

    
    paramRegex = paramArr[1].replace('%s', src)
    if paramRegex.startswith('@') and paramRegex.endswith('@'):
        paramRegex = item.getInfo(paramRegex.strip('@'))
        
    referer = ''
    form_data = ''
    variables=[]
    if len(paramArr) > 2:
        referer = paramArr[2]
        referer = referer.replace('%s', src)
        if referer.startswith('@') and referer.endswith('@'):
            referer = item.getInfo(referer.strip('@'))
    if len(paramArr) > 3:
        variables = paramArr[3].strip("'").split('|')
    common.log('Get Info from: "'+ paramPage + '" from "' + referer + '"')

    try:
        parts = (paramPage.split('|', 1) + [None] * 2)[:2]
        paramPage, form_data = parts
        form_data = urlparse.parse_qsl(form_data)
    except: 
        pass

    data = common.getHTML(paramPage, form_data, referer, referer!='',demystify=True)
    return reg.parseText(data, paramRegex, variables)
开发者ID:crawlers1977,项目名称:plugin.video.SportsDevil,代码行数:34,代码来源:customConversions.py


示例5: parseText

def parseText(params, src):
    src = enc.smart_unicode(src)
    paramArr = __parseParams(params)

    text = paramArr[0].replace('%s',src)
    regex = paramArr[1].replace('%s', src)
    variables = []
    if len(paramArr) > 2:
        variables = paramArr[2].split('|')
    return reg.parseText(text, regex, variables)
开发者ID:rollysalvana,项目名称:pampereo-xbmc-plugins,代码行数:10,代码来源:customConversions.py


示例6: parseText

def parseText(item, params, src):
    paramArr = __parseParams(params)

    text = paramArr[0].replace('%s',src)
    if text.startswith('@') and text.endswith('@'):
        text = item.getInfo(text.strip('@'))

    regex = paramArr[1].replace('%s', src)
    if regex.startswith('@') and regex.endswith('@'):
        regex = item.getInfo(regex.strip('@'))

    variables = []
    if len(paramArr) > 2:
        variables = paramArr[2].split('|')
    return reg.parseText(text, regex, variables)
开发者ID:mrknow,项目名称:filmkodi,代码行数:15,代码来源:customConversions.py


示例7: getInfo

def getInfo(item, params, src, xml=False, mobile=False):
    paramArr = __parseParams(params)
    paramPage = paramArr[0].replace('%s', src)

    if paramPage.startswith('@') and paramPage.endswith('@'):
        paramPage = item.getInfo(paramPage.strip('@'))

    
    paramRegex = paramArr[1].replace('%s', src)
    if paramRegex.startswith('@') and paramRegex.endswith('@'):
        paramRegex = item.getInfo(paramRegex.strip('@'))
        
    referer = ''
    form_data = ''
    variables=[]
    if len(paramArr) > 2:
        referer = paramArr[2]
        referer = referer.replace('%s', src)
        if referer.startswith('@') and referer.endswith('@'):
            referer = item.getInfo(referer.strip('@'))
    if len(paramArr) > 3:
        variables = paramArr[3].strip("'").split('|')
        
    parsed_link = urlparse.urlsplit(referer)
    parsed_link = parsed_link._replace(netloc=parsed_link.netloc.encode('idna'),path=urllib.quote(parsed_link.path.encode('utf-8')))
    referer = parsed_link.geturl().encode('utf-8')
    
    try:
        parts = (paramPage.split('|', 1) + [None] * 2)[:2]
        paramPage, form_data = parts
        form_data = urlparse.parse_qsl(form_data)
    except: 
        pass

    common.log('Get Info from: "'+ paramPage + '" from "' + referer + '"')
    data = common.getHTML(paramPage, form_data, referer, xml, mobile, ignoreCache=False,demystify=True)
    #common.log('Get Info data: %s ' % reg.parseText(data, paramRegex, variables) )
    #common.log('Get Info data: "' + data + '"')
    return reg.parseText(data, paramRegex, variables)
开发者ID:mrknow,项目名称:filmkodi,代码行数:39,代码来源:customConversions.py


示例8: run

    def run(self, paramstring):
        common.log('SportsDevil running')
        try:
            # Main Menu
            if len(paramstring) <= 2:
                # Set fanart
                xbmcplugin.setPluginFanart(self.handle, common.Paths.pluginFanart)

                # Clear cache
                self.clearCache()

                # Show Main Menu
                tmpList = self.parseView(self.MAIN_MENU_FILE)
                if tmpList:
                    self.currentlist = tmpList
                    self.curr_file = tmpList.cfg

            else:
                params = paramstring
                mode, codedItem = params.split('&',1)
                mode = int(mode.split('=')[1])

                codedItem = codedItem[4:]
                item = decodeUrl(codedItem)

                # switch(mode)
                if mode == Mode.VIEW:
                    tmpList = self.parseView(codedItem)
                    if tmpList:
                        self.currentlist = tmpList
                        self.curr_file = tmpList.cfg
                        count = len(self.currentlist.items)
                        if count == 0:
                            common.showInfo('No stream available')
                        elif count == 1:
                            # Autoplay single video
                            autoplayEnabled = common.getSetting('autoplay') == 'true'
                            if autoplayEnabled:
                                videos = self.currentlist.getVideos()
                                if len(videos) == 1:
                                    self.playVideo(videos[0], True)


                elif mode == Mode.ADDITEM:
                    if self.favouritesManager.addItem():
                        xbmc.executebuiltin('Container.Refresh()')

                elif mode in [Mode.ADDTOFAVOURITES, Mode.REMOVEFROMFAVOURITES, Mode.EDITITEM]:

                    if mode == Mode.ADDTOFAVOURITES:
                        self.favouritesManager.addToFavourites(item)
                    elif mode == Mode.REMOVEFROMFAVOURITES:
                        self.favouritesManager.removeItem(item)
                        xbmc.executebuiltin('Container.Refresh()')
                    elif mode == Mode.EDITITEM:
                        if self.favouritesManager.editItem(item):
                            xbmc.executebuiltin('Container.Refresh()')

                elif mode == Mode.EXECUTE:
                    url = item['url']
                    if url.find('(') > -1:
                        xbmcCommand = parseText(url,'([^\(]*).*')
                        if xbmcCommand.lower() in ['activatewindow', 'runscript', 'runplugin', 'playmedia']:
                            if xbmcCommand.lower() == 'activatewindow':
                                params = parseText(url, '.*\(\s*(.+?)\s*\).*').split(',')
                                for i in range(len(params)-1,-1,-1):
                                    p = params[i]
                                    if p == 'return':
                                        params.remove(p)
                                path = enc.unescape(params[len(params)-1])
                                xbmc.executebuiltin('Container.Update(' + path + ')')
                                return
                            xbmc.executebuiltin(enc.unescape(url))

                elif mode == Mode.PLAY:
                    self.playVideo(item)

                elif mode == Mode.QUEUE:
                    dia = DialogProgress()
                    dia.create('SportsDevil', 'Get videos...' + item['title'])
                    dia.update(0)

                    items = self.getVideos(item, dia)
                    if items:
                        for it in items:
                            item = self.createXBMCListItem(it)
                            uc = sys.argv[0] + '?mode=' + str(Mode.PLAY) + '&url=' + codeUrl(it)
                            item.setProperty('IsPlayable', 'true')
                            item.setProperty('IsFolder','false')
                            xbmc.PlayList(1).add(uc, item)
                        resultLen = len(items)
                        msg = 'Queued ' + str(resultLen) + ' video'
                        if resultLen > 1:
                            msg += 's'
                        dia.update(100, msg)
                        xbmc.sleep(500)
                        dia.update(100, msg,' ',' ')
                    else:
                        dia.update(0, 'No items found',' ')

#.........这里部分代码省略.........
开发者ID:rollysalvana,项目名称:pampereo-xbmc-plugins,代码行数:101,代码来源:main.py



注:本文中的utils.regexUtils.parseText函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python render.render函数代码示例发布时间:2022-05-26
下一篇:
Python regexUtils.findall函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap