当前位置: 首页>>代码示例>>Python>>正文


Python LoggingException.fromException方法代码示例

本文整理汇总了Python中loggingexception.LoggingException.fromException方法的典型用法代码示例。如果您正苦于以下问题:Python LoggingException.fromException方法的具体用法?Python LoggingException.fromException怎么用?Python LoggingException.fromException使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在loggingexception.LoggingException的用法示例。


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

示例1: PlayEpisode

# 需要导入模块: from loggingexception import LoggingException [as 别名]
# 或者: from loggingexception.LoggingException import fromException [as 别名]
    def PlayEpisode(self, page, resumeFlag):
        self.log(u"", xbmc.LOGDEBUG)

        try:
            html = None
            self.log(u"urlRoot: " + urlRoot + u", page: " + page )
            html = self.httpManager.GetWebPage( urlRoot + page, 1800 )
            #raise Exception("test1", "test2")
        except (Exception) as exception:
            if not isinstance(exception, LoggingException):
                exception = LoggingException.fromException(exception)

            if html is not None:
                msg = u"html:\n\n%s\n\n" % html
                exception.addLogMessage(msg)
                
            # Error getting web page
            exception.addLogMessage(self.language(30050))
            exception.process(severity = self.logLevel(xbmc.LOGERROR))
            return False

        soup = BeautifulSoup(html)

        ageCheck = soup.find(u'div', {u'id':u'age_check_form_row'})
        
        if ageCheck is not None:
            
            if self.dialog.iscanceled():
                return False
            # "Getting episode info"
            self.dialog.update(25, self.language(30084))
            try:
                html = None
                html = self.httpManager.GetWebPage( urlRoot + page, 1800, values = {u'age_ok':'1'} )
                soup = BeautifulSoup(html)
            except (Exception) as exception:
                exception = LoggingException.fromException(exception)
    
                if html is not None:
                    msg = u"html:\n\n%s\n\n" % html
                    exception.addLogMessage(msg)
                    
                # Error getting web page: %s
                exception.addLogMessage(self.language(30050) + u": " + ( urlRoot + page ) )
    
                # Error getting web page
                exception.process(self.language(30050), u'', severity = self.logLevel(xbmc.LOGERROR))
                return False
    
        rtmpVar = self.InitialiseRTMP(soup)

        infoLabels = self.GetEpisodeInfo(soup)
        thumbnail = soup.find(u'meta', {u'property' : u'og:image'})[u'content']
        defaultFilename = infoLabels[u'Title']

        resumeKey = unicode(zlib.crc32(page))
        return self.PlayOrDownloadEpisode(infoLabels, thumbnail, rtmpVar, defaultFilename, url = None, subtitles = None, resumeKey = resumeKey, resumeFlag = resumeFlag)
开发者ID:Lusephur,项目名称:plugin-video-irishtv,代码行数:59,代码来源:tv3.py

示例2: ListShows

# 需要导入模块: from loggingexception import LoggingException [as 别名]
# 或者: from loggingexception.LoggingException import fromException [as 别名]
    def ListShows(self, html):
        self.log(u"", xbmc.LOGDEBUG)
        listItems = []

        try:
            soup = BeautifulSoup(html, selfClosingTags=[u'img'])
            episodes = soup.findAll(u'a', u"thumbnail-programme-link")

            for episode in episodes:
                self.AddEpisodeToList(listItems, episode)

            xbmcplugin.addDirectoryItems( handle=self.pluginHandle, items=listItems )
            xbmcplugin.endOfDirectory( handle=self.pluginHandle, succeeded=True )

            return True
        except (Exception) as exception:
            if not isinstance(exception, LoggingException):
                exception = LoggingException.fromException(exception)

            if html is not None:
                msg = "html:\n\n%s\n\n" % html
                exception.addLogMessage(msg)

            # Error getting list of shows
            exception.addLogMessage(self.language(30049))
            # Error getting list of shows
            exception.process(severity = self.logLevel(xbmc.LOGERROR))
            return False
开发者ID:vmware,项目名称:workflowTools,代码行数:30,代码来源:rte.py

示例3: GetFullLink

# 需要导入模块: from loggingexception import LoggingException [as 别名]
# 或者: from loggingexception.LoggingException import fromException [as 别名]
    def GetFullLink(self, episodeId, series, js):
        self.log("", xbmc.LOGDEBUG)
        try:
            pattern = u"function (loadPlayer.+?)^}"
            match=re.search(pattern, js, re.MULTILINE | re.DOTALL)
            loadPlayer = match.group(1)
            
            pattern = u"linkUrl\s*=\s*[\"'](http://.+?)[\"']"
            linkUrl = re.search(pattern, loadPlayer, re.DOTALL).group(1)
            
            linkUrl.replace(u'/ie/', u'/%s/' % self.languageCode)
            
            pattern = u"(fullLinkUrl\s*=\s*linkUrl.*?);"
            fullLinkUrlCode = re.search(pattern, loadPlayer, re.DOTALL).group(1)
    
            vidId = episodeId
            progTitle = series
            
            fullLinkUrl = ""
            exec(fullLinkUrlCode)
    
            if fullLinkUrl != "":
                return fullLinkUrl
        
        except (Exception) as exception:
            if not isinstance(exception, LoggingException):
                exception = LoggingException.fromException(exception)

            # Error getting player url. Using default.
            exception.addLogMessage(self.language(30039))
            exception.process(severity = xbmc.LOGWARNING)
            
            return self.GetDefaultFullLink(episodeId, series)
开发者ID:Lusephur,项目名称:plugin-video-irishtv,代码行数:35,代码来源:tg4.py

示例4: CallBitlyApi

# 需要导入模块: from loggingexception import LoggingException [as 别名]
# 或者: from loggingexception.LoggingException import fromException [as 别名]
    def CallBitlyApi(self, username, key, apiUrl, longUrl, dataType, episodeId, series ):
        self.log("longUrl: %s", xbmc.LOGDEBUG)
        try:
            values = {
                  u'callback': '%s%d' % (dataType, int(round(time.time() * 1000.0))),
                  #u'longUrl': (longUrl + u"id=%s&title=%s" % (episodeId, series)).encode(u'latin1'),
                  u'longUrl': (longUrl).encode(u'latin1'),
                  u'apiKey': key,
                  u'login': username
                  }

            jsonData = self.httpManager.GetWebPage(apiUrl, 20000, values = values)
            
            jsonText = utils.extractJSON (jsonData)
            bitlyJSON = _json.loads(jsonText)
            
            return bitlyJSON[u'data'][u'url'] 
        
        except (Exception) as exception:
            if not isinstance(exception, LoggingException):
                exception = LoggingException.fromException(exception)

            # Error calling bit.ly API
            exception.addLogMessage(self.language(30038))
            exception.process(severity = self.logLevel(xbmc.LOGERROR))

            raise exception
开发者ID:Lusephur,项目名称:plugin-video-irishtv,代码行数:29,代码来源:tg4.py

示例5: DoSearchQuery

# 需要导入模块: from loggingexception import LoggingException [as 别名]
# 或者: from loggingexception.LoggingException import fromException [as 别名]
    def DoSearchQuery( self, query = None, queryUrl = None):
        if query is not None:
            queryUrl = urlRoot + self.GetSearchURL() + mycgi.URLEscape(query)

        self.log(u"queryUrl: %s" % queryUrl, xbmc.LOGDEBUG)
        try:
            html = None
            html = self.httpManager.GetWebPage( queryUrl, 1800 )
            if html is None or html == '':
                # Data returned from web page: %s, is: '%s'
                logException = LoggingException(logMessage = self.language(30060) % ( __SEARCH__ + mycgi.URLEscape(query), html))

                # Error getting web page
                logException.process(self.language(30050), u'', severity = self.logLevel(xbmc.LOGWARNING))
                return False

            self.ListSearchShows(html)

            return True
        except (Exception) as exception:
            if not isinstance(exception, LoggingException):
                exception = LoggingException.fromException(exception)

            if html is not None:
                msg = "html:\n\n%s\n\n" % html
                exception.addLogMessage(msg)

            # Error performing query %s
            exception.addLogMessage(self.language(30052) % query)
            exception.process(severity = self.logLevel(xbmc.LOGERROR))
            return False
开发者ID:vmware,项目名称:workflowTools,代码行数:33,代码来源:rte.py

示例6: GetQSData

# 需要导入模块: from loggingexception import LoggingException [as 别名]
# 或者: from loggingexception.LoggingException import fromException [as 别名]
    def GetQSData(self, vidId, bitlyUrl, js):
        self.log("", xbmc.LOGDEBUG)
        
        try:
            pattern = u"function (createPlayerHtml.+?)^}"
            match=re.search(pattern, js, re.MULTILINE | re.DOTALL)
            createPlayerHtml = match.group(1)
            
            bc_params = {}
            pattern = u"[^/][^/]\s+(bc_params\s*\[.+?\]\s*=.+?);"
            paramAppends = re.findall(pattern, createPlayerHtml)
            
            for paramAppend in paramAppends:
                paramAppend = paramAppend.replace(u'true', u'True')
                paramAppend = paramAppend.replace(u'["', u'[u"')
                paramAppend = paramAppend.replace(u'= "', u'= u"')
                self.log(u"paramAppend: %s" % paramAppend, xbmc.LOGDEBUG)
                exec(paramAppend)
            
            if bc_params < 10:
                self.log(self.language(30036), xbmc.LOGWARNING)
                self.log(utils.drepr(bc_params), xbmc.LOGDEBUG)
                return self.GetDefaultQSData(vidId, bitlyUrl)
        except (Exception) as exception:
            if not isinstance(exception, LoggingException):
                exception = LoggingException.fromException(exception)

            # Unable to determine qsdata. Using default values.
            exception.addLogMessage(self.language(40600))
            exception.process(severity = xbmc.LOGWARNING)

            return self.GetDefaultQSData(vidId, bitlyUrl)
            
        return bc_params
开发者ID:Lusephur,项目名称:plugin-video-irishtv,代码行数:36,代码来源:tg4.py

示例7: ListAvailable

# 需要导入模块: from loggingexception import LoggingException [as 别名]
# 或者: from loggingexception.LoggingException import fromException [as 别名]
    def ListAvailable(self, html):
        self.log(u"", xbmc.LOGDEBUG)
        listItems = []

        try:
            soup = BeautifulSoup(html, selfClosingTags=[u'img'])
            count = int(soup.find(u'meta', { u'name' : u"episodes_available"} )[u'content'])

            availableEpisodes = soup.findAll(u'a', u"thumbnail-programme-link")

            for index in range ( 0, count ):
                self.AddEpisodeToList(listItems, availableEpisodes[index])

            xbmcplugin.addDirectoryItems( handle=self.pluginHandle, items=listItems )
            xbmcplugin.endOfDirectory( handle=self.pluginHandle, succeeded=True )

            return True
        except (Exception) as exception:
            if not isinstance(exception, LoggingException):
                exception = LoggingException.fromException(exception)

            if html is not None:
                msg = "html:\n\n%s\n\n" % html
                exception.addLogMessage(msg)

            # Error getting count of available episodes
            exception.addLogMessage(self.language(30045))
            exception.process(self.language(30046), self.language(30045), self.logLevel(xbmc.LOGERROR))
            return False
开发者ID:vmware,项目名称:workflowTools,代码行数:31,代码来源:rte.py

示例8: GetLiveVideoParams

# 需要导入模块: from loggingexception import LoggingException [as 别名]
# 或者: from loggingexception.LoggingException import fromException [as 别名]
    def GetLiveVideoParams(self, js):
        self.log(u"", xbmc.LOGDEBUG)

        try:
            pattern = u"function (getLivePlayer.+?)^}"
            match=re.search(pattern, js, re.MULTILINE | re.DOTALL)
            getLivePlayer = match.group(1)
            
            pattern = u'} else {\s+id\s*=\s*[\'"](\d+?)[\'"]'
            videoId = re.search(pattern, getLivePlayer, re.DOTALL).group(1)
            
            pattern='progTitle\s*=\s*"(.+?)"'
            progTitle = re.search(pattern, getLivePlayer, re.DOTALL).group(1)
            
            return (videoId, progTitle)
        except (Exception) as exception:
            if not isinstance(exception, LoggingException):
                exception = LoggingException.fromException(exception)
            
            if playerFunctionsJs is not None:
                msg = u"playerFunctionsJs:\n\n%s\n\n" % playerFunctionsJs
                exception.addLogMessage(msg)
                
            # Unable to determine live video parameters. Using default values.
            exception.addLogMessage(self.language(30022))
            exception.process(severity = xbmc.LOGWARNING)

            return (defaultLiveVideoId, defaultLiveProgTitle)
开发者ID:Lusephur,项目名称:plugin-video-irishtv,代码行数:30,代码来源:tg4.py

示例9: AddLiveMenuItem

# 需要导入模块: from loggingexception import LoggingException [as 别名]
# 或者: from loggingexception.LoggingException import fromException [as 别名]
    def AddLiveMenuItem(self, listItems, labelEN, labelIE, urlFragment):
        try:
            if self.languageCode == u'en':
                newLabel = labelEN
            else:
                newLabel = labelIE
            
            thumbnailPath = self.GetThumbnailPath(newLabel)

            schedule = self.GetLiveSchedule()
            newLabel = newLabel + "  [" + schedule + "]"
            newListItem = xbmcgui.ListItem( label=newLabel )
            newListItem.setThumbnailImage(thumbnailPath)
            newListItem.setProperty("Video", "true")
            #newListItem.setProperty('IsPlayable', 'true')

            url = self.GetURLStart() + urlFragment
                
            listItems.append( (url, newListItem, False) )
        except (Exception) as exception:
            if not isinstance(exception, LoggingException):
                exception = LoggingException.fromException(exception)

            # Not fatal, just means that we don't have the news option
            exception.process(severity = xbmc.LOGWARNING)
开发者ID:Lusephur,项目名称:plugin-video-irishtv,代码行数:27,代码来源:tg4.py

示例10: GetSWFPlayer

# 需要导入模块: from loggingexception import LoggingException [as 别名]
# 或者: from loggingexception.LoggingException import fromException [as 别名]
    def GetSWFPlayer(self):
        self.log(u"", xbmc.LOGDEBUG)

        try:
            xml = self.httpManager.GetWebPage(configUrl, 20000)
            soup = BeautifulStoneSoup(xml)

            swfPlayer = soup.find("player")['url']

            if swfPlayer.find('.swf') > 0:
                swfPlayer=re.search("(.*\.swf)", swfPlayer).groups()[0]

            if swfPlayer.find('http') == 0:
                # It's an absolute URL, do nothing.
                pass
            elif swfPlayer.find('/') == 0:
                # If it's a root URL, append it to the base URL:
                swfPlayer = urljoin(urlRoot, swfPlayer)
            else:
                # URL is relative to config.xml
                swfPlayer = urljoin(configUrl, swfPlayer)

            return swfPlayer

        except (Exception) as exception:
            if not isinstance(exception, LoggingException):
                exception = LoggingException.fromException(exception)

            # Unable to determine swfPlayer URL. Using default: %s
            exception.addLogMessage(self.language(30520) % swfDefault)
            exception.process(severity = self.logLevel(xbmc.LOGWARNING))
            return swfDefault
开发者ID:vmware,项目名称:workflowTools,代码行数:34,代码来源:rte.py

示例11: PlayOrDownloadEpisode

# 需要导入模块: from loggingexception import LoggingException [as 别名]
# 或者: from loggingexception.LoggingException import fromException [as 别名]
 def PlayOrDownloadEpisode(self, infoLabels, thumbnail, rtmpVar = None, defaultFilename = u'', url = None, subtitles = None, resumeKey = None, resumeFlag = False):
     try:
         action = self.GetAction(infoLabels[u'Title'])
 
         if self.dialog.iscanceled():
             return False
         
         if ( action == 1 ):
             # Play
             # "Preparing to play video"
             self.dialog.update(50, self.language(30085))
             self.Play(infoLabels, thumbnail, rtmpVar, url, subtitles, resumeKey, resumeFlag)
     
         elif ( action == 0 ):
                 # Download
                 # "Preparing to download video"
             self.dialog.update(50, self.language(30086))
             self.Download(rtmpVar, defaultFilename, subtitles)
 
         return True
     except (Exception) as exception:
         if not isinstance(exception, LoggingException):
             exception = LoggingException.fromException(exception)
 
         # Error playing or downloading episode %s
         exception.process(self.language(30051) % u'', u'', self.logLevel(xbmc.LOGERROR))
         return False
开发者ID:Lusephur,项目名称:plugin-video-irishtv,代码行数:29,代码来源:provider.py

示例12: AddEpisodeToList

# 需要导入模块: from loggingexception import LoggingException [as 别名]
# 或者: from loggingexception.LoggingException import fromException [as 别名]
    def AddEpisodeToList(self, listItems, episode):
        self.log(u"", xbmc.LOGDEBUG)

        try:
            htmlparser = HTMLParser.HTMLParser()

            href = episode[u'href']
            title = htmlparser.unescape( episode.find(u'span', u"thumbnail-title").contents[0] )
            date = episode.find(u'span', u"thumbnail-date").contents[0]
            #description = ...
            thumbnail = episode.find(u'img', u'thumbnail')[u'src']

            newLabel = title + u", " + date

            newListItem = xbmcgui.ListItem( label=newLabel )
            newListItem.setThumbnailImage(thumbnail)

            if self.addon.getSetting( u'RTE_descriptions' ) == u'true':
                infoLabels = self.GetEpisodeInfo(self.GetEpisodeIdFromURL(href))
            else:
                infoLabels = {u'Title': title, u'Plot': title}

            newListItem.setInfo(u'video', infoLabels)
            newListItem.setProperty(u"Video", u"true")
            #newListItem.setProperty('IsPlayable', 'true')

            self.log(u"label == " + newLabel, xbmc.LOGDEBUG)

            if u"episodes available" in date:
                url = self.GetURLStart()  + u'&listavailable=1' + u'&page=' + mycgi.URLEscape(href)
                folder = True
            else:
                newListItem.setProperty("Video", "true")
                #newListItem.setProperty('IsPlayable', 'true')

                folder = False
                match = re.search( u"/player/[^/]+/show/([0-9]+)/", href )
                if match is None:
                    self.log(u"No show id found in page href: '%s'" % href, xbmc.LOGWARNING)
                    return

                episodeId = match.group(1)

                url = self.GetURLStart() + u'&episodeId=' +  mycgi.URLEscape(episodeId)

                if self.resumeEnabled:
                    resumeKey = episodeId
                    self.ResumeListItem(url, newLabel, newListItem, resumeKey)

            listItems.append( (url, newListItem, folder) )
        except (Exception) as exception:
            if not isinstance(exception, LoggingException):
                exception = LoggingException.fromException(exception)

            msg = u"episode:\n\n%s\n\n" % utils.drepr(episode)
            exception.addLogMessage(msg)

            # Error getting episode details
            exception.addLogMessage(self.language(30099))
            exception.process(self.logLevel(xbmc.LOGWARNING))
开发者ID:vmware,项目名称:workflowTools,代码行数:62,代码来源:rte.py

示例13: ShowRootMenu

# 需要导入模块: from loggingexception import LoggingException [as 别名]
# 或者: from loggingexception.LoggingException import fromException [as 别名]
    def ShowRootMenu(self):
        self.log(u"", xbmc.LOGDEBUG)
        try:
            listItems = []
            liveItemTuple = None
            searchItemTuple = None

            self.AddMenuItem(listItems, u"Search", u'Cuardaigh', u'&search=1')
            self.AddMenuItem(listItems, u"Latest", u"Is Déanaí", u'&latest=1')
            self.AddMenuItem(listItems, u"Categories", u'Catag\u00f3ir\u00ed', u'&categories=1')
            self.AddMenuItem(listItems, u"Popular", u"Is Coitianta", u'&popular=1')

            # TODO Fix live TV
            ##self.AddLiveMenuItem(listItems, u"Live", u"Beo", u'&live=1')

            xbmcplugin.addDirectoryItems( handle=self.pluginHandle, items=listItems )
            xbmcplugin.endOfDirectory( handle=self.pluginHandle, succeeded=True )
            
            return True
        
        except (Exception) as exception:
            if not isinstance(exception, LoggingException):
                exception = LoggingException.fromException(exception)

            if xml is not None:
                msg = u"xml:\n\n%s\n\n" % xml
                exception.addLogMessage(msg)
            
            # Cannot show root menu
            exception.addLogMessage(self.language(30010))
            exception.process(severity = self.logLevel(xbmc.LOGERROR))
            return False
开发者ID:Lusephur,项目名称:plugin-video-irishtv,代码行数:34,代码来源:tg4.py

示例14: GetSearchURL

# 需要导入模块: from loggingexception import LoggingException [as 别名]
# 或者: from loggingexception.LoggingException import fromException [as 别名]
    def GetSearchURL(self):
        try:
            rootMenuHtml = None
            html = None
            rootMenuHtml = self.httpManager.GetWebPage(rootMenuUrl, 60)
            playerJSUrl = self.GetPlayerJSURL(rootMenuHtml)

            html = self.httpManager.GetWebPage(playerJSUrl, 20000)

            programmeSearchIndex = html.find('Programme Search')
            match=re.search("window.location.href = \'(.*?)\'", html[programmeSearchIndex:])
            searchURL = match.group(1)

        except (Exception) as exception:
            if not isinstance(exception, LoggingException):
                exception = LoggingException.fromException(exception)

            if rootMenuHtml is not None:
                msg = "rootMenuHtml:\n\n%s\n\n" % rootMenuHtml
                exception.addLogMessage(msg)

            if html is not None:
                msg = "html:\n\n%s\n\n" % html
                exception.addLogMessage(msg)

            # Error getting search url: Using default %s
            exception.addLogMessage(self.language(30054) + searchUrlDefault)
            exception.process(severity = self.logLevel(xbmc.LOGWARNING))
            searchURL = searchUrlDefault

        return searchURL
开发者ID:vmware,项目名称:workflowTools,代码行数:33,代码来源:rte.py

示例15: initialise

# 需要导入模块: from loggingexception import LoggingException [as 别名]
# 或者: from loggingexception.LoggingException import fromException [as 别名]
    def initialise(self, showId, showTitle, season, dataFolder):
        method = u"EpisodeList.initialise"
        self.log (u"initialise showId: %s, showTitle: %s, season: %s " % ( showId, showTitle, season ), xbmc.LOGDEBUG)

        try:
            self.html = None
            self.dataFolder = dataFolder
            url = None
            url = self.showUrl % (showId, season)

            self.html = self.cache.GetWebPage( url, 600 ) # 10 minutes
            
            self.log (u"page: %s\n\n%s\n\n" % ( url, self.html ), xbmc.LOGDEBUG)
            self.showId = showId
            self.showTitle = showTitle
            self.currentSeason = season

            return True
        except (Exception) as exception:
            if not isinstance(exception, LoggingException):
                exception = LoggingException.fromException(exception)
            
            if html is not None:
                msg = u"html:\n\n%s\n\n" % html
                exception.addLogMessage(msg)
            
            # 'Error getting episode list'
            exception.addLogMessage(__language__(30790))
            raise exception
开发者ID:microtv,项目名称:guide,代码行数:31,代码来源:episodelist.py


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